OLD | NEW |
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 Loading... |
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(rtc::Optional<uint8_t>(), | 57 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>()); |
58 VideoContentType::UNSPECIFIED); | |
59 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); | 58 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); |
60 } | 59 } |
61 } | 60 } |
62 | 61 |
63 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) { | 62 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) { |
64 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); | 63 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded); |
65 for (uint32_t i = 1; i <= 3; ++i) { | 64 for (uint32_t i = 1; i <= 3; ++i) { |
66 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), | 65 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>()); |
67 VideoContentType::UNSPECIFIED); | |
68 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); | 66 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded); |
69 } | 67 } |
70 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(1u), | 68 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(1u)); |
71 VideoContentType::UNSPECIFIED); | |
72 EXPECT_EQ(1u, statistics_proxy_->GetStats().frames_decoded); | 69 EXPECT_EQ(1u, statistics_proxy_->GetStats().frames_decoded); |
73 } | 70 } |
74 | 71 |
75 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) { | 72 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) { |
76 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 73 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
77 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), | 74 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u)); |
78 VideoContentType::UNSPECIFIED); | |
79 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); | 75 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); |
80 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), | 76 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u)); |
81 VideoContentType::UNSPECIFIED); | |
82 EXPECT_EQ(rtc::Optional<uint64_t>(130u), | 77 EXPECT_EQ(rtc::Optional<uint64_t>(130u), |
83 statistics_proxy_->GetStats().qp_sum); | 78 statistics_proxy_->GetStats().qp_sum); |
84 } | 79 } |
85 | 80 |
86 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) { | 81 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) { |
87 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 82 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
88 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), | 83 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>()); |
89 VideoContentType::UNSPECIFIED); | |
90 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 84 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
91 } | 85 } |
92 | 86 |
93 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) { | 87 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) { |
94 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 88 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
95 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), | 89 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u)); |
96 VideoContentType::UNSPECIFIED); | |
97 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); | 90 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); |
98 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), | 91 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>()); |
99 VideoContentType::UNSPECIFIED); | |
100 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 92 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
101 } | 93 } |
102 | 94 |
103 TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) { | 95 TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) { |
104 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_rendered); | 96 EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_rendered); |
105 webrtc::VideoFrame frame(webrtc::I420Buffer::Create(1, 1), 0, 0, | 97 webrtc::VideoFrame frame( |
106 webrtc::kVideoRotation_0); | 98 webrtc::I420Buffer::Create(1, 1), 0, 0, webrtc::kVideoRotation_0); |
107 for (uint32_t i = 1; i <= 3; ++i) { | 99 for (uint32_t i = 1; i <= 3; ++i) { |
108 statistics_proxy_->OnRenderedFrame(frame); | 100 statistics_proxy_->OnRenderedFrame(frame); |
109 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_rendered); | 101 EXPECT_EQ(i, statistics_proxy_->GetStats().frames_rendered); |
110 } | 102 } |
111 } | 103 } |
112 | 104 |
113 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsSsrc) { | 105 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsSsrc) { |
114 EXPECT_EQ(kRemoteSsrc, statistics_proxy_->GetStats().ssrc); | 106 EXPECT_EQ(kRemoteSsrc, statistics_proxy_->GetStats().ssrc); |
115 } | 107 } |
116 | 108 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 codec_info.codecType = kVideoCodecVP8; | 388 codec_info.codecType = kVideoCodecVP8; |
397 | 389 |
398 for (int i = 0; i < kMinRequiredSamples; ++i) | 390 for (int i = 0; i < kMinRequiredSamples; ++i) |
399 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); | 391 statistics_proxy_->OnPreDecode(encoded_image, &codec_info); |
400 | 392 |
401 statistics_proxy_.reset(); | 393 statistics_proxy_.reset(); |
402 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); | 394 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); |
403 } | 395 } |
404 | 396 |
405 } // namespace webrtc | 397 } // namespace webrtc |
OLD | NEW |