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

Side by Side Diff: webrtc/media/base/capturerenderadapter.h

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 11 matching lines...) Expand all
22 #include "webrtc/base/criticalsection.h" 22 #include "webrtc/base/criticalsection.h"
23 #include "webrtc/base/sigslot.h" 23 #include "webrtc/base/sigslot.h"
24 #include "webrtc/media/base/videocapturer.h" 24 #include "webrtc/media/base/videocapturer.h"
25 #include "webrtc/media/base/videosinkinterface.h" 25 #include "webrtc/media/base/videosinkinterface.h"
26 26
27 namespace cricket { 27 namespace cricket {
28 28
29 class VideoCapturer; 29 class VideoCapturer;
30 class VideoProcessor; 30 class VideoProcessor;
31 31
32 class CaptureRenderAdapter : public sigslot::has_slots<> { 32 // TODO(perkj): Considering removing CaptureRenderAdapter and replace it by
33 // directly using cricket::VideoCapturer::AddSink.
34 class CaptureRenderAdapter : public rtc::VideoSinkInterface<VideoFrame> {
pthatcher1 2016/02/08 20:59:39 This seems exactly like the VideoBroadcaster. Can
perkj_webrtc 2016/02/09 13:23:57 I had planned to do that in a follow up. But sure-
33 public: 35 public:
34 static CaptureRenderAdapter* Create(VideoCapturer* video_capturer); 36 static CaptureRenderAdapter* Create(VideoCapturer* video_capturer);
35 ~CaptureRenderAdapter(); 37 ~CaptureRenderAdapter();
36 38
37 void AddSink(rtc::VideoSinkInterface<VideoFrame>* sink); 39 void AddSink(rtc::VideoSinkInterface<VideoFrame>* sink);
38 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink); 40 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink);
39 41
40 VideoCapturer* video_capturer() { return video_capturer_; } 42 VideoCapturer* video_capturer() { return video_capturer_; }
43
41 private: 44 private:
42
43 explicit CaptureRenderAdapter(VideoCapturer* video_capturer); 45 explicit CaptureRenderAdapter(VideoCapturer* video_capturer);
44 void Init(); 46 void Init();
45 47
46 // Callback for frames received from the capturer. 48 // Callback for frames received from the capturer.
47 void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* video_frame); 49 void OnFrame(const VideoFrame& frame) override;
48 50
49 // Just pointers since ownership is not handed over to this class. 51 // Just pointers since ownership is not handed over to this class.
50 std::vector<rtc::VideoSinkInterface<VideoFrame>*> sinks_; 52 std::vector<rtc::VideoSinkInterface<VideoFrame>*> sinks_;
51 VideoCapturer* video_capturer_; 53 VideoCapturer* video_capturer_;
52 // Critical section synchronizing the capture thread. 54 // Critical section synchronizing the capture thread.
53 rtc::CriticalSection capture_crit_; 55 rtc::CriticalSection capture_crit_;
54 }; 56 };
55 57
56 } // namespace cricket 58 } // namespace cricket
57 59
58 #endif // WEBRTC_MEDIA_BASE_CAPTURERENDERADAPTER_H_ 60 #endif // WEBRTC_MEDIA_BASE_CAPTURERENDERADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698