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

Unified Diff: webrtc/media/base/testutils.cc

Issue 2258933003: Refactor WebRtcVideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase, and revert HAVE_WEBRTC_VIDEO hack. Created 4 years, 4 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/media/base/testutils.h ('k') | webrtc/media/engine/fakewebrtcvideocapturemodule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/testutils.cc
diff --git a/webrtc/media/base/testutils.cc b/webrtc/media/base/testutils.cc
index 9e2d174f61b6508dcea0d0b1ce051a3c327f6956..321719d3e9df175a61a1c1891be6363ff1243543 100644
--- a/webrtc/media/base/testutils.cc
+++ b/webrtc/media/base/testutils.cc
@@ -210,17 +210,19 @@ bool RtpTestUtility::VerifyPacket(const RtpDumpPacket* dump,
// Implementation of VideoCaptureListener.
VideoCapturerListener::VideoCapturerListener(VideoCapturer* capturer)
- : last_capture_state_(CS_STARTING),
+ : capturer_(capturer),
+ last_capture_state_(CS_STARTING),
frame_count_(0),
- frame_fourcc_(0),
frame_width_(0),
frame_height_(0),
- frame_size_(0),
resolution_changed_(false) {
capturer->SignalStateChange.connect(this,
&VideoCapturerListener::OnStateChange);
- capturer->SignalFrameCaptured.connect(this,
- &VideoCapturerListener::OnFrameCaptured);
+ capturer->AddOrUpdateSink(this, rtc::VideoSinkWants());
+}
+
+VideoCapturerListener::~VideoCapturerListener() {
+ capturer_->RemoveSink(this);
}
void VideoCapturerListener::OnStateChange(VideoCapturer* capturer,
@@ -228,15 +230,12 @@ void VideoCapturerListener::OnStateChange(VideoCapturer* capturer,
last_capture_state_ = result;
}
-void VideoCapturerListener::OnFrameCaptured(VideoCapturer* capturer,
- const CapturedFrame* frame) {
+void VideoCapturerListener::OnFrame(const VideoFrame& frame) {
++frame_count_;
if (1 == frame_count_) {
- frame_fourcc_ = frame->fourcc;
- frame_width_ = frame->width;
- frame_height_ = frame->height;
- frame_size_ = frame->data_size;
- } else if (frame_width_ != frame->width || frame_height_ != frame->height) {
+ frame_width_ = frame.width();
+ frame_height_ = frame.height();
+ } else if (frame_width_ != frame.width() || frame_height_ != frame.height()) {
resolution_changed_ = true;
}
}
« no previous file with comments | « webrtc/media/base/testutils.h ('k') | webrtc/media/engine/fakewebrtcvideocapturemodule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698