OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 16 matching lines...) Expand all Loading... |
27 : ignored_sample_count_(0), filter_(kPercentile) {} | 27 : ignored_sample_count_(0), filter_(kPercentile) {} |
28 | 28 |
29 void VCMCodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) { | 29 void VCMCodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) { |
30 // Ignore the first |kIgnoredSampleCount| samples. | 30 // Ignore the first |kIgnoredSampleCount| samples. |
31 if (ignored_sample_count_ < kIgnoredSampleCount) { | 31 if (ignored_sample_count_ < kIgnoredSampleCount) { |
32 ++ignored_sample_count_; | 32 ++ignored_sample_count_; |
33 return; | 33 return; |
34 } | 34 } |
35 | 35 |
36 // Insert new decode time value. | 36 // Insert new decode time value. |
37 filter_.Insert(decode_time_ms); | 37 filter_.Push(decode_time_ms); |
38 history_.emplace(decode_time_ms, now_ms); | 38 history_.emplace(decode_time_ms, now_ms); |
39 | 39 |
40 // Pop old decode time values. | 40 // Pop old decode time values. |
41 while (!history_.empty() && | 41 while (!history_.empty() && |
42 now_ms - history_.front().sample_time_ms > kTimeLimitMs) { | 42 now_ms - history_.front().sample_time_ms > kTimeLimitMs) { |
43 filter_.Erase(history_.front().decode_time_ms); | 43 filter_.Pop(); |
44 history_.pop(); | 44 history_.pop(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 // Get the 95th percentile observed decode time within a time window. | 48 // Get the 95th percentile observed decode time within a time window. |
49 int64_t VCMCodecTimer::RequiredDecodeTimeMs() const { | 49 int64_t VCMCodecTimer::RequiredDecodeTimeMs() const { |
50 return filter_.GetPercentileValue(); | 50 return filter_.GetPercentileValue(); |
51 } | 51 } |
52 | 52 |
53 VCMCodecTimer::Sample::Sample(int64_t decode_time_ms, int64_t sample_time_ms) | 53 VCMCodecTimer::Sample::Sample(int64_t decode_time_ms, int64_t sample_time_ms) |
54 : decode_time_ms(decode_time_ms), sample_time_ms(sample_time_ms) {} | 54 : decode_time_ms(decode_time_ms), sample_time_ms(sample_time_ms) {} |
55 | 55 |
56 } // namespace webrtc | 56 } // namespace webrtc |
OLD | NEW |