Added experiment to improve handling of frame length changes in NetEq.
The field trial effects two things: after a frame length change the IAT
histogram is scaled to prevent an immediate change in target buffer
level. Also, the peak history in the delay peak detector is cleared,
because the size of the peaks is stored in number of packets (which
will be incorrect after a frame length change).
Bug: webrtc:8381
Change-Id: I214b990f6e5959b655b6542884a7f75da181a0d8
Reviewed-on: https://webrtc-review.googlesource.com/8101
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20284}
diff --git a/modules/audio_coding/neteq/delay_manager.h b/modules/audio_coding/neteq/delay_manager.h
index b7cdab3..0de03fc 100644
--- a/modules/audio_coding/neteq/delay_manager.h
+++ b/modules/audio_coding/neteq/delay_manager.h
@@ -100,6 +100,13 @@
// packet will shift the sequence numbers for the following packets.
virtual void RegisterEmptyPacket();
+ // Apply compression or stretching to the IAT histogram, for a change in frame
+ // size. This returns an updated histogram. This function is public for
+ // testability.
+ static IATVector ScaleHistogram(const IATVector& histogram,
+ int old_packet_length,
+ int new_packet_length);
+
// Accessors and mutators.
// Assuming |delay| is in valid range.
virtual bool SetMinimumDelay(int delay_ms);
@@ -166,6 +173,7 @@
std::unique_ptr<TickTimer::Stopwatch> max_iat_stopwatch_;
DelayPeakDetector& peak_detector_;
int last_pack_cng_or_dtmf_;
+ const bool frame_length_change_experiment_;
RTC_DISALLOW_COPY_AND_ASSIGN(DelayManager);
};