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 95 matching lines...) Loading... |
106 const int64_t kTimeSec = 3; | 106 const int64_t kTimeSec = 3; |
107 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); | 107 fake_clock_.AdvanceTimeMilliseconds(kTimeSec * 1000); |
108 // Histograms are updated when the statistics_proxy_ is deleted. | 108 // Histograms are updated when the statistics_proxy_ is deleted. |
109 statistics_proxy_.reset(); | 109 statistics_proxy_.reset(); |
110 EXPECT_EQ(1, | 110 EXPECT_EQ(1, |
111 metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds")); | 111 metrics::NumSamples("WebRTC.Video.ReceiveStreamLifetimeInSeconds")); |
112 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds", | 112 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.ReceiveStreamLifetimeInSeconds", |
113 kTimeSec)); | 113 kTimeSec)); |
114 } | 114 } |
115 | 115 |
| 116 TEST_F(ReceiveStatisticsProxyTest, BadCallHistogramsAreUpdated) { |
| 117 // Based on the tuning parameters this will produce 7 uncertain states, |
| 118 // then 10 certainly bad states. There has to be 10 certain states before |
| 119 // any histograms are recorded. |
| 120 const int kNumBadSamples = 17; |
| 121 |
| 122 StreamDataCounters counters; |
| 123 counters.first_packet_time_ms = fake_clock_.TimeInMilliseconds(); |
| 124 statistics_proxy_->DataCountersUpdated(counters, config_.rtp.remote_ssrc); |
| 125 |
| 126 for (int i = 0; i < kNumBadSamples; ++i) { |
| 127 // Since OnRenderedFrame is never called the fps in each sample will be 0, |
| 128 // i.e. bad |
| 129 fake_clock_.AdvanceTimeMilliseconds(1000); |
| 130 statistics_proxy_->OnIncomingRate(0, 0); |
| 131 } |
| 132 // Histograms are updated when the statistics_proxy_ is deleted. |
| 133 statistics_proxy_.reset(); |
| 134 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.Any")); |
| 135 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.BadCall.Any", 100)); |
| 136 |
| 137 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BadCall.FrameRate")); |
| 138 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.BadCall.FrameRate", 100)); |
| 139 |
| 140 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.BadCall.FrameRateVariance")); |
| 141 |
| 142 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.BadCall.Qp")); |
| 143 } |
| 144 |
116 TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) { | 145 TEST_F(ReceiveStatisticsProxyTest, PacketLossHistogramIsUpdated) { |
117 const uint32_t kCumLost1 = 1; | 146 const uint32_t kCumLost1 = 1; |
118 const uint32_t kExtSeqNum1 = 10; | 147 const uint32_t kExtSeqNum1 = 10; |
119 const uint32_t kCumLost2 = 2; | 148 const uint32_t kCumLost2 = 2; |
120 const uint32_t kExtSeqNum2 = 20; | 149 const uint32_t kExtSeqNum2 = 20; |
121 | 150 |
122 // One report block received. | 151 // One report block received. |
123 RtcpStatistics rtcp_stats1; | 152 RtcpStatistics rtcp_stats1; |
124 rtcp_stats1.cumulative_lost = kCumLost1; | 153 rtcp_stats1.cumulative_lost = kCumLost1; |
125 rtcp_stats1.extended_max_sequence_number = kExtSeqNum1; | 154 rtcp_stats1.extended_max_sequence_number = kExtSeqNum1; |
(...skipping 70 matching lines...) Loading... |
196 fake_clock_.AdvanceTimeMilliseconds(kFreqOffsetProcessIntervalInMs); | 225 fake_clock_.AdvanceTimeMilliseconds(kFreqOffsetProcessIntervalInMs); |
197 // Process interval passed, max diff: 4. | 226 // Process interval passed, max diff: 4. |
198 statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz); | 227 statistics_proxy_->OnSyncOffsetUpdated(kSyncOffsetMs, kFreqKhz); |
199 statistics_proxy_.reset(); | 228 statistics_proxy_.reset(); |
200 // Average reported: (2 + 4) / 2 = 3. | 229 // Average reported: (2 + 4) / 2 = 3. |
201 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RtpToNtpFreqOffsetInKhz")); | 230 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.RtpToNtpFreqOffsetInKhz")); |
202 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.RtpToNtpFreqOffsetInKhz", 3)); | 231 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.RtpToNtpFreqOffsetInKhz", 3)); |
203 } | 232 } |
204 | 233 |
205 } // namespace webrtc | 234 } // namespace webrtc |
OLD | NEW |