OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 b.rtp_stats.transmitted.header_bytes); | 126 b.rtp_stats.transmitted.header_bytes); |
127 EXPECT_EQ(a.rtp_stats.transmitted.padding_bytes, | 127 EXPECT_EQ(a.rtp_stats.transmitted.padding_bytes, |
128 b.rtp_stats.transmitted.padding_bytes); | 128 b.rtp_stats.transmitted.padding_bytes); |
129 EXPECT_EQ(a.rtp_stats.transmitted.packets, | 129 EXPECT_EQ(a.rtp_stats.transmitted.packets, |
130 b.rtp_stats.transmitted.packets); | 130 b.rtp_stats.transmitted.packets); |
131 EXPECT_EQ(a.rtp_stats.retransmitted.packets, | 131 EXPECT_EQ(a.rtp_stats.retransmitted.packets, |
132 b.rtp_stats.retransmitted.packets); | 132 b.rtp_stats.retransmitted.packets); |
133 EXPECT_EQ(a.rtp_stats.fec.packets, b.rtp_stats.fec.packets); | 133 EXPECT_EQ(a.rtp_stats.fec.packets, b.rtp_stats.fec.packets); |
134 | 134 |
135 EXPECT_EQ(a.rtcp_stats.fraction_lost, b.rtcp_stats.fraction_lost); | 135 EXPECT_EQ(a.rtcp_stats.fraction_lost, b.rtcp_stats.fraction_lost); |
136 EXPECT_EQ(a.rtcp_stats.cumulative_lost, b.rtcp_stats.cumulative_lost); | 136 EXPECT_EQ(a.rtcp_stats.packets_lost, b.rtcp_stats.packets_lost); |
137 EXPECT_EQ(a.rtcp_stats.extended_max_sequence_number, | 137 EXPECT_EQ(a.rtcp_stats.extended_highest_sequence_number, |
138 b.rtcp_stats.extended_max_sequence_number); | 138 b.rtcp_stats.extended_highest_sequence_number); |
139 EXPECT_EQ(a.rtcp_stats.jitter, b.rtcp_stats.jitter); | 139 EXPECT_EQ(a.rtcp_stats.jitter, b.rtcp_stats.jitter); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 SimulatedClock fake_clock_; | 143 SimulatedClock fake_clock_; |
144 std::unique_ptr<SendStatisticsProxy> statistics_proxy_; | 144 std::unique_ptr<SendStatisticsProxy> statistics_proxy_; |
145 VideoSendStream::Config config_; | 145 VideoSendStream::Config config_; |
146 int avg_delay_ms_; | 146 int avg_delay_ms_; |
147 int max_delay_ms_; | 147 int max_delay_ms_; |
148 VideoSendStream::Stats expected_; | 148 VideoSendStream::Stats expected_; |
149 typedef std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator | 149 typedef std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator |
150 StreamIterator; | 150 StreamIterator; |
151 }; | 151 }; |
152 | 152 |
153 TEST_F(SendStatisticsProxyTest, RtcpStatistics) { | 153 TEST_F(SendStatisticsProxyTest, RtcpStatistics) { |
154 RtcpStatisticsCallback* callback = statistics_proxy_.get(); | 154 RtcpStatisticsCallback* callback = statistics_proxy_.get(); |
155 for (const auto& ssrc : config_.rtp.ssrcs) { | 155 for (const auto& ssrc : config_.rtp.ssrcs) { |
156 VideoSendStream::StreamStats& ssrc_stats = expected_.substreams[ssrc]; | 156 VideoSendStream::StreamStats& ssrc_stats = expected_.substreams[ssrc]; |
157 | 157 |
158 // Add statistics with some arbitrary, but unique, numbers. | 158 // Add statistics with some arbitrary, but unique, numbers. |
159 uint32_t offset = ssrc * sizeof(RtcpStatistics); | 159 uint32_t offset = ssrc * sizeof(RtcpStatistics); |
160 ssrc_stats.rtcp_stats.cumulative_lost = offset; | 160 ssrc_stats.rtcp_stats.packets_lost = offset; |
161 ssrc_stats.rtcp_stats.extended_max_sequence_number = offset + 1; | 161 ssrc_stats.rtcp_stats.extended_highest_sequence_number = offset + 1; |
162 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; | 162 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; |
163 ssrc_stats.rtcp_stats.jitter = offset + 3; | 163 ssrc_stats.rtcp_stats.jitter = offset + 3; |
164 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); | 164 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); |
165 } | 165 } |
166 for (const auto& ssrc : config_.rtp.rtx.ssrcs) { | 166 for (const auto& ssrc : config_.rtp.rtx.ssrcs) { |
167 VideoSendStream::StreamStats& ssrc_stats = expected_.substreams[ssrc]; | 167 VideoSendStream::StreamStats& ssrc_stats = expected_.substreams[ssrc]; |
168 | 168 |
169 // Add statistics with some arbitrary, but unique, numbers. | 169 // Add statistics with some arbitrary, but unique, numbers. |
170 uint32_t offset = ssrc * sizeof(RtcpStatistics); | 170 uint32_t offset = ssrc * sizeof(RtcpStatistics); |
171 ssrc_stats.rtcp_stats.cumulative_lost = offset; | 171 ssrc_stats.rtcp_stats.packets_lost = offset; |
172 ssrc_stats.rtcp_stats.extended_max_sequence_number = offset + 1; | 172 ssrc_stats.rtcp_stats.extended_highest_sequence_number = offset + 1; |
173 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; | 173 ssrc_stats.rtcp_stats.fraction_lost = offset + 2; |
174 ssrc_stats.rtcp_stats.jitter = offset + 3; | 174 ssrc_stats.rtcp_stats.jitter = offset + 3; |
175 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); | 175 callback->StatisticsUpdated(ssrc_stats.rtcp_stats, ssrc); |
176 } | 176 } |
177 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); | 177 VideoSendStream::Stats stats = statistics_proxy_->GetStats(); |
178 ExpectEqual(expected_, stats); | 178 ExpectEqual(expected_, stats); |
179 } | 179 } |
180 | 180 |
181 TEST_F(SendStatisticsProxyTest, EncodedBitrateAndFramerate) { | 181 TEST_F(SendStatisticsProxyTest, EncodedBitrateAndFramerate) { |
182 int media_bitrate_bps = 500; | 182 int media_bitrate_bps = 500; |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); | 1793 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); |
1794 proxy->DataCountersUpdated(counters, kFirstSsrc); | 1794 proxy->DataCountersUpdated(counters, kFirstSsrc); |
1795 } | 1795 } |
1796 | 1796 |
1797 // FEC not enabled. | 1797 // FEC not enabled. |
1798 statistics_proxy_.reset(); | 1798 statistics_proxy_.reset(); |
1799 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); | 1799 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); |
1800 } | 1800 } |
1801 | 1801 |
1802 } // namespace webrtc | 1802 } // namespace webrtc |
OLD | NEW |