Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1195)

Side by Side Diff: webrtc/video/receive_statistics_proxy.cc

Issue 3012073002: Change reporting of timing frames conditions in GetStats on receive side (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // 1000ms window, scale 1000 for ms to s. 97 // 1000ms window, scale 1000 for ms to s.
98 decode_fps_estimator_(1000, 1000), 98 decode_fps_estimator_(1000, 1000),
99 renders_fps_estimator_(1000, 1000), 99 renders_fps_estimator_(1000, 1000),
100 render_fps_tracker_(100, 10u), 100 render_fps_tracker_(100, 10u),
101 render_pixel_tracker_(100, 10u), 101 render_pixel_tracker_(100, 10u),
102 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count 102 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count
103 interframe_delay_max_moving_(kMovingMaxWindowMs), 103 interframe_delay_max_moving_(kMovingMaxWindowMs),
104 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), 104 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs),
105 first_report_block_time_ms_(-1), 105 first_report_block_time_ms_(-1),
106 avg_rtt_ms_(0), 106 avg_rtt_ms_(0),
107 last_content_type_(VideoContentType::UNSPECIFIED) { 107 last_content_type_(VideoContentType::UNSPECIFIED),
108 timing_frame_info_counter_(kMovingMaxWindowMs) {
108 stats_.ssrc = config_.rtp.remote_ssrc; 109 stats_.ssrc = config_.rtp.remote_ssrc;
109 // TODO(brandtr): Replace |rtx_stats_| with a single instance of 110 // TODO(brandtr): Replace |rtx_stats_| with a single instance of
110 // StreamDataCounters. 111 // StreamDataCounters.
111 if (config_.rtp.rtx_ssrc) { 112 if (config_.rtp.rtx_ssrc) {
112 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); 113 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters();
113 } 114 }
114 } 115 }
115 116
116 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { 117 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() {
117 UpdateHistograms(); 118 UpdateHistograms();
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // Get current frame rates here, as only updating them on new frames prevents 493 // Get current frame rates here, as only updating them on new frames prevents
493 // us from ever correctly displaying frame rate of 0. 494 // us from ever correctly displaying frame rate of 0.
494 int64_t now_ms = clock_->TimeInMilliseconds(); 495 int64_t now_ms = clock_->TimeInMilliseconds();
495 UpdateFramerate(now_ms); 496 UpdateFramerate(now_ms);
496 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); 497 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0);
497 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); 498 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0);
498 stats_.total_bitrate_bps = 499 stats_.total_bitrate_bps =
499 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); 500 static_cast<int>(total_byte_tracker_.ComputeRate() * 8);
500 stats_.interframe_delay_max_ms = 501 stats_.interframe_delay_max_ms =
501 interframe_delay_max_moving_.Max(now_ms).value_or(-1); 502 interframe_delay_max_moving_.Max(now_ms).value_or(-1);
503 stats_.timing_frame_info = timing_frame_info_counter_.Max(now_ms);
502 return stats_; 504 return stats_;
503 } 505 }
504 506
505 rtc::Optional<TimingFrameInfo>
506 ReceiveStatisticsProxy::GetAndResetTimingFrameInfo() {
507 rtc::CritScope lock(&crit_);
508 rtc::Optional<TimingFrameInfo> info = timing_frame_info_;
509 // Reset reported value to empty, so it will be always
510 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new
511 // value instead of reported one.
512 timing_frame_info_.reset();
513 return info;
514 }
515
516 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { 507 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) {
517 rtc::CritScope lock(&crit_); 508 rtc::CritScope lock(&crit_);
518 stats_.current_payload_type = payload_type; 509 stats_.current_payload_type = payload_type;
519 } 510 }
520 511
521 void ReceiveStatisticsProxy::OnDecoderImplementationName( 512 void ReceiveStatisticsProxy::OnDecoderImplementationName(
522 const char* implementation_name) { 513 const char* implementation_name) {
523 rtc::CritScope lock(&crit_); 514 rtc::CritScope lock(&crit_);
524 stats_.decoder_implementation_name = implementation_name; 515 stats_.decoder_implementation_name = implementation_name;
525 } 516 }
(...skipping 24 matching lines...) Expand all
550 jitter_buffer_delay_counter_.Add(jitter_buffer_ms); 541 jitter_buffer_delay_counter_.Add(jitter_buffer_ms);
551 target_delay_counter_.Add(target_delay_ms); 542 target_delay_counter_.Add(target_delay_ms);
552 current_delay_counter_.Add(current_delay_ms); 543 current_delay_counter_.Add(current_delay_ms);
553 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time + 544 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time +
554 // render delay). 545 // render delay).
555 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2); 546 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2);
556 } 547 }
557 548
558 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated( 549 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated(
559 const TimingFrameInfo& info) { 550 const TimingFrameInfo& info) {
551 int64_t now_ms = clock_->TimeInMilliseconds();
560 rtc::CritScope lock(&crit_); 552 rtc::CritScope lock(&crit_);
561 // Only the frame which was processed the longest since the last 553 timing_frame_info_counter_.Add(info, now_ms);
562 // GetStats() call is reported. Therefore, only single 'longest' frame is
563 // stored.
564 if (!timing_frame_info_ || info.IsLongerThan(*timing_frame_info_)) {
565 timing_frame_info_.emplace(info);
566 }
567 } 554 }
568 555
569 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( 556 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
570 uint32_t ssrc, 557 uint32_t ssrc,
571 const RtcpPacketTypeCounter& packet_counter) { 558 const RtcpPacketTypeCounter& packet_counter) {
572 rtc::CritScope lock(&crit_); 559 rtc::CritScope lock(&crit_);
573 if (stats_.ssrc != ssrc) 560 if (stats_.ssrc != ssrc)
574 return; 561 return;
575 stats_.rtcp_packet_type_counts = packet_counter; 562 stats_.rtcp_packet_type_counts = packet_counter;
576 } 563 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 flow_duration_ms += other.flow_duration_ms; 794 flow_duration_ms += other.flow_duration_ms;
808 total_media_bytes += other.total_media_bytes; 795 total_media_bytes += other.total_media_bytes;
809 received_height.Add(other.received_height); 796 received_height.Add(other.received_height);
810 received_width.Add(other.received_width); 797 received_width.Add(other.received_width);
811 qp_counter.Add(other.qp_counter); 798 qp_counter.Add(other.qp_counter);
812 frame_counts.key_frames += other.frame_counts.key_frames; 799 frame_counts.key_frames += other.frame_counts.key_frames;
813 frame_counts.delta_frames += other.frame_counts.delta_frames; 800 frame_counts.delta_frames += other.frame_counts.delta_frames;
814 } 801 }
815 802
816 } // namespace webrtc 803 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/receive_statistics_proxy.h ('k') | webrtc/video/receive_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698