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

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

Issue 2607933002: RTCMediaStreamTrackStats.framesDropped collected by RTCStatsCollector. (Closed)
Patch Set: Rebase with master after webrtc/api renamed to webrtc/pc Created 3 years, 11 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { 407 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) {
408 int width = frame.width(); 408 int width = frame.width();
409 int height = frame.height(); 409 int height = frame.height();
410 RTC_DCHECK_GT(width, 0); 410 RTC_DCHECK_GT(width, 0);
411 RTC_DCHECK_GT(height, 0); 411 RTC_DCHECK_GT(height, 0);
412 uint64_t now = clock_->TimeInMilliseconds(); 412 uint64_t now = clock_->TimeInMilliseconds();
413 413
414 rtc::CritScope lock(&crit_); 414 rtc::CritScope lock(&crit_);
415 renders_fps_estimator_.Update(1, now); 415 renders_fps_estimator_.Update(1, now);
416 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0); 416 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0);
417 ++stats_.frames_rendered;
417 stats_.width = width; 418 stats_.width = width;
418 stats_.height = height; 419 stats_.height = height;
419 render_width_counter_.Add(width); 420 render_width_counter_.Add(width);
420 render_height_counter_.Add(height); 421 render_height_counter_.Add(height);
421 render_fps_tracker_.AddSamples(1); 422 render_fps_tracker_.AddSamples(1);
422 render_pixel_tracker_.AddSamples(sqrt(width * height)); 423 render_pixel_tracker_.AddSamples(sqrt(width * height));
423 424
424 if (frame.ntp_time_ms() > 0) { 425 if (frame.ntp_time_ms() > 0) {
425 int64_t delay_ms = clock_->CurrentNtpInMilliseconds() - frame.ntp_time_ms(); 426 int64_t delay_ms = clock_->CurrentNtpInMilliseconds() - frame.ntp_time_ms();
426 if (delay_ms >= 0) 427 if (delay_ms >= 0)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 return -1; 483 return -1;
483 return static_cast<int>(sum / num_samples); 484 return static_cast<int>(sum / num_samples);
484 } 485 }
485 486
486 void ReceiveStatisticsProxy::SampleCounter::Reset() { 487 void ReceiveStatisticsProxy::SampleCounter::Reset() {
487 num_samples = 0; 488 num_samples = 0;
488 sum = 0; 489 sum = 0;
489 } 490 }
490 491
491 } // namespace webrtc 492 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstatscollector_unittest.cc ('k') | webrtc/video/receive_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698