Add NetEq config flag that enables RTX handling.
When enabled, the delay manager is updated with reordered packets. It also makes the peak detector ignore the reordered packets.
Change-Id: I2bdc99764cc76b15e613ed3dc75f83aaf66eee4e
Bug: webrtc:10178
Reviewed-on: https://webrtc-review.googlesource.com/c/116481
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26187}
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index e1b3bc1..00c9172 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -61,7 +61,8 @@
buffer_level_filter(new BufferLevelFilter),
decoder_database(
new DecoderDatabase(decoder_factory, config.codec_pair_id)),
- delay_peak_detector(new DelayPeakDetector(tick_timer.get())),
+ delay_peak_detector(
+ new DelayPeakDetector(tick_timer.get(), config.enable_rtx_handling)),
delay_manager(new DelayManager(config.max_packets_in_buffer,
config.min_delay_ms,
delay_peak_detector.get(),
@@ -112,7 +113,8 @@
speech_expand_uma_logger_("WebRTC.Audio.SpeechExpandRatePercent",
10, // Report once every 10 s.
tick_timer_.get()),
- no_time_stretching_(config.for_test_no_time_stretching) {
+ no_time_stretching_(config.for_test_no_time_stretching),
+ enable_rtx_handling_(config.enable_rtx_handling) {
RTC_LOG(LS_INFO) << "NetEq config: " << config.ToString();
int fs = config.sample_rate_hz;
if (fs != 8000 && fs != 16000 && fs != 32000 && fs != 48000) {
@@ -737,9 +739,11 @@
}
// Update statistics.
- if ((int32_t)(main_timestamp - timestamp_) >= 0 && !new_codec_) {
+ if ((enable_rtx_handling_ || (int32_t)(main_timestamp - timestamp_) >= 0) &&
+ !new_codec_) {
// Only update statistics if incoming packet is not older than last played
- // out packet, and if new codec flag is not set.
+ // out packet or RTX handling is enabled, and if new codec flag is not
+ // set.
delay_manager_->Update(main_sequence_number, main_timestamp, fs_hz_);
}
} else if (delay_manager_->last_pack_cng_or_dtmf() == -1) {