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

Unified Diff: webrtc/video/vie_encoder_unittest.cc

Issue 2383493005: Revert of Let ViEEncoder handle resolution changes. (Closed)
Patch Set: 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/video/vie_encoder.cc ('k') | webrtc/video_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder_unittest.cc
diff --git a/webrtc/video/vie_encoder_unittest.cc b/webrtc/video/vie_encoder_unittest.cc
index 5d1544b069a28d818813ba035e1a13e5d4e12d3e..00e6cefa6a36f19ff89ab211d18002a190d46222 100644
--- a/webrtc/video/vie_encoder_unittest.cc
+++ b/webrtc/video/vie_encoder_unittest.cc
@@ -26,8 +26,6 @@
ViEEncoderTest()
: video_send_config_(VideoSendStream::Config(nullptr)),
- codec_width_(320),
- codec_height_(240),
fake_encoder_(),
stats_proxy_(Clock::GetRealTimeClock(),
video_send_config_,
@@ -41,7 +39,10 @@
video_send_config_.encoder_settings.payload_type = 125;
VideoEncoderConfig video_encoder_config;
- test::FillEncoderConfiguration(1, &video_encoder_config);
+ video_encoder_config.streams = test::CreateVideoStreams(1);
+ codec_width_ = static_cast<int>(video_encoder_config.streams[0].width);
+ codec_height_ = static_cast<int>(video_encoder_config.streams[0].height);
+
vie_encoder_.reset(new ViEEncoder(
1 /* number_of_cores */, &stats_proxy_,
video_send_config_.encoder_settings, nullptr /* pre_encode_callback */,
@@ -80,26 +81,6 @@
: FakeEncoder(Clock::GetRealTimeClock()),
continue_encode_event_(false, false) {}
- VideoCodec codec_config() {
- rtc::CritScope lock(&crit_);
- return config_;
- }
-
- void BlockNextEncode() {
- rtc::CritScope lock(&crit_);
- block_next_encode_ = true;
- }
-
- void ContinueEncode() { continue_encode_event_.Set(); }
-
- void CheckLastTimeStampsMatch(int64_t ntp_time_ms,
- uint32_t timestamp) const {
- rtc::CritScope lock(&crit_);
- EXPECT_EQ(timestamp_, timestamp);
- EXPECT_EQ(ntp_time_ms_, ntp_time_ms);
- }
-
- private:
int32_t Encode(const VideoFrame& input_image,
const CodecSpecificInfo* codec_specific_info,
const std::vector<FrameType>* frame_types) override {
@@ -122,8 +103,21 @@
return result;
}
-
-
+ void BlockNextEncode() {
+ rtc::CritScope lock(&crit_);
+ block_next_encode_ = true;
+ }
+
+ void ContinueEncode() { continue_encode_event_.Set(); }
+
+ void CheckLastTimeStampsMatch(int64_t ntp_time_ms,
+ uint32_t timestamp) const {
+ rtc::CritScope lock(&crit_);
+ EXPECT_EQ(timestamp_, timestamp);
+ EXPECT_EQ(ntp_time_ms_, ntp_time_ms);
+ }
+
+ private:
rtc::CriticalSection crit_;
bool block_next_encode_ = false;
rtc::Event continue_encode_event_;
@@ -290,48 +284,20 @@
// Capture a frame and wait for it to synchronize with the encoder thread.
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
sink_.WaitForEncodedFrame(1);
- // The encoder will have been configured twice. First time before the first
- // frame has been received. Then a second time when the resolution is known.
- EXPECT_EQ(2, sink_.number_of_reconfigurations());
+ EXPECT_EQ(1, sink_.number_of_reconfigurations());
VideoEncoderConfig video_encoder_config;
- test::FillEncoderConfiguration(1, &video_encoder_config);
+ video_encoder_config.streams = test::CreateVideoStreams(1);
video_encoder_config.min_transmit_bitrate_bps = 9999;
vie_encoder_->ConfigureEncoder(std::move(video_encoder_config), 1440);
// Capture a frame and wait for it to synchronize with the encoder thread.
video_source_.IncomingCapturedFrame(CreateFrame(2, nullptr));
sink_.WaitForEncodedFrame(2);
- EXPECT_EQ(3, sink_.number_of_reconfigurations());
+ EXPECT_EQ(2, sink_.number_of_reconfigurations());
EXPECT_EQ(9999, sink_.last_min_transmit_bitrate());
vie_encoder_->Stop();
}
-TEST_F(ViEEncoderTest, FrameResolutionChangeReconfigureEncoder) {
- const int kTargetBitrateBps = 100000;
- vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
-
- // Capture a frame and wait for it to synchronize with the encoder thread.
- video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
- sink_.WaitForEncodedFrame(1);
- // The encoder will have been configured twice. First time before the first
- // frame has been received. Then a second time when the resolution is known.
- EXPECT_EQ(2, sink_.number_of_reconfigurations());
- EXPECT_EQ(codec_width_, fake_encoder_.codec_config().width);
- EXPECT_EQ(codec_height_, fake_encoder_.codec_config().height);
-
- codec_width_ *= 2;
- codec_height_ *= 2;
- // Capture a frame with a higher resolution and wait for it to synchronize
- // with the encoder thread.
- video_source_.IncomingCapturedFrame(CreateFrame(2, nullptr));
- sink_.WaitForEncodedFrame(2);
- EXPECT_EQ(codec_width_, fake_encoder_.codec_config().width);
- EXPECT_EQ(codec_height_, fake_encoder_.codec_config().height);
- EXPECT_EQ(3, sink_.number_of_reconfigurations());
-
- vie_encoder_->Stop();
-}
-
} // namespace webrtc
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | webrtc/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698