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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 num_bad_states_(0), | 70 num_bad_states_(0), |
71 num_certain_states_(0), | 71 num_certain_states_(0), |
72 // 1000ms window, scale 1000 for ms to s. | 72 // 1000ms window, scale 1000 for ms to s. |
73 decode_fps_estimator_(1000, 1000), | 73 decode_fps_estimator_(1000, 1000), |
74 renders_fps_estimator_(1000, 1000), | 74 renders_fps_estimator_(1000, 1000), |
75 render_fps_tracker_(100, 10u), | 75 render_fps_tracker_(100, 10u), |
76 render_pixel_tracker_(100, 10u), | 76 render_pixel_tracker_(100, 10u), |
77 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count | 77 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count |
78 e2e_delay_max_ms_video_(-1), | 78 e2e_delay_max_ms_video_(-1), |
79 e2e_delay_max_ms_screenshare_(-1), | 79 e2e_delay_max_ms_screenshare_(-1), |
| 80 interframe_delay_max_ms_video_(-1), |
| 81 interframe_delay_max_ms_screenshare_(-1), |
80 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), | 82 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), |
81 first_report_block_time_ms_(-1), | 83 first_report_block_time_ms_(-1), |
82 avg_rtt_ms_(0), | 84 avg_rtt_ms_(0), |
83 last_content_type_(VideoContentType::UNSPECIFIED) { | 85 last_content_type_(VideoContentType::UNSPECIFIED) { |
84 stats_.ssrc = config_.rtp.remote_ssrc; | 86 stats_.ssrc = config_.rtp.remote_ssrc; |
85 // TODO(brandtr): Replace |rtx_stats_| with a single instance of | 87 // TODO(brandtr): Replace |rtx_stats_| with a single instance of |
86 // StreamDataCounters. | 88 // StreamDataCounters. |
87 if (config_.rtp.rtx_ssrc) { | 89 if (config_.rtp.rtx_ssrc) { |
88 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); | 90 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); |
89 } | 91 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.EndToEndDelayMaxInMs", | 205 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.EndToEndDelayMaxInMs", |
204 e2e_delay_max_ms_video); | 206 e2e_delay_max_ms_video); |
205 } | 207 } |
206 | 208 |
207 int e2e_delay_max_ms_screenshare = e2e_delay_max_ms_screenshare_; | 209 int e2e_delay_max_ms_screenshare = e2e_delay_max_ms_screenshare_; |
208 if (e2e_delay_max_ms_screenshare != -1) { | 210 if (e2e_delay_max_ms_screenshare != -1) { |
209 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.Screenshare.EndToEndDelayMaxInMs", | 211 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.Screenshare.EndToEndDelayMaxInMs", |
210 e2e_delay_max_ms_screenshare); | 212 e2e_delay_max_ms_screenshare); |
211 } | 213 } |
212 | 214 |
| 215 int interframe_delay_ms_screenshare = |
| 216 interframe_delay_counter_screenshare_.Avg(kMinRequiredSamples); |
| 217 if (interframe_delay_ms_screenshare != -1) { |
| 218 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.InterframeDelayInMs", |
| 219 interframe_delay_ms_screenshare); |
| 220 } |
| 221 |
| 222 int interframe_delay_ms_video = |
| 223 interframe_delay_counter_video_.Avg(kMinRequiredSamples); |
| 224 if (interframe_delay_ms_video != -1) { |
| 225 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InterframeDelayInMs", |
| 226 interframe_delay_ms_video); |
| 227 } |
| 228 |
| 229 int interframe_delay_max_ms_screenshare = |
| 230 interframe_delay_max_ms_screenshare_; |
| 231 if (interframe_delay_max_ms_screenshare != -1) { |
| 232 RTC_HISTOGRAM_COUNTS_10000( |
| 233 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs", |
| 234 interframe_delay_ms_screenshare); |
| 235 } |
| 236 |
| 237 int interframe_delay_max_ms_video = interframe_delay_max_ms_video_; |
| 238 if (interframe_delay_max_ms_video != -1) { |
| 239 RTC_HISTOGRAM_COUNTS_10000( |
| 240 "WebRTC.Video.InterframeDelayMaxInMs", |
| 241 interframe_delay_ms_video); |
| 242 } |
| 243 |
| 244 |
213 StreamDataCounters rtp = stats_.rtp_stats; | 245 StreamDataCounters rtp = stats_.rtp_stats; |
214 StreamDataCounters rtx; | 246 StreamDataCounters rtx; |
215 for (auto it : rtx_stats_) | 247 for (auto it : rtx_stats_) |
216 rtx.Add(it.second); | 248 rtx.Add(it.second); |
217 StreamDataCounters rtp_rtx = rtp; | 249 StreamDataCounters rtp_rtx = rtp; |
218 rtp_rtx.Add(rtx); | 250 rtp_rtx.Add(rtx); |
219 int64_t elapsed_sec = | 251 int64_t elapsed_sec = |
220 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; | 252 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; |
221 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 253 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
222 RTC_HISTOGRAM_COUNTS_10000( | 254 RTC_HISTOGRAM_COUNTS_10000( |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 stats_.qp_sum = rtc::Optional<uint64_t>(0); | 541 stats_.qp_sum = rtc::Optional<uint64_t>(0); |
510 } | 542 } |
511 *stats_.qp_sum += *qp; | 543 *stats_.qp_sum += *qp; |
512 } else if (stats_.qp_sum) { | 544 } else if (stats_.qp_sum) { |
513 LOG(LS_WARNING) | 545 LOG(LS_WARNING) |
514 << "QP sum was already set and no QP was given for a frame."; | 546 << "QP sum was already set and no QP was given for a frame."; |
515 stats_.qp_sum = rtc::Optional<uint64_t>(); | 547 stats_.qp_sum = rtc::Optional<uint64_t>(); |
516 } | 548 } |
517 last_content_type_ = content_type; | 549 last_content_type_ = content_type; |
518 decode_fps_estimator_.Update(1, now); | 550 decode_fps_estimator_.Update(1, now); |
| 551 if (last_decoded_frame_time_ms_) { |
| 552 int64_t interframe_delay_ms = now - *last_decoded_frame_time_ms_; |
| 553 RTC_DCHECK_GE(interframe_delay_ms, 0); |
| 554 if (last_content_type_ == VideoContentType::SCREENSHARE) { |
| 555 interframe_delay_counter_screenshare_.Add(interframe_delay_ms); |
| 556 if (interframe_delay_max_ms_screenshare_ < interframe_delay_ms) { |
| 557 interframe_delay_max_ms_screenshare_ = interframe_delay_ms; |
| 558 } |
| 559 } else { |
| 560 interframe_delay_counter_video_.Add(interframe_delay_ms); |
| 561 if (interframe_delay_max_ms_video_ < interframe_delay_ms) { |
| 562 interframe_delay_max_ms_video_ = interframe_delay_ms; |
| 563 } |
| 564 } |
| 565 } |
| 566 last_decoded_frame_time_ms_.emplace(now); |
519 } | 567 } |
520 | 568 |
521 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { | 569 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { |
522 int width = frame.width(); | 570 int width = frame.width(); |
523 int height = frame.height(); | 571 int height = frame.height(); |
524 RTC_DCHECK_GT(width, 0); | 572 RTC_DCHECK_GT(width, 0); |
525 RTC_DCHECK_GT(height, 0); | 573 RTC_DCHECK_GT(height, 0); |
526 uint64_t now = clock_->TimeInMilliseconds(); | 574 uint64_t now = clock_->TimeInMilliseconds(); |
527 | 575 |
528 rtc::CritScope lock(&crit_); | 576 rtc::CritScope lock(&crit_); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 sum = 0; | 678 sum = 0; |
631 } | 679 } |
632 | 680 |
633 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, | 681 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, |
634 int64_t max_rtt_ms) { | 682 int64_t max_rtt_ms) { |
635 rtc::CritScope lock(&crit_); | 683 rtc::CritScope lock(&crit_); |
636 avg_rtt_ms_ = avg_rtt_ms; | 684 avg_rtt_ms_ = avg_rtt_ms; |
637 } | 685 } |
638 | 686 |
639 } // namespace webrtc | 687 } // namespace webrtc |
OLD | NEW |