Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 new_video_source.IncomingCapturedFrame( | 1035 new_video_source.IncomingCapturedFrame( |
| 1036 CreateFrame(5, frame_width, frame_height)); | 1036 CreateFrame(5, frame_width, frame_height)); |
| 1037 sink_.WaitForEncodedFrame(5); | 1037 sink_.WaitForEncodedFrame(5); |
| 1038 stats = stats_proxy_->GetStats(); | 1038 stats = stats_proxy_->GetStats(); |
| 1039 EXPECT_FALSE(stats.cpu_limited_resolution); | 1039 EXPECT_FALSE(stats.cpu_limited_resolution); |
| 1040 EXPECT_FALSE(stats.bw_limited_resolution); | 1040 EXPECT_FALSE(stats.bw_limited_resolution); |
| 1041 | 1041 |
| 1042 vie_encoder_->Stop(); | 1042 vie_encoder_->Stop(); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 TEST_F(ViEEncoderTest, QualityAdaptationStatsAreResetWhenScalerIsDisabled) { | |
| 1046 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); | |
| 1047 | |
| 1048 const int kWidth = 1280; | |
| 1049 const int kHeight = 720; | |
| 1050 video_source_.set_adaptation_enabled(true); | |
| 1051 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); | |
| 1052 sink_.WaitForEncodedFrame(1); | |
| 1053 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution); | |
| 1054 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); | |
| 1055 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes); | |
| 1056 | |
| 1057 // Trigger adapt down. | |
| 1058 vie_encoder_->TriggerQualityLow(); | |
| 1059 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight)); | |
| 1060 sink_.WaitForEncodedFrame(2); | |
| 1061 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution); | |
| 1062 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution); | |
| 1063 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes); | |
| 1064 | |
| 1065 // Trigger overuse. | |
| 1066 vie_encoder_->TriggerCpuOveruse(); | |
| 1067 video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight)); | |
| 1068 sink_.WaitForEncodedFrame(3); | |
| 1069 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); | |
| 1070 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution); | |
| 1071 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); | |
| 1072 | |
| 1073 // Set new source with adaptation still enabled but quality scaler is off. | |
| 1074 fake_encoder_.SetQualityScaling(false); | |
| 1075 test::FrameForwarder new_video_source; | |
|
kthelgason
2017/03/31 07:57:38
I guess the new source is technically not required
åsapersson
2017/03/31 09:53:38
Done.
| |
| 1076 vie_encoder_->SetSource( | |
| 1077 &new_video_source, | |
| 1078 VideoSendStream::DegradationPreference::kMaintainFramerate); | |
| 1079 | |
| 1080 new_video_source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight)); | |
| 1081 sink_.WaitForEncodedFrame(4); | |
| 1082 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); | |
| 1083 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); | |
| 1084 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); | |
| 1085 | |
| 1086 vie_encoder_->Stop(); | |
| 1087 } | |
| 1088 | |
| 1045 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { | 1089 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { |
| 1046 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); | 1090 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |
| 1047 | 1091 |
| 1048 int frame_width = 1280; | 1092 int frame_width = 1280; |
| 1049 int frame_height = 720; | 1093 int frame_height = 720; |
| 1050 int sequence = 1; | 1094 int sequence = 1; |
| 1051 | 1095 |
| 1052 video_source_.IncomingCapturedFrame( | 1096 video_source_.IncomingCapturedFrame( |
| 1053 CreateFrame(sequence, frame_width, frame_height)); | 1097 CreateFrame(sequence, frame_width, frame_height)); |
| 1054 sink_.WaitForEncodedFrame(sequence++); | 1098 sink_.WaitForEncodedFrame(sequence++); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1610 for (int i = 0; i < 10; ++i) { | 1654 for (int i = 0; i < 10; ++i) { |
| 1611 timestamp_ms += kMinFpsFrameInterval; | 1655 timestamp_ms += kMinFpsFrameInterval; |
| 1612 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000); | 1656 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000); |
| 1613 video_source_.IncomingCapturedFrame( | 1657 video_source_.IncomingCapturedFrame( |
| 1614 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight)); | 1658 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight)); |
| 1615 sink_.WaitForEncodedFrame(timestamp_ms); | 1659 sink_.WaitForEncodedFrame(timestamp_ms); |
| 1616 } | 1660 } |
| 1617 vie_encoder_->Stop(); | 1661 vie_encoder_->Stop(); |
| 1618 } | 1662 } |
| 1619 } // namespace webrtc | 1663 } // namespace webrtc |
| OLD | NEW |