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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 | 266 |
267 void ReceiveStatisticsProxy::OnDiscardedPacketsUpdated(int discarded_packets) { | 267 void ReceiveStatisticsProxy::OnDiscardedPacketsUpdated(int discarded_packets) { |
268 rtc::CritScope lock(&crit_); | 268 rtc::CritScope lock(&crit_); |
269 stats_.discarded_packets = discarded_packets; | 269 stats_.discarded_packets = discarded_packets; |
270 } | 270 } |
271 | 271 |
272 void ReceiveStatisticsProxy::OnPreDecode( | 272 void ReceiveStatisticsProxy::OnPreDecode( |
273 const EncodedImage& encoded_image, | 273 const EncodedImage& encoded_image, |
274 const CodecSpecificInfo* codec_specific_info) { | 274 const CodecSpecificInfo* codec_specific_info) { |
275 if (codec_specific_info == nullptr || encoded_image.qp_ == -1) { | 275 if (!codec_specific_info || encoded_image.qp_ == -1) { |
276 return; | 276 return; |
277 } | 277 } |
278 if (codec_specific_info->codecType == kVideoCodecVP8) { | 278 if (codec_specific_info->codecType == kVideoCodecVP8) { |
279 qp_counters_.vp8.Add(encoded_image.qp_); | 279 qp_counters_.vp8.Add(encoded_image.qp_); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) { | 283 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) { |
284 sum += sample; | 284 sum += sample; |
285 ++num_samples; | 285 ++num_samples; |
286 } | 286 } |
287 | 287 |
288 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 288 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
289 if (num_samples < min_required_samples || num_samples == 0) | 289 if (num_samples < min_required_samples || num_samples == 0) |
290 return -1; | 290 return -1; |
291 return sum / num_samples; | 291 return sum / num_samples; |
292 } | 292 } |
293 | 293 |
294 } // namespace webrtc | 294 } // namespace webrtc |
OLD | NEW |