Index: webrtc/video/video_send_stream_tests.cc |
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc |
index 2b5c6e690976d8a4472ec0c00819ba6f9444543d..267487a1e50336d0474552f26031123c90446455 100644 |
--- a/webrtc/video/video_send_stream_tests.cc |
+++ b/webrtc/video/video_send_stream_tests.cc |
@@ -1478,7 +1478,8 @@ TEST_F(VideoSendStreamTest, |
return; |
} |
} |
- init_encode_called_.Wait(VideoSendStreamTest::kDefaultTimeoutMs); |
+ EXPECT_TRUE( |
+ init_encode_called_.Wait(VideoSendStreamTest::kDefaultTimeoutMs)); |
{ |
rtc::CritScope lock(&crit_); |
EXPECT_EQ(width, last_initialized_frame_width_); |
@@ -1494,9 +1495,7 @@ TEST_F(VideoSendStreamTest, |
last_initialized_frame_width_ = config->width; |
last_initialized_frame_height_ = config->height; |
++number_of_initializations_; |
- // First time InitEncode is called, the frame size is unknown. |
- if (number_of_initializations_ > 1) |
- init_encode_called_.Set(); |
+ init_encode_called_.Set(); |
return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size); |
} |
@@ -1626,11 +1625,12 @@ TEST_F(VideoSendStreamTest, VideoSendStreamStopSetEncoderRateToZero) { |
return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size); |
} |
- int32_t SetRates(uint32_t new_target_bitrate, uint32_t framerate) override { |
+ int32_t SetRateAllocation(const BitrateAllocation& bitrate, |
+ uint32_t framerate) override { |
rtc::CritScope lock(&crit_); |
- bitrate_kbps_ = new_target_bitrate; |
+ bitrate_kbps_ = bitrate.get_sum_kbps(); |
bitrate_changed_.Set(); |
- return FakeEncoder::SetRates(new_target_bitrate, framerate); |
+ return FakeEncoder::SetRateAllocation(bitrate, framerate); |
} |
int GetBitrateKbps() const { |
@@ -1664,13 +1664,17 @@ TEST_F(VideoSendStreamTest, VideoSendStreamStopSetEncoderRateToZero) { |
CreateVideoStreams(); |
EXPECT_TRUE(encoder.WaitForEncoderInit()); |
- EXPECT_GT(encoder.GetBitrateKbps(), 0); |
+ EXPECT_TRUE(encoder.WaitBitrateChanged()); |
+ EXPECT_EQ(0, encoder.GetBitrateKbps()); |
+ |
video_send_stream_->Start(); |
EXPECT_TRUE(encoder.WaitBitrateChanged()); |
EXPECT_GT(encoder.GetBitrateKbps(), 0); |
+ |
video_send_stream_->Stop(); |
EXPECT_TRUE(encoder.WaitBitrateChanged()); |
EXPECT_EQ(0, encoder.GetBitrateKbps()); |
+ |
video_send_stream_->Start(); |
EXPECT_TRUE(encoder.WaitBitrateChanged()); |
EXPECT_GT(encoder.GetBitrateKbps(), 0); |
@@ -2085,10 +2089,12 @@ void VideoCodecConfigObserver<VideoCodecVP8>::VerifyCodecSpecifics( |
} |
// Set expected temporal layers as they should have been set when |
- // reconfiguring the encoder and not match the set config. |
+ // reconfiguring the encoder and not match the set config. Also copy the |
+ // TemporalLayersFactory pointer that has been injected by ViEEncoder. |
VideoCodecVP8 encoder_settings = encoder_settings_; |
encoder_settings.numberOfTemporalLayers = |
kVideoCodecConfigObserverNumberOfTemporalLayers; |
+ encoder_settings.tl_factory = config.VP8().tl_factory; |
EXPECT_EQ( |
0, memcmp(&config.VP8(), &encoder_settings, sizeof(encoder_settings_))); |
} |
@@ -2310,16 +2316,17 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) { |
maxPayloadSize); |
} |
- int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) override { |
+ int32_t SetRateAllocation(const BitrateAllocation& bitrate, |
+ uint32_t frameRate) override { |
{ |
rtc::CritScope lock(&crit_); |
- if (target_bitrate_ == newBitRate) { |
- return FakeEncoder::SetRates(newBitRate, frameRate); |
+ if (target_bitrate_ == bitrate.get_sum_kbps()) { |
+ return FakeEncoder::SetRateAllocation(bitrate, frameRate); |
} |
- target_bitrate_ = newBitRate; |
+ target_bitrate_ = bitrate.get_sum_kbps(); |
} |
bitrate_changed_event_.Set(); |
- return FakeEncoder::SetRates(newBitRate, frameRate); |
+ return FakeEncoder::SetRateAllocation(bitrate, frameRate); |
} |
void WaitForSetRates(uint32_t expected_bitrate) { |