Index: webrtc/test/vcm_capturer.cc |
diff --git a/webrtc/test/vcm_capturer.cc b/webrtc/test/vcm_capturer.cc |
index 792b97ff0883f7157a9f11f9cff622a9885b23b3..49d97101e9459318bf284c5f667ad23adec91a2f 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_ == sink); |
+ 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) { |