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

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

Issue 2884643004: Add traces for some video receive statistics. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "webrtc/video/receive_statistics_proxy.h" 11 #include "webrtc/video/receive_statistics_proxy.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <cmath> 14 #include <cmath>
15 #include <utility> 15 #include <utility>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/trace_event.h"
19 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
20 #include "webrtc/system_wrappers/include/clock.h" 21 #include "webrtc/system_wrappers/include/clock.h"
21 #include "webrtc/system_wrappers/include/field_trial.h" 22 #include "webrtc/system_wrappers/include/field_trial.h"
22 #include "webrtc/system_wrappers/include/metrics.h" 23 #include "webrtc/system_wrappers/include/metrics.h"
23 24
24 namespace webrtc { 25 namespace webrtc {
25 namespace { 26 namespace {
26 // Periodic time interval for processing samples for |freq_offset_counter_|. 27 // Periodic time interval for processing samples for |freq_offset_counter_|.
27 const int64_t kFreqOffsetProcessIntervalMs = 40000; 28 const int64_t kFreqOffsetProcessIntervalMs = 40000;
28 29
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 stats_.jitter_buffer_ms = jitter_buffer_ms; 407 stats_.jitter_buffer_ms = jitter_buffer_ms;
407 stats_.min_playout_delay_ms = min_playout_delay_ms; 408 stats_.min_playout_delay_ms = min_playout_delay_ms;
408 stats_.render_delay_ms = render_delay_ms; 409 stats_.render_delay_ms = render_delay_ms;
409 decode_time_counter_.Add(decode_ms); 410 decode_time_counter_.Add(decode_ms);
410 jitter_buffer_delay_counter_.Add(jitter_buffer_ms); 411 jitter_buffer_delay_counter_.Add(jitter_buffer_ms);
411 target_delay_counter_.Add(target_delay_ms); 412 target_delay_counter_.Add(target_delay_ms);
412 current_delay_counter_.Add(current_delay_ms); 413 current_delay_counter_.Add(current_delay_ms);
413 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time + 414 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time +
414 // render delay). 415 // render delay).
415 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2); 416 delay_counter_.Add(target_delay_ms + avg_rtt_ms_ / 2);
417 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.DecodeTimeInMs",
418 "decode_ms", decode_ms, "ssrc", stats_.ssrc);
419 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.MaxDecodeTimeInMs",
420 "max_decode_ms", max_decode_ms, "ssrc", stats_.ssrc);
421 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.CurrentDelayInMs",
422 "current_delay_ms", current_delay_ms,
423 "ssrc", stats_.ssrc);
424 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.TargetDelayInMs",
425 "target_delay_ms", target_delay_ms,
426 "ssrc", stats_.ssrc);
427 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.JitterBufferDelayInMs",
428 "jitter_buffer_ms", jitter_buffer_ms,
429 "ssrc", stats_.ssrc);
430 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.RenderDelayInMs",
431 "render_delay_ms", render_delay_ms,
432 "ssrc", stats_.ssrc);
416 } 433 }
417 434
418 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( 435 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated(
419 uint32_t ssrc, 436 uint32_t ssrc,
420 const RtcpPacketTypeCounter& packet_counter) { 437 const RtcpPacketTypeCounter& packet_counter) {
421 rtc::CritScope lock(&crit_); 438 rtc::CritScope lock(&crit_);
422 if (stats_.ssrc != ssrc) 439 if (stats_.ssrc != ssrc)
423 return; 440 return;
424 stats_.rtcp_packet_type_counts = packet_counter; 441 stats_.rtcp_packet_type_counts = packet_counter;
425 } 442 }
426 443
427 void ReceiveStatisticsProxy::StatisticsUpdated( 444 void ReceiveStatisticsProxy::StatisticsUpdated(
428 const webrtc::RtcpStatistics& statistics, 445 const webrtc::RtcpStatistics& statistics,
429 uint32_t ssrc) { 446 uint32_t ssrc) {
430 rtc::CritScope lock(&crit_); 447 rtc::CritScope lock(&crit_);
431 // TODO(pbos): Handle both local and remote ssrcs here and RTC_DCHECK that we 448 // TODO(pbos): Handle both local and remote ssrcs here and RTC_DCHECK that we
432 // receive stats from one of them. 449 // receive stats from one of them.
433 if (stats_.ssrc != ssrc) 450 if (stats_.ssrc != ssrc)
434 return; 451 return;
435 stats_.rtcp_stats = statistics; 452 stats_.rtcp_stats = statistics;
436 report_block_stats_.Store(statistics, ssrc, 0); 453 report_block_stats_.Store(statistics, ssrc, 0);
437 454
438 if (first_report_block_time_ms_ == -1) 455 if (first_report_block_time_ms_ == -1)
439 first_report_block_time_ms_ = clock_->TimeInMilliseconds(); 456 first_report_block_time_ms_ = clock_->TimeInMilliseconds();
457
458 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.PacketsLost",
459 "packets_lost", statistics.cumulative_lost,
460 "ssrc", stats_.ssrc);
440 } 461 }
441 462
442 void ReceiveStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) { 463 void ReceiveStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {
443 rtc::CritScope lock(&crit_); 464 rtc::CritScope lock(&crit_);
444 // TODO(pbos): Handle both local and remote ssrcs here and RTC_DCHECK that we 465 // TODO(pbos): Handle both local and remote ssrcs here and RTC_DCHECK that we
445 // receive stats from one of them. 466 // receive stats from one of them.
446 if (stats_.ssrc != ssrc) 467 if (stats_.ssrc != ssrc)
447 return; 468 return;
448 stats_.c_name = cname; 469 stats_.c_name = cname;
449 } 470 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 if (last_content_type_ == VideoContentType::SCREENSHARE) { 541 if (last_content_type_ == VideoContentType::SCREENSHARE) {
521 e2e_delay_max_ms_screenshare_ = 542 e2e_delay_max_ms_screenshare_ =
522 std::max(delay_ms, e2e_delay_max_ms_screenshare_); 543 std::max(delay_ms, e2e_delay_max_ms_screenshare_);
523 e2e_delay_counter_screenshare_.Add(delay_ms); 544 e2e_delay_counter_screenshare_.Add(delay_ms);
524 } else { 545 } else {
525 e2e_delay_max_ms_video_ = std::max(delay_ms, e2e_delay_max_ms_video_); 546 e2e_delay_max_ms_video_ = std::max(delay_ms, e2e_delay_max_ms_video_);
526 e2e_delay_counter_video_.Add(delay_ms); 547 e2e_delay_counter_video_.Add(delay_ms);
527 } 548 }
528 } 549 }
529 } 550 }
551
552 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.ReceivedWidthInPixels",
553 "width", width, "ssrc", stats_.ssrc);
554 TRACE_EVENT_INSTANT2("webrtc_stats", "WebRTC.Video.ReceivedHeightInPixels",
555 "height", height, "ssrc", stats_.ssrc);
556 TRACE_EVENT_INSTANT1("webrtc_stats", "WebRTC.Video.OnRenderedFrame",
557 "ssrc", stats_.ssrc);
530 } 558 }
531 559
532 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms, 560 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms,
533 double estimated_freq_khz) { 561 double estimated_freq_khz) {
534 rtc::CritScope lock(&crit_); 562 rtc::CritScope lock(&crit_);
535 sync_offset_counter_.Add(std::abs(sync_offset_ms)); 563 sync_offset_counter_.Add(std::abs(sync_offset_ms));
536 stats_.sync_offset_ms = sync_offset_ms; 564 stats_.sync_offset_ms = sync_offset_ms;
537 565
538 const double kMaxFreqKhz = 10000.0; 566 const double kMaxFreqKhz = 10000.0;
539 int offset_khz = kMaxFreqKhz; 567 int offset_khz = kMaxFreqKhz;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 sum = 0; 630 sum = 0;
603 } 631 }
604 632
605 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, 633 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms,
606 int64_t max_rtt_ms) { 634 int64_t max_rtt_ms) {
607 rtc::CritScope lock(&crit_); 635 rtc::CritScope lock(&crit_);
608 avg_rtt_ms_ = avg_rtt_ms; 636 avg_rtt_ms_ = avg_rtt_ms;
609 } 637 }
610 638
611 } // namespace webrtc 639 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698