Chromium Code Reviews| Index: webrtc/test/vcm_capturer.cc |
| diff --git a/webrtc/test/vcm_capturer.cc b/webrtc/test/vcm_capturer.cc |
| index 792b97ff0883f7157a9f11f9cff622a9885b23b3..2683f3703351ed0b2bf175011f14eb07c0e303ba 100644 |
| --- a/webrtc/test/vcm_capturer.cc |
| +++ b/webrtc/test/vcm_capturer.cc |
| @@ -16,9 +16,7 @@ |
| namespace webrtc { |
| namespace test { |
| -VcmCapturer::VcmCapturer(webrtc::VideoCaptureInput* input) |
| - : VideoCapturer(input), started_(false), vcm_(NULL) { |
| -} |
| +VcmCapturer::VcmCapturer() : started_(false), sink_(nullptr), vcm_(NULL) {} |
| bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) { |
| VideoCaptureModule::DeviceInfo* device_info = |
| @@ -54,11 +52,10 @@ bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) { |
| return true; |
| } |
| -VcmCapturer* VcmCapturer::Create(VideoCaptureInput* input, |
| - size_t width, |
| +VcmCapturer* VcmCapturer::Create(size_t width, |
| size_t height, |
| size_t target_fps) { |
| - VcmCapturer* vcm_capturer = new VcmCapturer(input); |
| + VcmCapturer* vcm_capturer = new VcmCapturer(); |
| if (!vcm_capturer->Init(width, height, target_fps)) { |
| // TODO(pbos): Log a warning that this failed. |
| delete vcm_capturer; |
| @@ -78,6 +75,19 @@ void VcmCapturer::Stop() { |
| started_ = false; |
| } |
| +void VcmCapturer::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| + const rtc::VideoSinkWants& wants) { |
| + rtc::CritScope lock(&crit_); |
| + RTC_CHECK(!sink_); |
| + sink_ = sink; |
| +} |
| + |
| +void VcmCapturer::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) { |
| + rtc::CritScope lock(&crit_); |
| + RTC_CHECK(sink_); |
|
nisse-webrtc
2016/08/22 07:20:29
Consider stronger check, sink != nullptr, and sink
perkj_webrtc
2016/09/01 11:46:16
Done.
|
| + sink_ = nullptr; |
| +} |
| + |
| void VcmCapturer::Destroy() { |
| if (!vcm_) |
| return; |
| @@ -93,8 +103,8 @@ VcmCapturer::~VcmCapturer() { Destroy(); } |
| void VcmCapturer::OnIncomingCapturedFrame(const int32_t id, |
| const VideoFrame& frame) { |
| rtc::CritScope lock(&crit_); |
| - if (started_) |
| - input_->IncomingCapturedFrame(frame); |
| + if (started_ && sink_) |
| + sink_->OnFrame(frame); |
| } |
| void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { |