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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { | 364 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { |
365 rtc::CritScope lock(&crit_); | 365 rtc::CritScope lock(&crit_); |
366 // Get current frame rates here, as only updating them on new frames prevents | 366 // Get current frame rates here, as only updating them on new frames prevents |
367 // us from ever correctly displaying frame rate of 0. | 367 // us from ever correctly displaying frame rate of 0. |
368 int64_t now_ms = clock_->TimeInMilliseconds(); | 368 int64_t now_ms = clock_->TimeInMilliseconds(); |
369 UpdateFramerate(now_ms); | 369 UpdateFramerate(now_ms); |
370 stats_.render_frame_rate = renders_fps_estimator_.Rate(now_ms).value_or(0); | 370 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); | 371 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now_ms).value_or(0); |
372 stats_.total_bitrate_bps = | 372 stats_.total_bitrate_bps = |
373 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); | 373 static_cast<int>(total_byte_tracker_.ComputeRate() * 8); |
374 stats_.timing_frame_info = timing_frame_info_; | |
375 // Reset reported value to empty, so it will be always | |
376 // overwritten in |OnTimingFrameInfoUpdated|, thus allowing to store new | |
377 // value instead of reported one. | |
378 timing_frame_info_.reset(); | |
sprang_webrtc
2017/06/28 15:31:41
I think this is problematic, since the GetStats ca
ilnik
2017/06/29 08:39:56
I don't understand what do you mean. In the end, i
sprang_webrtc
2017/06/30 21:38:20
I was thinking of direct calls to ReceiveStatistic
| |
374 return stats_; | 379 return stats_; |
375 } | 380 } |
376 | 381 |
377 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { | 382 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { |
378 rtc::CritScope lock(&crit_); | 383 rtc::CritScope lock(&crit_); |
379 stats_.current_payload_type = payload_type; | 384 stats_.current_payload_type = payload_type; |
380 } | 385 } |
381 | 386 |
382 void ReceiveStatisticsProxy::OnDecoderImplementationName( | 387 void ReceiveStatisticsProxy::OnDecoderImplementationName( |
383 const char* implementation_name) { | 388 const char* implementation_name) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 "target_delay_ms", target_delay_ms, | 430 "target_delay_ms", target_delay_ms, |
426 "ssrc", stats_.ssrc); | 431 "ssrc", stats_.ssrc); |
427 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", | 432 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs", |
428 "jitter_buffer_ms", jitter_buffer_ms, | 433 "jitter_buffer_ms", jitter_buffer_ms, |
429 "ssrc", stats_.ssrc); | 434 "ssrc", stats_.ssrc); |
430 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", | 435 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs", |
431 "render_delay_ms", render_delay_ms, | 436 "render_delay_ms", render_delay_ms, |
432 "ssrc", stats_.ssrc); | 437 "ssrc", stats_.ssrc); |
433 } | 438 } |
434 | 439 |
440 void ReceiveStatisticsProxy::OnTimingFrameInfoUpdated( | |
441 const TimingFrameInfo& info) { | |
442 rtc::CritScope lock(&crit_); | |
443 // Only the frame which was processed the longest since the last | |
444 // GetStats() call is reported. Therefore, only single 'longest' frame is | |
445 // stored. | |
446 if (!timing_frame_info_ || info.IsLongerThan(*timing_frame_info_)) { | |
447 timing_frame_info_.emplace(info); | |
448 } | |
449 } | |
450 | |
435 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( | 451 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( |
436 uint32_t ssrc, | 452 uint32_t ssrc, |
437 const RtcpPacketTypeCounter& packet_counter) { | 453 const RtcpPacketTypeCounter& packet_counter) { |
438 rtc::CritScope lock(&crit_); | 454 rtc::CritScope lock(&crit_); |
439 if (stats_.ssrc != ssrc) | 455 if (stats_.ssrc != ssrc) |
440 return; | 456 return; |
441 stats_.rtcp_packet_type_counts = packet_counter; | 457 stats_.rtcp_packet_type_counts = packet_counter; |
442 } | 458 } |
443 | 459 |
444 void ReceiveStatisticsProxy::StatisticsUpdated( | 460 void ReceiveStatisticsProxy::StatisticsUpdated( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 sum = 0; | 646 sum = 0; |
631 } | 647 } |
632 | 648 |
633 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, | 649 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, |
634 int64_t max_rtt_ms) { | 650 int64_t max_rtt_ms) { |
635 rtc::CritScope lock(&crit_); | 651 rtc::CritScope lock(&crit_); |
636 avg_rtt_ms_ = avg_rtt_ms; | 652 avg_rtt_ms_ = avg_rtt_ms; |
637 } | 653 } |
638 | 654 |
639 } // namespace webrtc | 655 } // namespace webrtc |
OLD | NEW |