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

Side by Side Diff: webrtc/video/vie_encoder_unittest.cc

Issue 2804653002: Update stats for cpu/quality adaptation changes to excluded time when video is suspended. (Closed)
Patch Set: address comments Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 sink_.WaitForEncodedFrame(frame_timestamp); 781 sink_.WaitForEncodedFrame(frame_timestamp);
782 frame_timestamp += kFrameIntervalMs; 782 frame_timestamp += kFrameIntervalMs;
783 783
784 // Trigger CPU overuse. 784 // Trigger CPU overuse.
785 vie_encoder_->TriggerCpuOveruse(); 785 vie_encoder_->TriggerCpuOveruse();
786 video_source_.IncomingCapturedFrame( 786 video_source_.IncomingCapturedFrame(
787 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight)); 787 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight));
788 sink_.WaitForEncodedFrame(frame_timestamp); 788 sink_.WaitForEncodedFrame(frame_timestamp);
789 frame_timestamp += kFrameIntervalMs; 789 frame_timestamp += kFrameIntervalMs;
790 790
791 // Default degradation preference in maintain-framerate, so will lower max 791 // Default degradation preference is maintain-framerate, so will lower max
792 // wanted resolution. 792 // wanted resolution.
793 EXPECT_FALSE(video_source_.sink_wants().target_pixel_count); 793 EXPECT_FALSE(video_source_.sink_wants().target_pixel_count);
794 EXPECT_LT(video_source_.sink_wants().max_pixel_count, 794 EXPECT_LT(video_source_.sink_wants().max_pixel_count,
795 kFrameWidth * kFrameHeight); 795 kFrameWidth * kFrameHeight);
796 EXPECT_EQ(std::numeric_limits<int>::max(), 796 EXPECT_EQ(std::numeric_limits<int>::max(),
797 video_source_.sink_wants().max_framerate_fps); 797 video_source_.sink_wants().max_framerate_fps);
798 798
799 // Set new source, switch to maintain-resolution. 799 // Set new source, switch to maintain-resolution.
800 test::FrameForwarder new_video_source; 800 test::FrameForwarder new_video_source;
801 vie_encoder_->SetSource( 801 vie_encoder_->SetSource(
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); 1105 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
1106 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); 1106 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
1107 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); 1107 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1108 1108
1109 vie_encoder_->Stop(); 1109 vie_encoder_->Stop();
1110 } 1110 }
1111 1111
1112 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { 1112 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) {
1113 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1113 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1114 1114
1115 int kWidth = 1280; 1115 const int kWidth = 1280;
1116 int kHeight = 720; 1116 const int kHeight = 720;
1117 int sequence = 1; 1117 int sequence = 1;
1118 1118
1119 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight)); 1119 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight));
1120 sink_.WaitForEncodedFrame(sequence++); 1120 sink_.WaitForEncodedFrame(sequence++);
1121 1121
1122 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 1122 VideoSendStream::Stats stats = stats_proxy_->GetStats();
1123 EXPECT_FALSE(stats.cpu_limited_resolution); 1123 EXPECT_FALSE(stats.cpu_limited_resolution);
1124 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes); 1124 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes);
1125 1125
1126 // Trigger CPU overuse again, should now adapt down. 1126 // Trigger CPU overuse again, should now adapt down.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 vie_encoder_->OnBitrateUpdated(kTooLowBitrateForFrameSizeBps, 0, 0); 1397 vie_encoder_->OnBitrateUpdated(kTooLowBitrateForFrameSizeBps, 0, 0);
1398 const int kWidth = 640; 1398 const int kWidth = 640;
1399 const int kHeight = 360; 1399 const int kHeight = 360;
1400 1400
1401 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 1401 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1402 1402
1403 // Expect to drop this frame, the wait should time out. 1403 // Expect to drop this frame, the wait should time out.
1404 sink_.ExpectDroppedFrame(); 1404 sink_.ExpectDroppedFrame();
1405 1405
1406 // Expect the sink_wants to specify a scaled frame. 1406 // Expect the sink_wants to specify a scaled frame.
1407 EXPECT_LT(video_source_.sink_wants().max_pixel_count, 1000 * 1000); 1407 EXPECT_LT(video_source_.sink_wants().max_pixel_count, kWidth * kHeight);
1408 1408
1409 int last_pixel_count = video_source_.sink_wants().max_pixel_count; 1409 int last_pixel_count = video_source_.sink_wants().max_pixel_count;
1410 1410
1411 // Next frame is scaled. 1411 // Next frame is scaled.
1412 video_source_.IncomingCapturedFrame( 1412 video_source_.IncomingCapturedFrame(
1413 CreateFrame(2, kWidth * 3 / 4, kHeight * 3 / 4)); 1413 CreateFrame(2, kWidth * 3 / 4, kHeight * 3 / 4));
1414 1414
1415 // Expect to drop this frame, the wait should time out. 1415 // Expect to drop this frame, the wait should time out.
1416 sink_.ExpectDroppedFrame(); 1416 sink_.ExpectDroppedFrame();
1417 1417
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 for (int i = 0; i < 10; ++i) { 1664 for (int i = 0; i < 10; ++i) {
1665 timestamp_ms += kMinFpsFrameInterval; 1665 timestamp_ms += kMinFpsFrameInterval;
1666 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000); 1666 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000);
1667 video_source_.IncomingCapturedFrame( 1667 video_source_.IncomingCapturedFrame(
1668 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight)); 1668 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
1669 sink_.WaitForEncodedFrame(timestamp_ms); 1669 sink_.WaitForEncodedFrame(timestamp_ms);
1670 } 1670 }
1671 vie_encoder_->Stop(); 1671 vie_encoder_->Stop();
1672 } 1672 }
1673 } // namespace webrtc 1673 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698