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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 91 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
92 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), | 92 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), |
93 VideoContentType::UNSPECIFIED); | 93 VideoContentType::UNSPECIFIED); |
94 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); | 94 EXPECT_EQ(rtc::Optional<uint64_t>(3u), statistics_proxy_->GetStats().qp_sum); |
95 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), | 95 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
96 VideoContentType::UNSPECIFIED); | 96 VideoContentType::UNSPECIFIED); |
97 EXPECT_EQ(rtc::Optional<uint64_t>(130u), | 97 EXPECT_EQ(rtc::Optional<uint64_t>(130u), |
98 statistics_proxy_->GetStats().qp_sum); | 98 statistics_proxy_->GetStats().qp_sum); |
99 } | 99 } |
100 | 100 |
101 TEST_F(ReceiveStatisticsProxyTest, | 101 |
102 OnDecodedFrameIncreasesInterframeDelayMsSum) { | 102 TEST_F(ReceiveStatisticsProxyTest, ReportsMaxInterframeDelay) { |
103 const uint64_t kInterframeDelayMs1 = 100; | 103 const uint64_t kInterframeDelayMs1 = 100; |
104 const uint64_t kInterframeDelayMs2 = 200; | 104 const uint64_t kInterframeDelayMs2 = 200; |
105 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_sum_ms); | 105 const uint64_t kInterframeDelayMs3 = 100; |
| 106 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_max_ms); |
106 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), | 107 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), |
107 VideoContentType::UNSPECIFIED); | 108 VideoContentType::UNSPECIFIED); |
108 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_sum_ms); | 109 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_max_ms); |
109 | 110 |
110 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs1); | 111 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs1); |
111 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), | 112 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
112 VideoContentType::UNSPECIFIED); | 113 VideoContentType::UNSPECIFIED); |
113 EXPECT_EQ(kInterframeDelayMs1, | 114 EXPECT_EQ(kInterframeDelayMs1, |
114 statistics_proxy_->GetStats().interframe_delay_sum_ms); | 115 statistics_proxy_->GetStats().interframe_delay_max_ms); |
115 | 116 |
116 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs2); | 117 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs2); |
117 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), | 118 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
118 VideoContentType::UNSPECIFIED); | 119 VideoContentType::UNSPECIFIED); |
119 EXPECT_EQ(kInterframeDelayMs1 + kInterframeDelayMs2, | 120 EXPECT_EQ(kInterframeDelayMs2, |
120 statistics_proxy_->GetStats().interframe_delay_sum_ms); | 121 statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 122 |
| 123 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs3); |
| 124 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
| 125 VideoContentType::UNSPECIFIED); |
| 126 // kInterframeDelayMs3 is smaller than kInterframeDelayMs2. |
| 127 EXPECT_EQ(kInterframeDelayMs2, |
| 128 statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 129 } |
| 130 |
| 131 TEST_F(ReceiveStatisticsProxyTest, ReportInterframeDelayInWindow) { |
| 132 const uint64_t kInterframeDelayMs1 = 4000; |
| 133 const uint64_t kInterframeDelayMs2 = 3500; |
| 134 const uint64_t kInterframeDelayMs3 = 3000; |
| 135 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 136 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(3u), |
| 137 VideoContentType::UNSPECIFIED); |
| 138 EXPECT_EQ(0u, statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 139 |
| 140 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs1); |
| 141 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
| 142 VideoContentType::UNSPECIFIED); |
| 143 EXPECT_EQ(kInterframeDelayMs1, |
| 144 statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 145 |
| 146 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs2); |
| 147 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
| 148 VideoContentType::UNSPECIFIED); |
| 149 // Still first delay is the maximum |
| 150 EXPECT_EQ(kInterframeDelayMs1, |
| 151 statistics_proxy_->GetStats().interframe_delay_max_ms); |
| 152 |
| 153 fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs3); |
| 154 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(127u), |
| 155 VideoContentType::UNSPECIFIED); |
| 156 // Now the first sample is out of the window, so the second is the maximum. |
| 157 EXPECT_EQ(kInterframeDelayMs2, |
| 158 statistics_proxy_->GetStats().interframe_delay_max_ms); |
121 } | 159 } |
122 | 160 |
123 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) { | 161 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) { |
124 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 162 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
125 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), | 163 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), |
126 VideoContentType::UNSPECIFIED); | 164 VideoContentType::UNSPECIFIED); |
127 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); | 165 EXPECT_EQ(rtc::Optional<uint64_t>(), statistics_proxy_->GetStats().qp_sum); |
128 } | 166 } |
129 | 167 |
130 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) { | 168 TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) { |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 statistics_proxy_.reset(); | 811 statistics_proxy_.reset(); |
774 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); | 812 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); |
775 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); | 813 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); |
776 EXPECT_EQ( | 814 EXPECT_EQ( |
777 0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 815 0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
778 EXPECT_EQ(0, metrics::NumSamples( | 816 EXPECT_EQ(0, metrics::NumSamples( |
779 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | 817 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
780 } | 818 } |
781 | 819 |
782 } // namespace webrtc | 820 } // namespace webrtc |
OLD | NEW |