| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 render_pixel_tracker_(100, 10u), | 78 render_pixel_tracker_(100, 10u), |
| 79 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count | 79 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count |
| 80 e2e_delay_max_ms_video_(-1), | 80 e2e_delay_max_ms_video_(-1), |
| 81 e2e_delay_max_ms_screenshare_(-1), | 81 e2e_delay_max_ms_screenshare_(-1), |
| 82 interframe_delay_max_ms_video_(-1), | 82 interframe_delay_max_ms_video_(-1), |
| 83 interframe_delay_max_ms_screenshare_(-1), | 83 interframe_delay_max_ms_screenshare_(-1), |
| 84 interframe_delay_max_moving_(kMovingMaxWindowMs), | 84 interframe_delay_max_moving_(kMovingMaxWindowMs), |
| 85 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), | 85 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), |
| 86 first_report_block_time_ms_(-1), | 86 first_report_block_time_ms_(-1), |
| 87 avg_rtt_ms_(0), | 87 avg_rtt_ms_(0), |
| 88 last_content_type_(VideoContentType::UNSPECIFIED) { | 88 last_content_type_(VideoContentType::UNSPECIFIED), |
| 89 timing_frame_info_counter_(kMovingMaxWindowMs) { |
| 89 stats_.ssrc = config_.rtp.remote_ssrc; | 90 stats_.ssrc = config_.rtp.remote_ssrc; |
| 90 // TODO(brandtr): Replace |rtx_stats_| with a single instance of | 91 // TODO(brandtr): Replace |rtx_stats_| with a single instance of |
| 91 // StreamDataCounters. | 92 // StreamDataCounters. |
| 92 if (config_.rtp.rtx_ssrc) { | 93 if (config_.rtp.rtx_ssrc) { |
| 93 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); | 94 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 | 97 |
| 97 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { | 98 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { |
| 98 UpdateHistograms(); | 99 UpdateHistograms(); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // Get current frame rates here, as only updating them on new frames prevents | 394 // Get current frame rates here, as only updating them on new frames prevents |
| 394 // us from ever correctly displaying frame rate of 0. | 395 // us from ever correctly displaying frame rate of 0. |
| 395 int64_t now_ms = clock_->TimeInMilliseconds(); | 396 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 396 UpdateFramerate(now_ms); | 397 UpdateFramerate(now_ms); |
| 397 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); | 398 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); |
| 398 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); | 399 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); |
| 399 stats_.total_bitrate_bps = | 400 stats_.total_bitrate_bps = |
| 400 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); | 401 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); |
| 401 stats_.interframe_delay_max_ms = | 402 stats_.interframe_delay_max_ms = |
| 402 interframe_delay_max_moving_.Max(now_ms).value_or(-1); | 403 interframe_delay_max_moving_.Max(now_ms).value_or(-1); |
| 404 stats_.timing_frame_info = timing_frame_info_counter_.Max(now_ms); |
| 403 return stats_; | 405 return stats_; |
| 404 } | 406 } |
| 405 | 407 |
| 406 rtc::Optional<TimingFrameInfo> | |
| 407 ReceiveStatisticsProxy::GetAndResetTimingFrameInfo() { | |
| 408 rtc::CritScope lock(&crit_); | |
| 409 rtc::Optional<TimingFrameInfo> info = timing_frame_info_; | |
| 410 // Reset reported value to empty, so it will be always | |
| 411 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new | |
| 412 // value instead of reported one. | |
| 413 timing_frame_info_.reset(); | |
| 414 return info; | |
| 415 } | |
| 416 | |
| 417 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { | 408 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { |
| 418 rtc::CritScope lock(&crit_); | 409 rtc::CritScope lock(&crit_); |
| 419 stats_.current_payload_type = payload_type; | 410 stats_.current_payload_type = payload_type; |
| 420 } | 411 } |
| 421 | 412 |
| 422 void ReceiveStatisticsProxy::OnDecoderImplementationName( | 413 void ReceiveStatisticsProxy::OnDecoderImplementationName( |
| 423 const char* implementation_name) { | 414 const char* implementation_name) { |
| 424 rtc::CritScope lock(&crit_); | 415 rtc::CritScope lock(&crit_); |
| 425 stats_.decoder_implementation_name = implementation_name; | 416 stats_.decoder_implementation_name = implementation_name; |
| 426 } | 417 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 451 jitter_buffer_delay_counter_.Add(jitter_buffer_ms); | 442 jitter_buffer_delay_counter_.Add(jitter_buffer_ms); |
| 452 target_delay_counter_.Add(target_delay_ms); | 443 target_delay_counter_.Add(target_delay_ms); |
| 453 current_delay_counter_.Add(current_delay_ms); | 444 current_delay_counter_.Add(current_delay_ms); |
| 454 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time + | 445 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time + |
| 455 // render delay). | 446 // render delay). |
| 456 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2); | 447 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2); |
| 457 } | 448 } |
| 458 | 449 |
| 459 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated( | 450 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated( |
| 460 const TimingFrameInfo& info) { | 451 const TimingFrameInfo& info) { |
| 452 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 461 rtc::CritScope lock(&crit_); | 453 rtc::CritScope lock(&crit_); |
| 462 // Only the frame which was processed the longest since the last | 454 timing_frame_info_counter_.Add(info, now_ms); |
| 463 // GetStats() call is reported. Therefore, only single 'longest' frame is | |
| 464 // stored. | |
| 465 if (!timing_frame_info_ || info.IsLongerThan(*timing_frame_info_)) { | |
| 466 timing_frame_info_.emplace(info); | |
| 467 } | |
| 468 } | 455 } |
| 469 | 456 |
| 470 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( | 457 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( |
| 471 uint32_t ssrc, | 458 uint32_t ssrc, |
| 472 const RtcpPacketTypeCounter& packet_counter) { | 459 const RtcpPacketTypeCounter& packet_counter) { |
| 473 rtc::CritScope lock(&crit_); | 460 rtc::CritScope lock(&crit_); |
| 474 if (stats_.ssrc != ssrc) | 461 if (stats_.ssrc != ssrc) |
| 475 return; | 462 return; |
| 476 stats_.rtcp_packet_type_counts = packet_counter; | 463 stats_.rtcp_packet_type_counts = packet_counter; |
| 477 } | 464 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 sum = 0; | 666 sum = 0; |
| 680 } | 667 } |
| 681 | 668 |
| 682 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, | 669 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, |
| 683 int64_t max_rtt_ms) { | 670 int64_t max_rtt_ms) { |
| 684 rtc::CritScope lock(&crit_); | 671 rtc::CritScope lock(&crit_); |
| 685 avg_rtt_ms_ = avg_rtt_ms; | 672 avg_rtt_ms_ = avg_rtt_ms; |
| 686 } | 673 } |
| 687 | 674 |
| 688 } // namespace webrtc | 675 } // namespace webrtc |
| OLD | NEW |