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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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> ReceiveStatisticsProxy::GetTimingFrameInfo() { | |
sprang_webrtc
2017/07/06 09:13:08
nit: Rename this method so it's clear we're mutati
ilnik
2017/07/06 09:28:37
Done.
| |
410 rtc::CritScope lock(&crit_); | |
411 rtc::Optional<TimingFrameInfo> info = timing_frame_info_; | |
412 // Reset reported value to empty, so it will be always | |
413 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new | |
414 // value instead of reported one. | |
415 timing_frame_info_.reset(); | |
416 return info; | |
417 } | |
418 | |
409 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { | 419 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { |
410 rtc::CritScope lock(&crit_); | 420 rtc::CritScope lock(&crit_); |
411 stats_.current_payload_type = payload_type; | 421 stats_.current_payload_type = payload_type; |
412 } | 422 } |
413 | 423 |
414 void ReceiveStatisticsProxy::OnDecoderImplementationName( | 424 void ReceiveStatisticsProxy::OnDecoderImplementationName( |
415 const char* implementation_name) { | 425 const char* implementation_name) { |
416 rtc::CritScope lock(&crit_); | 426 rtc::CritScope lock(&crit_); |
417 stats_.decoder_implementation_name = implementation_name; | 427 stats_.decoder_implementation_name = implementation_name; |
418 } | 428 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 "target_delay_ms", target_delay_ms, | 467 "target_delay_ms", target_delay_ms, |
458 "ssrc", stats_.ssrc); | 468 "ssrc", stats_.ssrc); |
459 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", | 469 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", |
460 "jitter_buffer_ms", jitter_buffer_ms, | 470 "jitter_buffer_ms", jitter_buffer_ms, |
461 "ssrc", stats_.ssrc); | 471 "ssrc", stats_.ssrc); |
462 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", | 472 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", |
463 "render_delay_ms", render_delay_ms, | 473 "render_delay_ms", render_delay_ms, |
464 "ssrc", stats_.ssrc); | 474 "ssrc", stats_.ssrc); |
465 } | 475 } |
466 | 476 |
477 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated( | |
478 const TimingFrameInfo& info) { | |
479 rtc::CritScope lock(&crit_); | |
480 // Only the frame which was processed the longest since the last | |
481 // GetStats() call is reported. Therefore, only single 'longest' frame is | |
482 // stored. | |
483 if (!timing_frame_info_ || info.IsLongerThan(*timing_frame_info_)) { | |
484 timing_frame_info_.emplace(info); | |
485 } | |
486 } | |
487 | |
467 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( | 488 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( |
468 uint32_t ssrc, | 489 uint32_t ssrc, |
469 const RtcpPacketTypeCounter& packet_counter) { | 490 const RtcpPacketTypeCounter& packet_counter) { |
470 rtc::CritScope lock(&crit_); | 491 rtc::CritScope lock(&crit_); |
471 if (stats_.ssrc != ssrc) | 492 if (stats_.ssrc != ssrc) |
472 return; | 493 return; |
473 stats_.rtcp_packet_type_counts = packet_counter; | 494 stats_.rtcp_packet_type_counts = packet_counter; |
474 } | 495 } |
475 | 496 |
476 void ReceiveStatisticsProxy::StatisticsUpdated( | 497 void ReceiveStatisticsProxy::StatisticsUpdated( |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 sum = 0; | 699 sum = 0; |
679 } | 700 } |
680 | 701 |
681 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, | 702 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, |
682 int64_t max_rtt_ms) { | 703 int64_t max_rtt_ms) { |
683 rtc::CritScope lock(&crit_); | 704 rtc::CritScope lock(&crit_); |
684 avg_rtt_ms_ = avg_rtt_ms; | 705 avg_rtt_ms_ = avg_rtt_ms; |
685 } | 706 } |
686 | 707 |
687 } // namespace webrtc | 708 } // namespace webrtc |
OLD | NEW |