Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: webrtc/modules/audio_coding/neteq/delay_peak_detector.h

Issue 1921163003: NetEq: Introduce TickTimer in DelayPeakDetector (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@packet-tick-timer
Patch Set: Correcting the function comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..060e2e13d36c3d93ca019130cccfda884e529c5a 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();
@@ -37,20 +38,15 @@ class DelayPeakDetector {
// 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.
- virtual int MaxPeakPeriod() const;
+ // Calculates and returns the maximum delay peak distance in ms (strictly
+ // larger than 0), or 0 if no delay peaks have been observed recently.
+ 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 +54,7 @@ class DelayPeakDetector {
static const int kMaxPeakPeriodMs = 10000;
typedef struct {
- int period_ms;
+ uint64_t period_ms;
int peak_height_packets;
} Peak;
@@ -67,7 +63,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);
};
« no previous file with comments | « webrtc/modules/audio_coding/neteq/delay_manager_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/delay_peak_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698