From 25eb28c8c211f78dcf9a0dbc90e7d2f4cb4f3608 Mon Sep 17 00:00:00 2001 From: Ivo Creusen Date: Tue, 17 Oct 2017 17:19:14 +0200 Subject: [PATCH] Bugfix for histogram scaling function in NetEq's DelayManager. If the previous value of the histogram is unknown, no scaling should be performed. Without this check a crash would occur. This issue was introduced in https://webrtc-review.googlesource.com/c/src/+/8101, and can only be triggered if the corresponding field trial is set. Bug: webrtc:8381 Change-Id: I6e7cd8e14f6f4cc972fc094f010ecdf5091b2017 Reviewed-on: https://webrtc-review.googlesource.com/12380 Commit-Queue: Ivo Creusen Reviewed-by: Henrik Lundin Cr-Commit-Position: refs/heads/master@{#20336} --- modules/audio_coding/neteq/delay_manager.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/audio_coding/neteq/delay_manager.cc b/modules/audio_coding/neteq/delay_manager.cc index 77a41fd887..44acf81527 100644 --- a/modules/audio_coding/neteq/delay_manager.cc +++ b/modules/audio_coding/neteq/delay_manager.cc @@ -389,6 +389,11 @@ void DelayManager::RegisterEmptyPacket() { DelayManager::IATVector DelayManager::ScaleHistogram(const IATVector& histogram, int old_packet_length, int new_packet_length) { + if (old_packet_length == 0) { + // If we don't know the previous frame length, don't make any changes to the + // histogram. + return histogram; + } RTC_DCHECK_GT(new_packet_length, 0); RTC_DCHECK_EQ(old_packet_length % 10, 0); RTC_DCHECK_EQ(new_packet_length % 10, 0);