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

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

Issue 2262443003: Delete VideoFrameFactory, CapturedFrame, and related code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update apply_rotation_ comment. 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/media/base/fakevideocapturer.h ('k') | webrtc/media/base/videocapturer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/videoadapter_unittest.cc
diff --git a/webrtc/media/base/videoadapter_unittest.cc b/webrtc/media/base/videoadapter_unittest.cc
index e8056798907f36dc8afae9e9e77d7032f2a3b8bc..444ef548869d8e23d057d11306214841cdb2145b 100644
--- a/webrtc/media/base/videoadapter_unittest.cc
+++ b/webrtc/media/base/videoadapter_unittest.cc
@@ -31,18 +31,18 @@ class VideoAdapterTest : public testing::Test {
capture_format_.interval = VideoFormat::FpsToInterval(30);
listener_.reset(new VideoCapturerListener(&adapter_));
- capturer_->SignalFrameCaptured.connect(
- listener_.get(), &VideoCapturerListener::OnFrameCaptured);
+ capturer_->AddOrUpdateSink(listener_.get(), rtc::VideoSinkWants());
}
virtual void TearDown() {
// Explicitly disconnect the VideoCapturer before to avoid data races
// (frames delivered to VideoCapturerListener while it's being destructed).
- capturer_->SignalFrameCaptured.disconnect_all();
+ capturer_->RemoveSink(listener_.get());
}
protected:
- class VideoCapturerListener: public sigslot::has_slots<> {
+ class VideoCapturerListener
+ : public rtc::VideoSinkInterface<cricket::VideoFrame> {
public:
struct Stats {
int captured_frames;
@@ -62,19 +62,18 @@ class VideoAdapterTest : public testing::Test {
last_adapt_was_no_op_(false) {
}
- void OnFrameCaptured(VideoCapturer* capturer,
- const CapturedFrame* captured_frame) {
+ void OnFrame(const cricket::VideoFrame& frame) {
rtc::CritScope lock(&crit_);
- const int in_width = captured_frame->width;
- const int in_height = abs(captured_frame->height);
+ const int in_width = frame.width();
+ const int in_height = frame.height();
int cropped_width;
int cropped_height;
int out_width;
int out_height;
- if (video_adapter_->AdaptFrameResolution(in_width, in_height,
- captured_frame->time_stamp,
- &cropped_width, &cropped_height,
- &out_width, &out_height)) {
+ if (video_adapter_->AdaptFrameResolution(
+ in_width, in_height,
+ frame.timestamp_us() * rtc::kNumNanosecsPerMicrosec,
+ &cropped_width, &cropped_height, &out_width, &out_height)) {
cropped_width_ = cropped_width;
cropped_height_ = cropped_height;
out_width_ = out_width;
@@ -183,7 +182,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 2);
- EXPECT_EQ(0, listener_->GetStats().dropped_frames);
+ EXPECT_EQ(1, listener_->GetStats().dropped_frames);
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 3);
@@ -191,7 +190,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 4);
- EXPECT_EQ(1, listener_->GetStats().dropped_frames);
+ EXPECT_EQ(2, listener_->GetStats().dropped_frames);
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 5);
@@ -199,7 +198,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 6);
- EXPECT_EQ(2, listener_->GetStats().dropped_frames);
+ EXPECT_EQ(3, listener_->GetStats().dropped_frames);
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 7);
@@ -207,7 +206,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 8);
- EXPECT_EQ(3, listener_->GetStats().dropped_frames);
+ EXPECT_EQ(4, listener_->GetStats().dropped_frames);
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 9);
@@ -215,7 +214,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateToHalf) {
capturer_->CaptureFrame();
EXPECT_GE(listener_->GetStats().captured_frames, 10);
- EXPECT_EQ(4, listener_->GetStats().dropped_frames);
+ EXPECT_EQ(5, listener_->GetStats().dropped_frames);
}
// Adapt the frame rate to be two thirds of the capture rate at the beginning.
« no previous file with comments | « webrtc/media/base/fakevideocapturer.h ('k') | webrtc/media/base/videocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698