| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 if (!codec_specific_info || encoded_image.qp_ == -1) { | 641 if (!codec_specific_info || encoded_image.qp_ == -1) { |
| 642 return; | 642 return; |
| 643 } | 643 } |
| 644 if (codec_specific_info->codecType == kVideoCodecVP8) { | 644 if (codec_specific_info->codecType == kVideoCodecVP8) { |
| 645 qp_counters_.vp8.Add(encoded_image.qp_); | 645 qp_counters_.vp8.Add(encoded_image.qp_); |
| 646 rtc::CritScope lock(&crit_); | 646 rtc::CritScope lock(&crit_); |
| 647 qp_sample_.Add(encoded_image.qp_); | 647 qp_sample_.Add(encoded_image.qp_); |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 | 650 |
| 651 void ReceiveStatisticsProxy::OnStreamInactive() { |
| 652 // TODO(sprang): Figure out any other state that should be reset. |
| 653 |
| 654 rtc::CritScope lock(&crit_); |
| 655 // Don't report inter-frame delay if stream was paused. |
| 656 last_decoded_frame_time_ms_.reset(); |
| 657 } |
| 658 |
| 651 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) { | 659 void ReceiveStatisticsProxy::SampleCounter::Add(int sample) { |
| 652 sum += sample; | 660 sum += sample; |
| 653 ++num_samples; | 661 ++num_samples; |
| 654 } | 662 } |
| 655 | 663 |
| 656 int ReceiveStatisticsProxy::SampleCounter::Avg( | 664 int ReceiveStatisticsProxy::SampleCounter::Avg( |
| 657 int64_t min_required_samples) const { | 665 int64_t min_required_samples) const { |
| 658 if (num_samples < min_required_samples || num_samples == 0) | 666 if (num_samples < min_required_samples || num_samples == 0) |
| 659 return -1; | 667 return -1; |
| 660 return static_cast<int>(sum / num_samples); | 668 return static_cast<int>(sum / num_samples); |
| 661 } | 669 } |
| 662 | 670 |
| 663 void ReceiveStatisticsProxy::SampleCounter::Reset() { | 671 void ReceiveStatisticsProxy::SampleCounter::Reset() { |
| 664 num_samples = 0; | 672 num_samples = 0; |
| 665 sum = 0; | 673 sum = 0; |
| 666 } | 674 } |
| 667 | 675 |
| 668 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, | 676 void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms, |
| 669 int64_t max_rtt_ms) { | 677 int64_t max_rtt_ms) { |
| 670 rtc::CritScope lock(&crit_); | 678 rtc::CritScope lock(&crit_); |
| 671 avg_rtt_ms_ = avg_rtt_ms; | 679 avg_rtt_ms_ = avg_rtt_ms; |
| 672 } | 680 } |
| 673 | 681 |
| 674 } // namespace webrtc | 682 } // namespace webrtc |
| OLD | NEW |