OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" | 11 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" |
12 | 12 |
13 #include <algorithm> // max | 13 #include <algorithm> // max |
14 | 14 |
15 #include "webrtc/rtc_base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/rtc_base/safe_conversions.h" | 16 #include "webrtc/base/safe_conversions.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 // The DelayPeakDetector keeps track of severe inter-arrival times, called | 20 // The DelayPeakDetector keeps track of severe inter-arrival times, called |
21 // delay peaks. When a peak is observed, the "height" (the time elapsed since | 21 // delay peaks. When a peak is observed, the "height" (the time elapsed since |
22 // the previous packet arrival) and the peak "period" (the time since the last | 22 // the previous packet arrival) and the peak "period" (the time since the last |
23 // observed peak) is recorded in a vector. When enough peaks have been observed, | 23 // observed peak) is recorded in a vector. When enough peaks have been observed, |
24 // peak-mode is engaged and the DelayManager asks the DelayPeakDetector for | 24 // peak-mode is engaged and the DelayManager asks the DelayPeakDetector for |
25 // the worst peak height. | 25 // the worst peak height. |
26 | 26 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 size_t s = peak_history_.size(); | 109 size_t s = peak_history_.size(); |
110 if (s >= kMinPeaksToTrigger && | 110 if (s >= kMinPeaksToTrigger && |
111 peak_period_stopwatch_->ElapsedMs() <= 2 * MaxPeakPeriod()) { | 111 peak_period_stopwatch_->ElapsedMs() <= 2 * MaxPeakPeriod()) { |
112 peak_found_ = true; | 112 peak_found_ = true; |
113 } else { | 113 } else { |
114 peak_found_ = false; | 114 peak_found_ = false; |
115 } | 115 } |
116 return peak_found_; | 116 return peak_found_; |
117 } | 117 } |
118 } // namespace webrtc | 118 } // namespace webrtc |
OLD | NEW |