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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 new_video_source.IncomingCapturedFrame( | 923 new_video_source.IncomingCapturedFrame( |
924 CreateFrame(5, frame_width, frame_height)); | 924 CreateFrame(5, frame_width, frame_height)); |
925 sink_.WaitForEncodedFrame(5); | 925 sink_.WaitForEncodedFrame(5); |
926 stats = stats_proxy_->GetStats(); | 926 stats = stats_proxy_->GetStats(); |
927 EXPECT_FALSE(stats.cpu_limited_resolution); | 927 EXPECT_FALSE(stats.cpu_limited_resolution); |
928 EXPECT_FALSE(stats.bw_limited_resolution); | 928 EXPECT_FALSE(stats.bw_limited_resolution); |
929 | 929 |
930 vie_encoder_->Stop(); | 930 vie_encoder_->Stop(); |
931 } | 931 } |
932 | 932 |
| 933 TEST_F(ViEEncoderTest, QualityAdaptationStatsAreResetWhenScalerIsDisabled) { |
| 934 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |
| 935 |
| 936 const int kWidth = 1280; |
| 937 const int kHeight = 720; |
| 938 video_source_.set_adaptation_enabled(true); |
| 939 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); |
| 940 sink_.WaitForEncodedFrame(1); |
| 941 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution); |
| 942 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); |
| 943 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes); |
| 944 |
| 945 // Trigger adapt down. |
| 946 vie_encoder_->TriggerQualityLow(); |
| 947 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight)); |
| 948 sink_.WaitForEncodedFrame(2); |
| 949 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution); |
| 950 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution); |
| 951 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes); |
| 952 |
| 953 // Trigger overuse. |
| 954 vie_encoder_->TriggerCpuOveruse(); |
| 955 video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight)); |
| 956 sink_.WaitForEncodedFrame(3); |
| 957 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); |
| 958 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution); |
| 959 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); |
| 960 |
| 961 // Set source with adaptation still enabled but quality scaler is off. |
| 962 fake_encoder_.SetQualityScaling(false); |
| 963 vie_encoder_->SetSource(&video_source_, |
| 964 VideoSendStream::DegradationPreference::kBalanced); |
| 965 |
| 966 video_source_.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight)); |
| 967 sink_.WaitForEncodedFrame(4); |
| 968 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); |
| 969 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); |
| 970 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); |
| 971 |
| 972 vie_encoder_->Stop(); |
| 973 } |
| 974 |
933 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { | 975 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { |
934 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); | 976 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |
935 | 977 |
936 int frame_width = 1280; | 978 int frame_width = 1280; |
937 int frame_height = 720; | 979 int frame_height = 720; |
938 int sequence = 1; | 980 int sequence = 1; |
939 | 981 |
940 video_source_.IncomingCapturedFrame( | 982 video_source_.IncomingCapturedFrame( |
941 CreateFrame(sequence, frame_width, frame_height)); | 983 CreateFrame(sequence, frame_width, frame_height)); |
942 sink_.WaitForEncodedFrame(sequence++); | 984 sink_.WaitForEncodedFrame(sequence++); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); | 1323 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); |
1282 ResetEncoder("VP8", 2, 1, true); | 1324 ResetEncoder("VP8", 2, 1, true); |
1283 const int kFrameWidth = 1280; | 1325 const int kFrameWidth = 1280; |
1284 const int kFrameHeight = 720; | 1326 const int kFrameHeight = 720; |
1285 video_source_.IncomingCapturedFrame( | 1327 video_source_.IncomingCapturedFrame( |
1286 CreateFrame(1, kFrameWidth, kFrameHeight)); | 1328 CreateFrame(1, kFrameWidth, kFrameHeight)); |
1287 sink_.ExpectDroppedFrame(); | 1329 sink_.ExpectDroppedFrame(); |
1288 vie_encoder_->Stop(); | 1330 vie_encoder_->Stop(); |
1289 } | 1331 } |
1290 } // namespace webrtc | 1332 } // namespace webrtc |
OLD | NEW |