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

Unified Diff: webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc

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_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc b/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc
index c40f3991b04fe6e8f2150ceb02eb7280195d9f83..32b36b25ef4372a458568e9456018a734e8def0a 100644
--- a/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc
@@ -17,22 +17,25 @@
namespace webrtc {
TEST(DelayPeakDetector, CreateAndDestroy) {
- DelayPeakDetector* detector = new DelayPeakDetector();
+ TickTimer tick_timer;
+ DelayPeakDetector* detector = new DelayPeakDetector(&tick_timer);
EXPECT_FALSE(detector->peak_found());
delete detector;
}
TEST(DelayPeakDetector, EmptyHistory) {
- DelayPeakDetector detector;
+ TickTimer tick_timer;
+ DelayPeakDetector detector(&tick_timer);
EXPECT_EQ(-1, detector.MaxPeakHeight());
- EXPECT_EQ(-1, detector.MaxPeakPeriod());
+ EXPECT_EQ(0u, detector.MaxPeakPeriod());
}
// Inject a series of packet arrivals into the detector. Three of the packets
// have suffered delays. After the third delay peak, peak-mode is expected to
// start. This should then continue until it is disengaged due to lack of peaks.
TEST(DelayPeakDetector, TriggerPeakMode) {
- DelayPeakDetector detector;
+ TickTimer tick_timer;
+ DelayPeakDetector detector(&tick_timer);
const int kPacketSizeMs = 30;
detector.SetPacketAudioLength(kPacketSizeMs);
@@ -52,7 +55,7 @@ TEST(DelayPeakDetector, TriggerPeakMode) {
// Third delay peak. Trigger peak-mode after this packet.
arrival_times_ms[400] += kPeakDelayMs;
// The second peak period is the longest, 200 packets.
- const int kWorstPeakPeriod = 200 * kPacketSizeMs;
+ const uint64_t kWorstPeakPeriod = 200 * kPacketSizeMs;
int peak_mode_start_ms = arrival_times_ms[400];
// Expect to disengage after no peaks are observed for two period times.
int peak_mode_end_ms = peak_mode_start_ms + 2 * kWorstPeakPeriod;
@@ -74,7 +77,7 @@ TEST(DelayPeakDetector, TriggerPeakMode) {
}
++next;
}
- detector.IncrementCounter(10);
+ tick_timer.Increment();
time += 10; // Increase time 10 ms.
}
}
@@ -83,7 +86,8 @@ TEST(DelayPeakDetector, TriggerPeakMode) {
// 2, in order to raise the bar for delay peaks to inter-arrival times > 4.
// The delay pattern has peaks with delay = 3, thus should not trigger.
TEST(DelayPeakDetector, DoNotTriggerPeakMode) {
- DelayPeakDetector detector;
+ TickTimer tick_timer;
+ DelayPeakDetector detector(&tick_timer);
const int kPacketSizeMs = 30;
detector.SetPacketAudioLength(kPacketSizeMs);
@@ -114,7 +118,7 @@ TEST(DelayPeakDetector, DoNotTriggerPeakMode) {
EXPECT_FALSE(detector.Update(iat_packets, kTargetBufferLevel));
++next;
}
- detector.IncrementCounter(10);
+ tick_timer.Increment();
time += 10; // Increase time 10 ms.
}
}

Powered by Google App Engine
This is Rietveld 408576698