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

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

Issue 2946413002: Report timing frames info in GetStats. (Closed)
Patch Set: rebase 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // us from ever correctly displaying frame rate of 0. 399 // us from ever correctly displaying frame rate of 0.
400 int64_t now_ms = clock_->TimeInMilliseconds(); 400 int64_t now_ms = clock_->TimeInMilliseconds();
401 UpdateFramerate(now_ms); 401 UpdateFramerate(now_ms);
402 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); 402 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0);
403 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); 403 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0);
404 stats_.total_bitrate_bps = 404 stats_.total_bitrate_bps =
405 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); 405 static_cast<int>(total_byte_tracker_.ComputeRate() * 8);
406 return stats_; 406 return stats_;
407 } 407 }
408 408
409 rtc::Optional<TimingFrameInfo>
410 ReceiveStatisticsProxy::GetAndResetTimingFrameInfo() {
411 rtc::CritScope lock(&crit_);
412 rtc::Optional<TimingFrameInfo> info = timing_frame_info_;
413 // Reset reported value to empty, so it will be always
414 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new
415 // value instead of reported one.
416 timing_frame_info_.reset();
417 return info;
418 }
419
409 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { 420 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) {
410 rtc::CritScope lock(&crit_); 421 rtc::CritScope lock(&crit_);
411 stats_.current_payload_type = payload_type; 422 stats_.current_payload_type = payload_type;
412 } 423 }
413 424
414 void ReceiveStatisticsProxy::OnDecoderImplementationName( 425 void ReceiveStatisticsProxy::OnDecoderImplementationName(
415 const char* implementation_name) { 426 const char* implementation_name) {
416 rtc::CritScope lock(&crit_); 427 rtc::CritScope lock(&crit_);
417 stats_.decoder_implementation_name = implementation_name; 428 stats_.decoder_implementation_name = implementation_name;
418 } 429 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 "target_delay_ms", target_delay_ms, 468 "target_delay_ms", target_delay_ms,
458 "ssrc", stats_.ssrc); 469 "ssrc", stats_.ssrc);
459 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", 470 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs",
460 "jitter_buffer_ms", jitter_buffer_ms, 471 "jitter_buffer_ms", jitter_buffer_ms,
461 "ssrc", stats_.ssrc); 472 "ssrc", stats_.ssrc);
462 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", 473 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs",
463 "render_delay_ms", render_delay_ms, 474 "render_delay_ms", render_delay_ms,
464 "ssrc", stats_.ssrc); 475 "ssrc", stats_.ssrc);
465 } 476 }
466 477
478 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated(
479 const TimingFrameInfo& info) {
480 rtc::CritScope lock(&crit_);
481 // Only the frame which was processed the longest since the last
482 // GetStats() call is reported. Therefore, only single 'longest' frame is
483 // stored.
484 if (!timing_frame_info_ || info.IsLongerThan(*timing_frame_info_)) {
485 timing_frame_info_.emplace(info);
486 }
487 }
488
467 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( 489 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
468 uint32_t ssrc, 490 uint32_t ssrc,
469 const RtcpPacketTypeCounter& packet_counter) { 491 const RtcpPacketTypeCounter& packet_counter) {
470 rtc::CritScope lock(&crit_); 492 rtc::CritScope lock(&crit_);
471 if (stats_.ssrc != ssrc) 493 if (stats_.ssrc != ssrc)
472 return; 494 return;
473 stats_.rtcp_packet_type_counts = packet_counter; 495 stats_.rtcp_packet_type_counts = packet_counter;
474 } 496 }
475 497
476 void ReceiveStatisticsProxy::StatisticsUpdated( 498 void ReceiveStatisticsProxy::StatisticsUpdated(
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 sum = 0; 700 sum = 0;
679 } 701 }
680 702
681 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, 703 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms,
682 int64_t max_rtt_ms) { 704 int64_t max_rtt_ms) {
683 rtc::CritScope lock(&crit_); 705 rtc::CritScope lock(&crit_);
684 avg_rtt_ms_ = avg_rtt_ms; 706 avg_rtt_ms_ = avg_rtt_ms;
685 } 707 }
686 708
687 } // namespace webrtc 709 } // 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