Index: webrtc/video/vie_encoder_unittest.cc |
diff --git a/webrtc/video/vie_encoder_unittest.cc b/webrtc/video/vie_encoder_unittest.cc |
index 9f4fdc47e33094d3577dbe4f05eb226bfb37a173..f6046be652c0f5e3fdc0df8f7df82057560224e6 100644 |
--- a/webrtc/video/vie_encoder_unittest.cc |
+++ b/webrtc/video/vie_encoder_unittest.cc |
@@ -93,6 +93,7 @@ class ViEEncoderTest : public ::testing::Test { |
VideoEncoderConfig video_encoder_config; |
test::FillEncoderConfiguration(1, &video_encoder_config); |
+ video_encoder_config_ = video_encoder_config.Copy(); |
vie_encoder_.reset(new ViEEncoderUnderTest( |
stats_proxy_.get(), video_send_config_.encoder_settings)); |
vie_encoder_->SetSink(&sink_, false /* rotation_applied */); |
@@ -236,6 +237,7 @@ class ViEEncoderTest : public ::testing::Test { |
}; |
VideoSendStream::Config video_send_config_; |
+ VideoEncoderConfig video_encoder_config_; |
int codec_width_; |
int codec_height_; |
TestEncoder fake_encoder_; |
@@ -595,6 +597,20 @@ TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { |
vie_encoder_->Stop(); |
} |
+TEST_F(ViEEncoderTest, StatsTracksPreferredBitrate) { |
+ const int kTargetBitrateBps = 100000; |
+ vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |
+ |
+ video_source_.IncomingCapturedFrame(CreateFrame(1, 1280, 720)); |
+ sink_.WaitForEncodedFrame(1); |
+ |
+ VideoSendStream::Stats stats = stats_proxy_->GetStats(); |
+ EXPECT_EQ(video_encoder_config_.max_bitrate_bps, |
+ stats.preferred_media_bitrate_bps); |
+ |
+ vie_encoder_->Stop(); |
+} |
+ |
TEST_F(ViEEncoderTest, UMACpuLimitedResolutionInPercent) { |
const int kTargetBitrateBps = 100000; |
vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |