Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2591)

Unified Diff: content/renderer/media/video_track_recorder.h

Issue 2000003002: Initialize based on frame sizes in VideoTrackRecorder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mrgpu2
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/video_track_recorder.h
diff --git a/content/renderer/media/video_track_recorder.h b/content/renderer/media/video_track_recorder.h
index 5e624549224362132c2a842d31db65ae3d0369d6..bb256acea7e5e7fcd7dc7fe4f5dd3bc139180140 100644
--- a/content/renderer/media/video_track_recorder.h
+++ b/content/renderer/media/video_track_recorder.h
@@ -9,6 +9,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/single_thread_task_runner.h"
mcasas 2016/05/25 16:42:47 Forward declare SingleThreadTaskRunner
emircan 2016/05/27 04:27:20 Done.
#include "base/threading/thread_checker.h"
#include "content/public/common/features.h"
#include "content/public/renderer/media_stream_video_sink.h"
@@ -48,6 +50,8 @@ class CONTENT_EXPORT VideoTrackRecorder
int32_t bits_per_second);
~VideoTrackRecorder() override;
+ void StartFrameEncode(const scoped_refptr<media::VideoFrame>& frame,
+ base::TimeTicks capture_timestamp);
void Pause();
void Resume();
@@ -56,15 +60,43 @@ class CONTENT_EXPORT VideoTrackRecorder
private:
friend class VideoTrackRecorderTest;
+ enum Status {
+ NOT_INITIALIZED,
+ INITIALIZING,
+ INITIALIZED,
+ };
+
+ void InitializeEncoder(const scoped_refptr<media::VideoFrame>& frame,
+ base::TimeTicks capture_timestamp);
+
// Used to check that we are destroyed on the same thread we were created.
base::ThreadChecker main_render_thread_checker_;
+ // Used to post initialization on the same thread we were created.
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
mcasas 2016/05/25 16:42:47 const?
emircan 2016/05/27 04:27:20 Done.
+
+ // Task runner where frame encode callbacks must happen.
+ scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
+
+ // Tracks the initialization of the underlying encoder.
+ Status status_;
+
// We need to hold on to the Blink track to remove ourselves on dtor.
blink::WebMediaStreamTrack track_;
// Inner class to encode using whichever codec is configured.
scoped_refptr<Encoder> encoder_;
+ // Parameters that would be passed to the underlying |encoder_|.
+ const CodecId codec_;
+ const OnEncodedVideoCB on_encoded_video_callback_;
+ const int32_t bits_per_second_;
+
+ // Used to track the paused state during the initialization process.
+ bool paused_;
+
+ base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
};
« no previous file with comments | « no previous file | content/renderer/media/video_track_recorder.cc » ('j') | content/renderer/media/video_track_recorder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698