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

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

Issue 2809653004: Revert of Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Created 3 years, 8 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 kBadFraction, 67 kBadFraction,
68 kNumMeasurementsVariance), 68 kNumMeasurementsVariance),
69 num_bad_states_(0), 69 num_bad_states_(0),
70 num_certain_states_(0), 70 num_certain_states_(0),
71 // 1000ms window, scale 1000 for ms to s. 71 // 1000ms window, scale 1000 for ms to s.
72 decode_fps_estimator_(1000, 1000), 72 decode_fps_estimator_(1000, 1000),
73 renders_fps_estimator_(1000, 1000), 73 renders_fps_estimator_(1000, 1000),
74 render_fps_tracker_(100, 10u), 74 render_fps_tracker_(100, 10u),
75 render_pixel_tracker_(100, 10u), 75 render_pixel_tracker_(100, 10u),
76 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count 76 total_byte_tracker_(100, 10u), // bucket_interval_ms, bucket_count
77 e2e_delay_max_ms_video_(-1),
78 e2e_delay_max_ms_screenshare_(-1),
79 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs), 77 freq_offset_counter_(clock, nullptr, kFreqOffsetProcessIntervalMs),
80 first_report_block_time_ms_(-1), 78 first_report_block_time_ms_(-1),
81 avg_rtt_ms_(0), 79 avg_rtt_ms_(0) {
82 last_content_type_(VideoContentType::UNSPECIFIED) {
83 stats_.ssrc = config_.rtp.remote_ssrc; 80 stats_.ssrc = config_.rtp.remote_ssrc;
84 // TODO(brandtr): Replace |rtx_stats_| with a single instance of 81 // TODO(brandtr): Replace |rtx_stats_| with a single instance of
85 // StreamDataCounters. 82 // StreamDataCounters.
86 if (config_.rtp.rtx_ssrc) { 83 if (config_.rtp.rtx_ssrc) {
87 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters(); 84 rtx_stats_[config_.rtp.rtx_ssrc] = StreamDataCounters();
88 } 85 }
89 } 86 }
90 87
91 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { 88 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() {
92 UpdateHistograms(); 89 UpdateHistograms();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 162 }
166 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredSamples); 163 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredSamples);
167 if (current_delay_ms != -1) { 164 if (current_delay_ms != -1) {
168 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs", 165 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
169 current_delay_ms); 166 current_delay_ms);
170 } 167 }
171 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); 168 int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
172 if (delay_ms != -1) 169 if (delay_ms != -1)
173 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); 170 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
174 171
175 int e2e_delay_ms_video = e2e_delay_counter_video_.Avg(kMinRequiredSamples); 172 int e2e_delay_ms = e2e_delay_counter_.Avg(kMinRequiredSamples);
176 if (e2e_delay_ms_video != -1) { 173 if (e2e_delay_ms != -1)
177 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.EndToEndDelayInMs", 174 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.EndToEndDelayInMs", e2e_delay_ms);
178 e2e_delay_ms_video);
179 }
180
181 int e2e_delay_ms_screenshare =
182 e2e_delay_counter_screenshare_.Avg(kMinRequiredSamples);
183 if (e2e_delay_ms_screenshare != -1) {
184 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.EndToEndDelayInMs",
185 e2e_delay_ms_screenshare);
186 }
187
188 int e2e_delay_max_ms_video = e2e_delay_max_ms_video_;
189 if (e2e_delay_max_ms_video != -1) {
190 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.EndToEndDelayMaxInMs",
191 e2e_delay_max_ms_video);
192 }
193
194 int e2e_delay_max_ms_screenshare = e2e_delay_max_ms_screenshare_;
195 if (e2e_delay_max_ms_screenshare != -1) {
196 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.Screenshare.EndToEndDelayMaxInMs",
197 e2e_delay_max_ms_screenshare);
198 }
199 175
200 StreamDataCounters rtp = stats_.rtp_stats; 176 StreamDataCounters rtp = stats_.rtp_stats;
201 StreamDataCounters rtx; 177 StreamDataCounters rtx;
202 for (auto it : rtx_stats_) 178 for (auto it : rtx_stats_)
203 rtx.Add(it.second); 179 rtx.Add(it.second);
204 StreamDataCounters rtp_rtx = rtp; 180 StreamDataCounters rtp_rtx = rtp;
205 rtp_rtx.Add(rtx); 181 rtp_rtx.Add(rtx);
206 int64_t elapsed_sec = 182 int64_t elapsed_sec =
207 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; 183 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000;
208 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 184 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 total_bytes = counters.transmitted.TotalBytes(); 424 total_bytes = counters.transmitted.TotalBytes();
449 it->second = counters; 425 it->second = counters;
450 } else { 426 } else {
451 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc; 427 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc;
452 } 428 }
453 } 429 }
454 if (total_bytes > last_total_bytes) 430 if (total_bytes > last_total_bytes)
455 total_byte_tracker_.AddSamples(total_bytes - last_total_bytes); 431 total_byte_tracker_.AddSamples(total_bytes - last_total_bytes);
456 } 432 }
457 433
458 void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp, 434 void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp) {
459 VideoContentType content_type) {
460 uint64_t now = clock_->TimeInMilliseconds(); 435 uint64_t now = clock_->TimeInMilliseconds();
461 436
462 rtc::CritScope lock(&crit_); 437 rtc::CritScope lock(&crit_);
463 ++stats_.frames_decoded; 438 ++stats_.frames_decoded;
464 if (qp) { 439 if (qp) {
465 if (!stats_.qp_sum) { 440 if (!stats_.qp_sum) {
466 if (stats_.frames_decoded != 1) { 441 if (stats_.frames_decoded != 1) {
467 LOG(LS_WARNING) 442 LOG(LS_WARNING)
468 << "Frames decoded was not 1 when first qp value was received."; 443 << "Frames decoded was not 1 when first qp value was received.";
469 stats_.frames_decoded = 1; 444 stats_.frames_decoded = 1;
470 } 445 }
471 stats_.qp_sum = rtc::Optional<uint64_t>(0); 446 stats_.qp_sum = rtc::Optional<uint64_t>(0);
472 } 447 }
473 *stats_.qp_sum += *qp; 448 *stats_.qp_sum += *qp;
474 } else if (stats_.qp_sum) { 449 } else if (stats_.qp_sum) {
475 LOG(LS_WARNING) 450 LOG(LS_WARNING)
476 << "QP sum was already set and no QP was given for a frame."; 451 << "QP sum was already set and no QP was given for a frame.";
477 stats_.qp_sum = rtc::Optional<uint64_t>(); 452 stats_.qp_sum = rtc::Optional<uint64_t>();
478 } 453 }
479 last_content_type_ = content_type;
480 decode_fps_estimator_.Update(1, now); 454 decode_fps_estimator_.Update(1, now);
481 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0); 455 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0);
482 } 456 }
483 457
484 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { 458 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) {
485 int width = frame.width(); 459 int width = frame.width();
486 int height = frame.height(); 460 int height = frame.height();
487 RTC_DCHECK_GT(width, 0); 461 RTC_DCHECK_GT(width, 0);
488 RTC_DCHECK_GT(height, 0); 462 RTC_DCHECK_GT(height, 0);
489 uint64_t now = clock_->TimeInMilliseconds(); 463 uint64_t now = clock_->TimeInMilliseconds();
490 464
491 rtc::CritScope lock(&crit_); 465 rtc::CritScope lock(&crit_);
492 renders_fps_estimator_.Update(1, now); 466 renders_fps_estimator_.Update(1, now);
493 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0); 467 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0);
494 ++stats_.frames_rendered; 468 ++stats_.frames_rendered;
495 stats_.width = width; 469 stats_.width = width;
496 stats_.height = height; 470 stats_.height = height;
497 render_width_counter_.Add(width); 471 render_width_counter_.Add(width);
498 render_height_counter_.Add(height); 472 render_height_counter_.Add(height);
499 render_fps_tracker_.AddSamples(1); 473 render_fps_tracker_.AddSamples(1);
500 render_pixel_tracker_.AddSamples(sqrt(width * height)); 474 render_pixel_tracker_.AddSamples(sqrt(width * height));
501 475
502 if (frame.ntp_time_ms() > 0) { 476 if (frame.ntp_time_ms() > 0) {
503 int64_t delay_ms = clock_->CurrentNtpInMilliseconds() - frame.ntp_time_ms(); 477 int64_t delay_ms = clock_->CurrentNtpInMilliseconds() - frame.ntp_time_ms();
504 if (delay_ms >= 0) { 478 if (delay_ms >= 0)
505 if (last_content_type_ == VideoContentType::SCREENSHARE) { 479 e2e_delay_counter_.Add(delay_ms);
506 e2e_delay_max_ms_screenshare_ =
507 std::max(delay_ms, e2e_delay_max_ms_screenshare_);
508 e2e_delay_counter_screenshare_.Add(delay_ms);
509 } else {
510 e2e_delay_max_ms_video_ = std::max(delay_ms, e2e_delay_max_ms_video_);
511 e2e_delay_counter_video_.Add(delay_ms);
512 }
513 }
514 } 480 }
515 } 481 }
516 482
517 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms, 483 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms,
518 double estimated_freq_khz) { 484 double estimated_freq_khz) {
519 rtc::CritScope lock(&crit_); 485 rtc::CritScope lock(&crit_);
520 sync_offset_counter_.Add(std::abs(sync_offset_ms)); 486 sync_offset_counter_.Add(std::abs(sync_offset_ms));
521 stats_.sync_offset_ms = sync_offset_ms; 487 stats_.sync_offset_ms = sync_offset_ms;
522 488
523 const double kMaxFreqKhz = 10000.0; 489 const double kMaxFreqKhz = 10000.0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 sum = 0; 553 sum = 0;
588 } 554 }
589 555
590 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, 556 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms,
591 int64_t max_rtt_ms) { 557 int64_t max_rtt_ms) {
592 rtc::CritScope lock(&crit_); 558 rtc::CritScope lock(&crit_);
593 avg_rtt_ms_ = avg_rtt_ms; 559 avg_rtt_ms_ = avg_rtt_ms;
594 } 560 }
595 561
596 } // namespace webrtc 562 } // 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