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