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

Unified Diff: content/renderer/media/webrtc/webrtc_video_capturer_adapter.h

Issue 282523003: Deliver video frames on libjingle worker thread to WebRtcVideoCapturerAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Tommis comments. Created 6 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/webrtc/webrtc_video_capturer_adapter.h
diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
index 753bf3cbf528790130f3117f9a9767d3de77576b..ead09e2f188d39771d5f049a05ff2fbe73a292b1 100644
--- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
+++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.h
@@ -8,6 +8,8 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/message_loop/message_loop_proxy.h"
+#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
#include "media/base/video_frame.h"
#include "media/video/capture/video_capture_types.h"
@@ -22,9 +24,13 @@ namespace content {
class CONTENT_EXPORT WebRtcVideoCapturerAdapter
: NON_EXPORTED_BASE(public cricket::VideoCapturer) {
public:
- explicit WebRtcVideoCapturerAdapter(bool is_screencast);
+ WebRtcVideoCapturerAdapter(
+ const scoped_refptr<base::MessageLoopProxy>& worker_thread_proxy,
+ bool is_screencast);
virtual ~WebRtcVideoCapturerAdapter();
+ // OnFrameCaptured delivers video frames to libjingle. It must be called on
+ // libjingles worker thread.
// This method is virtual for testing purposes.
virtual void OnFrameCaptured(const scoped_refptr<media::VideoFrame>& frame);
@@ -43,6 +49,12 @@ class CONTENT_EXPORT WebRtcVideoCapturerAdapter
void UpdateI420Buffer(const scoped_refptr<media::VideoFrame>& src);
private:
+ // |thread_checker_| is bound to the main render thread.
+ base::ThreadChecker thread_checker_;
+ // |worker_thread_proxy_| is used to ensure methods are called on the
+ // libjingle worker thread.
+ scoped_refptr<base::MessageLoopProxy> worker_thread_proxy_;
+
const bool is_screencast_;
bool running_;
base::TimeDelta first_frame_timestamp_;

Powered by Google App Engine
This is Rietveld 408576698