OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 void ViEChannel::UpdateHistograms() { | 195 void ViEChannel::UpdateHistograms() { |
196 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); | 196 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); |
197 | 197 |
198 { | 198 { |
199 CriticalSectionScoped cs(crit_.get()); | 199 CriticalSectionScoped cs(crit_.get()); |
200 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000; | 200 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000; |
201 if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 && | 201 if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 && |
202 elapsed_sec > metrics::kMinRunTimeInSeconds) { | 202 elapsed_sec > metrics::kMinRunTimeInSeconds) { |
203 int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_; | 203 int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_; |
204 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 204 RTC_HISTOGRAM_COUNTS_10000( |
205 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); | 205 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 if (sender_) { | 209 if (sender_) { |
210 RtcpPacketTypeCounter rtcp_counter; | 210 RtcpPacketTypeCounter rtcp_counter; |
211 GetSendRtcpPacketTypeCounter(&rtcp_counter); | 211 GetSendRtcpPacketTypeCounter(&rtcp_counter); |
212 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; | 212 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; |
213 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 213 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
214 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 214 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute", |
215 "WebRTC.Video.NackPacketsReceivedPerMinute", | 215 rtcp_counter.nack_packets * 60 / elapsed_sec); |
216 rtcp_counter.nack_packets * 60 / elapsed_sec); | 216 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", |
217 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 217 rtcp_counter.fir_packets * 60 / elapsed_sec); |
218 "WebRTC.Video.FirPacketsReceivedPerMinute", | 218 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", |
219 rtcp_counter.fir_packets * 60 / elapsed_sec); | 219 rtcp_counter.pli_packets * 60 / elapsed_sec); |
220 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | |
221 "WebRTC.Video.PliPacketsReceivedPerMinute", | |
222 rtcp_counter.pli_packets * 60 / elapsed_sec); | |
223 if (rtcp_counter.nack_requests > 0) { | 220 if (rtcp_counter.nack_requests > 0) { |
224 RTC_HISTOGRAM_PERCENTAGE_SPARSE( | 221 RTC_HISTOGRAM_PERCENTAGE( |
225 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", | 222 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", |
226 rtcp_counter.UniqueNackRequestsInPercent()); | 223 rtcp_counter.UniqueNackRequestsInPercent()); |
227 } | 224 } |
228 int fraction_lost = report_block_stats_sender_->FractionLostInPercent(); | 225 int fraction_lost = report_block_stats_sender_->FractionLostInPercent(); |
229 if (fraction_lost != -1) { | 226 if (fraction_lost != -1) { |
230 RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.SentPacketsLostInPercent", | 227 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent", |
231 fraction_lost); | 228 fraction_lost); |
232 } | 229 } |
233 } | 230 } |
234 | 231 |
235 StreamDataCounters rtp; | 232 StreamDataCounters rtp; |
236 StreamDataCounters rtx; | 233 StreamDataCounters rtx; |
237 GetSendStreamDataCounters(&rtp, &rtx); | 234 GetSendStreamDataCounters(&rtp, &rtx); |
238 StreamDataCounters rtp_rtx = rtp; | 235 StreamDataCounters rtp_rtx = rtp; |
239 rtp_rtx.Add(rtx); | 236 rtp_rtx.Add(rtx); |
240 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( | 237 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( |
241 Clock::GetRealTimeClock()->TimeInMilliseconds()) / | 238 Clock::GetRealTimeClock()->TimeInMilliseconds()) / |
242 1000; | 239 1000; |
243 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 240 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
244 RTC_HISTOGRAM_COUNTS_SPARSE_100000( | 241 RTC_HISTOGRAM_COUNTS_100000( |
245 "WebRTC.Video.BitrateSentInKbps", | 242 "WebRTC.Video.BitrateSentInKbps", |
246 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 243 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
247 1000)); | 244 1000)); |
248 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 245 RTC_HISTOGRAM_COUNTS_10000( |
249 "WebRTC.Video.MediaBitrateSentInKbps", | 246 "WebRTC.Video.MediaBitrateSentInKbps", |
250 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 247 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
251 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 248 RTC_HISTOGRAM_COUNTS_10000( |
252 "WebRTC.Video.PaddingBitrateSentInKbps", | 249 "WebRTC.Video.PaddingBitrateSentInKbps", |
253 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / | 250 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / |
254 1000)); | 251 1000)); |
255 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 252 RTC_HISTOGRAM_COUNTS_10000( |
256 "WebRTC.Video.RetransmittedBitrateSentInKbps", | 253 "WebRTC.Video.RetransmittedBitrateSentInKbps", |
257 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / | 254 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / |
258 elapsed_sec / 1000)); | 255 elapsed_sec / 1000)); |
259 if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) { | 256 if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) { |
260 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 257 RTC_HISTOGRAM_COUNTS_10000( |
261 "WebRTC.Video.RtxBitrateSentInKbps", | 258 "WebRTC.Video.RtxBitrateSentInKbps", |
262 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 259 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
263 1000)); | 260 1000)); |
264 } | 261 } |
265 bool fec_enabled = false; | 262 bool fec_enabled = false; |
266 uint8_t pltype_red; | 263 uint8_t pltype_red; |
267 uint8_t pltype_fec; | 264 uint8_t pltype_fec; |
268 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, | 265 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, |
269 &pltype_fec); | 266 &pltype_fec); |
270 if (fec_enabled) { | 267 if (fec_enabled) { |
271 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 268 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", |
272 "WebRTC.Video.FecBitrateSentInKbps", | 269 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
273 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / | 270 8 / elapsed_sec / 1000)); |
274 1000)); | |
275 } | 271 } |
276 } | 272 } |
277 } else if (vie_receiver_.GetRemoteSsrc() > 0) { | 273 } else if (vie_receiver_.GetRemoteSsrc() > 0) { |
278 // Get receive stats if we are receiving packets, i.e. there is a remote | 274 // Get receive stats if we are receiving packets, i.e. there is a remote |
279 // ssrc. | 275 // ssrc. |
280 RtcpPacketTypeCounter rtcp_counter; | 276 RtcpPacketTypeCounter rtcp_counter; |
281 GetReceiveRtcpPacketTypeCounter(&rtcp_counter); | 277 GetReceiveRtcpPacketTypeCounter(&rtcp_counter); |
282 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; | 278 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; |
283 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 279 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
284 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 280 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", |
285 "WebRTC.Video.NackPacketsSentPerMinute", | 281 rtcp_counter.nack_packets * 60 / elapsed_sec); |
286 rtcp_counter.nack_packets * 60 / elapsed_sec); | 282 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", |
287 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 283 rtcp_counter.fir_packets * 60 / elapsed_sec); |
288 "WebRTC.Video.FirPacketsSentPerMinute", | 284 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", |
289 rtcp_counter.fir_packets * 60 / elapsed_sec); | 285 rtcp_counter.pli_packets * 60 / elapsed_sec); |
290 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | |
291 "WebRTC.Video.PliPacketsSentPerMinute", | |
292 rtcp_counter.pli_packets * 60 / elapsed_sec); | |
293 if (rtcp_counter.nack_requests > 0) { | 286 if (rtcp_counter.nack_requests > 0) { |
294 RTC_HISTOGRAM_PERCENTAGE_SPARSE( | 287 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", |
295 "WebRTC.Video.UniqueNackRequestsSentInPercent", | 288 rtcp_counter.UniqueNackRequestsInPercent()); |
296 rtcp_counter.UniqueNackRequestsInPercent()); | |
297 } | 289 } |
298 } | 290 } |
299 | 291 |
300 StreamDataCounters rtp; | 292 StreamDataCounters rtp; |
301 StreamDataCounters rtx; | 293 StreamDataCounters rtx; |
302 GetReceiveStreamDataCounters(&rtp, &rtx); | 294 GetReceiveStreamDataCounters(&rtp, &rtx); |
303 StreamDataCounters rtp_rtx = rtp; | 295 StreamDataCounters rtp_rtx = rtp; |
304 rtp_rtx.Add(rtx); | 296 rtp_rtx.Add(rtx); |
305 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; | 297 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; |
306 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 298 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
307 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 299 RTC_HISTOGRAM_COUNTS_10000( |
308 "WebRTC.Video.BitrateReceivedInKbps", | 300 "WebRTC.Video.BitrateReceivedInKbps", |
309 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 301 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
310 1000)); | 302 1000)); |
311 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 303 RTC_HISTOGRAM_COUNTS_10000( |
312 "WebRTC.Video.MediaBitrateReceivedInKbps", | 304 "WebRTC.Video.MediaBitrateReceivedInKbps", |
313 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 305 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
314 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 306 RTC_HISTOGRAM_COUNTS_10000( |
315 "WebRTC.Video.PaddingBitrateReceivedInKbps", | 307 "WebRTC.Video.PaddingBitrateReceivedInKbps", |
316 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / | 308 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / |
317 1000)); | 309 1000)); |
318 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 310 RTC_HISTOGRAM_COUNTS_10000( |
319 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", | 311 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", |
320 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / | 312 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / |
321 elapsed_sec / 1000)); | 313 elapsed_sec / 1000)); |
322 uint32_t ssrc = 0; | 314 uint32_t ssrc = 0; |
323 if (vie_receiver_.GetRtxSsrc(&ssrc)) { | 315 if (vie_receiver_.GetRtxSsrc(&ssrc)) { |
324 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 316 RTC_HISTOGRAM_COUNTS_10000( |
325 "WebRTC.Video.RtxBitrateReceivedInKbps", | 317 "WebRTC.Video.RtxBitrateReceivedInKbps", |
326 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 318 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
327 1000)); | 319 1000)); |
328 } | 320 } |
329 if (vie_receiver_.IsFecEnabled()) { | 321 if (vie_receiver_.IsFecEnabled()) { |
330 RTC_HISTOGRAM_COUNTS_SPARSE_10000( | 322 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps", |
331 "WebRTC.Video.FecBitrateReceivedInKbps", | 323 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
332 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / | 324 8 / elapsed_sec / 1000)); |
333 1000)); | |
334 } | 325 } |
335 } | 326 } |
336 } | 327 } |
337 } | 328 } |
338 | 329 |
339 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, | 330 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, |
340 bool new_stream) { | 331 bool new_stream) { |
341 RTC_DCHECK(sender_); | 332 RTC_DCHECK(sender_); |
342 if (video_codec.codecType == kVideoCodecRED || | 333 if (video_codec.codecType == kVideoCodecRED || |
343 video_codec.codecType == kVideoCodecULPFEC) { | 334 video_codec.codecType == kVideoCodecULPFEC) { |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 CriticalSectionScoped cs(crit_.get()); | 1199 CriticalSectionScoped cs(crit_.get()); |
1209 receive_stats_callback_ = receive_statistics_proxy; | 1200 receive_stats_callback_ = receive_statistics_proxy; |
1210 } | 1201 } |
1211 | 1202 |
1212 void ViEChannel::SetIncomingVideoStream( | 1203 void ViEChannel::SetIncomingVideoStream( |
1213 IncomingVideoStream* incoming_video_stream) { | 1204 IncomingVideoStream* incoming_video_stream) { |
1214 CriticalSectionScoped cs(crit_.get()); | 1205 CriticalSectionScoped cs(crit_.get()); |
1215 incoming_video_stream_ = incoming_video_stream; | 1206 incoming_video_stream_ = incoming_video_stream; |
1216 } | 1207 } |
1217 } // namespace webrtc | 1208 } // namespace webrtc |
OLD | NEW |