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

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

Issue 2085233002: NetEq: Fix a bug in DelayPeakDetector causing asserts to trigger (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/delay_peak_detector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32b36b25ef4372a458568e9456018a734e8def0a..71a86ff01378f6c9ce3822b91364c89eea2cae9b 100644
--- a/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector_unittest.cc
@@ -122,4 +122,22 @@ TEST(DelayPeakDetector, DoNotTriggerPeakMode) {
time += 10; // Increase time 10 ms.
}
}
+
+// In situations with reordered packets, the DelayPeakDetector may be updated
+// back-to-back (i.e., without the tick_timer moving) but still with non-zero
+// inter-arrival time. This test is to make sure that this does not cause
+// problems.
+TEST(DelayPeakDetector, ZeroDistancePeaks) {
+ TickTimer tick_timer;
+ DelayPeakDetector detector(&tick_timer);
+ const int kPacketSizeMs = 30;
+ detector.SetPacketAudioLength(kPacketSizeMs);
+
+ const int kTargetBufferLevel = 2; // Define peaks to be iat > 4.
+ const int kInterArrivalTime = 3 * kTargetBufferLevel; // Will trigger a peak.
+ EXPECT_FALSE(detector.Update(kInterArrivalTime, kTargetBufferLevel));
+ EXPECT_FALSE(detector.Update(kInterArrivalTime, kTargetBufferLevel));
+ EXPECT_FALSE(detector.Update(kInterArrivalTime, kTargetBufferLevel));
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_coding/neteq/delay_peak_detector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698