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

Unified Diff: webrtc/test/vcm_capturer.cc

Issue 2348533002: Reland Replace interface VideoCapturerInput with VideoSinkInterface. (Closed)
Patch Set: Fix rtp timestamp in quality test. Created 4 years, 3 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
« no previous file with comments | « webrtc/test/vcm_capturer.h ('k') | webrtc/test/video_capturer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « webrtc/test/vcm_capturer.h ('k') | webrtc/test/video_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698