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

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

Issue 2649133005: Add QP sum stats for received streams. (Closed)
Patch Set: Changes according to hbos's comments. #1 Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 SimulatedClock fake_clock_; 49 SimulatedClock fake_clock_;
50 const VideoReceiveStream::Config config_; 50 const VideoReceiveStream::Config config_;
51 std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_; 51 std::unique_ptr<ReceiveStatisticsProxy> statistics_proxy_;
52 }; 52 };
53 53
54 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) { 54 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
55 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); 55 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
56 for (uint32_t i = 1; i <= 3; ++i) { 56 for (uint32_t i = 1; i <= 3; ++i) {
57 statistics_proxy_->OnDecodedFrame(); 57 statistics_proxy_->OnDecodedFrame(-1);
58 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); 58 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
59 } 59 }
60 } 60 }
61 61
62 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) {
63 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum);
64 statistics_proxy_->OnDecodedFrame(3);
65 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum);
66 statistics_proxy_->OnDecodedFrame(127);
67 EXPECT_EQ(rtc::Optional<uint64_t>(130u),
68 statistics_proxy_->GetStats().qp_sum);
69 }
70
71 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) {
72 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum);
73 statistics_proxy_->OnDecodedFrame(-1);
74 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum);
75 }
76
62 TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) { 77 TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) {
63 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_rendered); 78 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_rendered);
64 webrtc::VideoFrame frame( 79 webrtc::VideoFrame frame(
65 webrtc::I420Buffer::Create(1, 1), 0, 0, webrtc::kVideoRotation_0); 80 webrtc::I420Buffer::Create(1, 1), 0, 0, webrtc::kVideoRotation_0);
66 for (uint32_t i = 1; i <= 3; ++i) { 81 for (uint32_t i = 1; i <= 3; ++i) {
67 statistics_proxy_->OnRenderedFrame(frame); 82 statistics_proxy_->OnRenderedFrame(frame);
68 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_rendered); 83 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_rendered);
69 } 84 }
70 } 85 }
71 86
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 codec_info.codecType = kVideoCodecVP8; 368 codec_info.codecType = kVideoCodecVP8;
354 369
355 for (int i = 0; i < kMinRequiredSamples; ++i) 370 for (int i = 0; i < kMinRequiredSamples; ++i)
356 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); 371 statistics_proxy_->OnPreDecode(encoded_image, &codec_info);
357 372
358 statistics_proxy_.reset(); 373 statistics_proxy_.reset();
359 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); 374 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp"));
360 } 375 }
361 376
362 } // namespace webrtc 377 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698