| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |