Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/delay_peak_detector.h |
| diff --git a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h |
| index 69433b452489fe552ba48f43b1953b06a9e23058..5da1c40aad2ee07a946cb8aed703dc32c8af0b8f 100644 |
| --- a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h |
| +++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h |
| @@ -16,12 +16,13 @@ |
| #include <list> |
| #include "webrtc/base/constructormagic.h" |
| +#include "webrtc/modules/audio_coding/neteq/tick_timer.h" |
| namespace webrtc { |
| class DelayPeakDetector { |
| public: |
| - DelayPeakDetector(); |
| + DelayPeakDetector(const TickTimer* tick_timer); |
| virtual ~DelayPeakDetector(); |
| virtual void Reset(); |
| @@ -33,24 +34,20 @@ class DelayPeakDetector { |
| // recently. |
| virtual bool peak_found(); |
| - // Calculates and returns the maximum delay peak height. Returns -1 if no |
| - // delay peaks have been observed recently. The unit is number of packets. |
| + // Calculates and returns the maximum delay peak height (strictly larger than |
| + // 0), or 0 if no delay peaks have been observed recently. The unit is number |
| + // of packets. |
| virtual int MaxPeakHeight() const; |
| // Calculates and returns the maximum delay peak distance in ms. |
| // Returns -1 if no delay peaks have been observed recently. |
|
tlegrand-webrtc
2016/04/28 08:32:32
You missed the last comment which says "Returns -1
hlundin-webrtc
2016/04/28 08:44:02
My bad. I modified the comment for MaxPeakHeight()
|
| - virtual int MaxPeakPeriod() const; |
| + virtual uint64_t MaxPeakPeriod() const; |
| // Updates the DelayPeakDetector with a new inter-arrival time (in packets) |
| // and the current target buffer level (needed to decide if a peak is observed |
| // or not). Returns true if peak-mode is active, false if not. |
| virtual bool Update(int inter_arrival_time, int target_level); |
| - // Increments the |peak_period_counter_ms_| with |inc_ms|. Only increments |
| - // the counter if it is non-negative. A negative denotes that no peak has |
| - // been observed. |
| - virtual void IncrementCounter(int inc_ms); |
| - |
| private: |
| static const size_t kMaxNumPeaks = 8; |
| static const size_t kMinPeaksToTrigger = 2; |
| @@ -58,7 +55,7 @@ class DelayPeakDetector { |
| static const int kMaxPeakPeriodMs = 10000; |
| typedef struct { |
| - int period_ms; |
| + uint64_t period_ms; |
| int peak_height_packets; |
| } Peak; |
| @@ -67,7 +64,8 @@ class DelayPeakDetector { |
| std::list<Peak> peak_history_; |
| bool peak_found_; |
| int peak_detection_threshold_; |
| - int peak_period_counter_ms_; |
| + const TickTimer* tick_timer_; |
| + std::unique_ptr<TickTimer::Stopwatch> peak_period_stopwatch_; |
| RTC_DISALLOW_COPY_AND_ASSIGN(DelayPeakDetector); |
| }; |