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

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 the last round. 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..0f38f6b9ed74bf1af6b6bc1b4ab618298ce9c228 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"
@@ -19,12 +21,18 @@ namespace content {
// used for VideoCapturing in libJingle and especially in PeerConnections.
// The class is created and destroyed on the main render thread.
// PeerConnection access cricket::VideoCapturer from a libJingle worker thread.
+// An instance of WebRtcVideoCapturerAdapter is owned by an instance of
+// webrtc::VideoSourceInterface in libJingle. The implementation of
+// webrtc::VideoSourceInterface guarantees that this object is not deleted
+// while it is still used in libJingle.
class CONTENT_EXPORT WebRtcVideoCapturerAdapter
: NON_EXPORTED_BASE(public cricket::VideoCapturer) {
public:
explicit WebRtcVideoCapturerAdapter(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);
@@ -42,7 +50,9 @@ class CONTENT_EXPORT WebRtcVideoCapturerAdapter
void UpdateI420Buffer(const scoped_refptr<media::VideoFrame>& src);
- private:
+ // |thread_checker_| is bound to the libjingle worker thread.
+ base::ThreadChecker thread_checker_;
+
const bool is_screencast_;
bool running_;
base::TimeDelta first_frame_timestamp_;

Powered by Google App Engine
This is Rietveld 408576698