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

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

Issue 2946413002: Report timing frames info in GetStats. (Closed)
Patch Set: Implement Deadbeef@ comments Created 3 years, 5 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), 80 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs),
81 first_report_block_time_ms_(-1), 81 first_report_block_time_ms_(-1),
82 avg_rtt_ms_(0), 82 avg_rtt_ms_(0),
83 last_content_type_(VideoContentType::UNSPECIFIED) { 83 last_content_type_(VideoContentType::UNSPECIFIED),
84 timing_frame_info_() {
84 stats_.ssrc = config_.rtp.remote_ssrc; 85 stats_.ssrc = config_.rtp.remote_ssrc;
85 // TODO(brandtr): Replace |rtx_stats_| with a single instance of 86 // TODO(brandtr): Replace |rtx_stats_| with a single instance of
86 // StreamDataCounters. 87 // StreamDataCounters.
87 if (config_.rtp.rtx_ssrc) { 88 if (config_.rtp.rtx_ssrc) {
88 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); 89 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters();
89 } 90 }
90 } 91 }
91 92
92 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { 93 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() {
93 UpdateHistograms(); 94 UpdateHistograms();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { 365 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
365 rtc::CritScope lock(&crit_); 366 rtc::CritScope lock(&crit_);
366 // Get current frame rates here, as only updating them on new frames prevents 367 // Get current frame rates here, as only updating them on new frames prevents
367 // us from ever correctly displaying frame rate of 0. 368 // us from ever correctly displaying frame rate of 0.
368 int64_t now_ms = clock_->TimeInMilliseconds(); 369 int64_t now_ms = clock_->TimeInMilliseconds();
369 UpdateFramerate(now_ms); 370 UpdateFramerate(now_ms);
370 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); 371 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0);
371 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); 372 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0);
372 stats_.total_bitrate_bps = 373 stats_.total_bitrate_bps =
373 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); 374 static_cast<int>(total_byte_tracker_.ComputeRate() * 8);
375 stats_.timing_frame_info = timing_frame_info_;
376 // Reset reported value to default, because default value will be always
377 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new
378 // value instead of reported one.
379 timing_frame_info_ = TimingFrameInfo();
374 return stats_; 380 return stats_;
375 } 381 }
376 382
377 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { 383 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) {
378 rtc::CritScope lock(&crit_); 384 rtc::CritScope lock(&crit_);
379 stats_.current_payload_type = payload_type; 385 stats_.current_payload_type = payload_type;
380 } 386 }
381 387
382 void ReceiveStatisticsProxy::OnDecoderImplementationName( 388 void ReceiveStatisticsProxy::OnDecoderImplementationName(
383 const char* implementation_name) { 389 const char* implementation_name) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 "target_delay_ms", target_delay_ms, 431 "target_delay_ms", target_delay_ms,
426 "ssrc", stats_.ssrc); 432 "ssrc", stats_.ssrc);
427 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", 433 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs",
428 "jitter_buffer_ms", jitter_buffer_ms, 434 "jitter_buffer_ms", jitter_buffer_ms,
429 "ssrc", stats_.ssrc); 435 "ssrc", stats_.ssrc);
430 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", 436 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs",
431 "render_delay_ms", render_delay_ms, 437 "render_delay_ms", render_delay_ms,
432 "ssrc", stats_.ssrc); 438 "ssrc", stats_.ssrc);
433 } 439 }
434 440
441 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated(
442 const TimingFrameInfo& info) {
443 rtc::CritScope lock(&crit_);
444 // Only the frame which was processed the longest since the last
445 // GetStats() call is reported. Therefore, only single 'longest' frame is
446 // stored.
hbos 2017/06/27 14:08:31 Could we get the latest instead of the longest? Or
ilnik 2017/06/27 15:23:56 Can be simply latest, but this way we may loose im
Taylor Brandstetter 2017/06/28 07:27:46 If I understand correctly, the whole motivation he
ilnik 2017/06/29 08:39:56 Done.
447 if (info.IsLongerThan(timing_frame_info_)) {
448 timing_frame_info_ = info;
449 }
450 }
451
435 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( 452 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
436 uint32_t ssrc, 453 uint32_t ssrc,
437 const RtcpPacketTypeCounter& packet_counter) { 454 const RtcpPacketTypeCounter& packet_counter) {
438 rtc::CritScope lock(&crit_); 455 rtc::CritScope lock(&crit_);
439 if (stats_.ssrc != ssrc) 456 if (stats_.ssrc != ssrc)
440 return; 457 return;
441 stats_.rtcp_packet_type_counts = packet_counter; 458 stats_.rtcp_packet_type_counts = packet_counter;
442 } 459 }
443 460
444 void ReceiveStatisticsProxy::StatisticsUpdated( 461 void ReceiveStatisticsProxy::StatisticsUpdated(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 sum = 0; 647 sum = 0;
631 } 648 }
632 649
633 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, 650 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms,
634 int64_t max_rtt_ms) { 651 int64_t max_rtt_ms) {
635 rtc::CritScope lock(&crit_); 652 rtc::CritScope lock(&crit_);
636 avg_rtt_ms_ = avg_rtt_ms; 653 avg_rtt_ms_ = avg_rtt_ms;
637 } 654 }
638 655
639 } // namespace webrtc 656 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698