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

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

Issue 2577073002: ReceiveStatisticsProxy: add some unit tests, change members from int to int64_t. (Closed)
Patch Set: add unit tests 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 rtc::CritScope lock(&crit_); 435 rtc::CritScope lock(&crit_);
436 qp_sample_.Add(encoded_image.qp_); 436 qp_sample_.Add(encoded_image.qp_);
437 } 437 }
438 } 438 }
439 439
440 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) { 440 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) {
441 sum += sample; 441 sum += sample;
442 ++num_samples; 442 ++num_samples;
443 } 443 }
444 444
445 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 445 int ReceiveStatisticsProxy::SampleCounter::Avg(
446 int64_t min_required_samples) const {
446 if (num_samples < min_required_samples || num_samples == 0) 447 if (num_samples < min_required_samples || num_samples == 0)
447 return -1; 448 return -1;
448 return sum / num_samples; 449 return static_cast<int>(sum / num_samples);
449 } 450 }
450 451
451 void ReceiveStatisticsProxy::SampleCounter::Reset() { 452 void ReceiveStatisticsProxy::SampleCounter::Reset() {
452 num_samples = 0; 453 num_samples = 0;
453 sum = 0; 454 sum = 0;
454 } 455 }
455 456
456 } // namespace webrtc 457 } // 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