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

Side by Side Diff: content/renderer/media/webrtc/webrtc_video_capturer_adapter.h

Issue 2456443002: Add callback to copy texture backed frames in WebRtcVideoFrameAdapter (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h"
16 #include "media/base/video_capture_types.h" 17 #include "media/base/video_capture_types.h"
17 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
18 #include "media/base/video_frame_pool.h" 19 #include "media/base/video_frame_pool.h"
20 #include "media/renderers/skcanvas_video_renderer.h"
19 #include "third_party/webrtc/media/base/videocapturer.h" 21 #include "third_party/webrtc/media/base/videocapturer.h"
20 22
23 namespace base {
24 class WaitableEvent;
25 } // namespace base
26
21 namespace content { 27 namespace content {
22 28
29 class ContextProviderCommandBuffer;
30
23 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is 31 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is
24 // used for VideoCapturing in libJingle and especially in PeerConnections. 32 // used for VideoCapturing in libJingle and especially in PeerConnections.
25 // The class is created and destroyed on the main render thread. 33 // The class is created and destroyed on the main render thread.
26 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread. 34 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread.
27 // An instance of WebRtcVideoCapturerAdapter is owned by an instance of 35 // An instance of WebRtcVideoCapturerAdapter is owned by an instance of
28 // webrtc::VideoTrackSourceInterface in libJingle. The implementation of 36 // webrtc::VideoTrackSourceInterface in libJingle. The implementation of
29 // webrtc::VideoTrackSourceInterface guarantees that this object is not deleted 37 // webrtc::VideoTrackSourceInterface guarantees that this object is not deleted
30 // while it is still used in libJingle. 38 // while it is still used in libJingle.
31 class CONTENT_EXPORT WebRtcVideoCapturerAdapter 39 class CONTENT_EXPORT WebRtcVideoCapturerAdapter
32 : NON_EXPORTED_BASE(public cricket::VideoCapturer) { 40 : NON_EXPORTED_BASE(public cricket::VideoCapturer) {
(...skipping 11 matching lines...) Expand all
44 // These methods are accessed from a libJingle worker thread. 52 // These methods are accessed from a libJingle worker thread.
45 cricket::CaptureState Start( 53 cricket::CaptureState Start(
46 const cricket::VideoFormat& capture_format) override; 54 const cricket::VideoFormat& capture_format) override;
47 void Stop() override; 55 void Stop() override;
48 bool IsRunning() override; 56 bool IsRunning() override;
49 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override; 57 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override;
50 bool GetBestCaptureFormat(const cricket::VideoFormat& desired, 58 bool GetBestCaptureFormat(const cricket::VideoFormat& desired,
51 cricket::VideoFormat* best_format) override; 59 cricket::VideoFormat* best_format) override;
52 bool IsScreencast() const override; 60 bool IsScreencast() const override;
53 61
62 void CopyTextureFrame(
63 const scoped_refptr<media::VideoFrame>& frame,
64 scoped_refptr<media::VideoFrame>* new_frame);
65 void CopyTextureFrameOnMainThread(
66 const scoped_refptr<media::VideoFrame>& frame,
67 scoped_refptr<media::VideoFrame>* new_frame,
68 base::WaitableEvent* waiter);
mcasas 2016/10/26 16:06:02 I see with worry the existence of |base::WaitableE
emircan 2016/10/27 00:37:56 I added comments explaining it. Unfortunately, I c
69 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
70 const scoped_refptr<ContextProviderCommandBuffer> provider_;
71 media::SkCanvasVideoRenderer canvas_video_renderer_;
72 WebRtcVideoFrameAdapter::CopyTextureFrameCallback copy_texture_callback_;
73
54 // |thread_checker_| is bound to the libjingle worker thread. 74 // |thread_checker_| is bound to the libjingle worker thread.
55 base::ThreadChecker thread_checker_; 75 base::ThreadChecker thread_checker_;
56 76
57 const bool is_screencast_; 77 const bool is_screencast_;
58 bool running_; 78 bool running_;
59 79
60 media::VideoFramePool scaled_frame_pool_; 80 media::VideoFramePool scaled_frame_pool_;
61 81
82 base::WeakPtrFactory<WebRtcVideoCapturerAdapter> weak_factory_;
83
62 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter); 84 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter);
63 }; 85 };
64 86
65 } // namespace content 87 } // namespace content
66 88
67 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ 89 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698