From 5ff04d1b60677e2de86fd99b31efe0b18db81def Mon Sep 17 00:00:00 2001 From: Jakob Ivarsson Date: Mon, 5 Feb 2024 15:03:58 +0100 Subject: [PATCH] Avoid zero duration packets in NetEq test with replacement audio. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a crash when the timestamp difference between two packets is zero, which can happen due to probing for example. Bug: none Change-Id: If04dfaed0b10aecd7b1a1e5487161c2d82ad9e44 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338020 Commit-Queue: Jakob Ivarsson‎ Reviewed-by: Henrik Lundin Reviewed-by: Henrik Lundin Cr-Commit-Position: refs/heads/main@{#41669} --- modules/audio_coding/neteq/tools/neteq_replacement_input.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/audio_coding/neteq/tools/neteq_replacement_input.cc b/modules/audio_coding/neteq/tools/neteq_replacement_input.cc index 081bd9631f..f1a46cd2df 100644 --- a/modules/audio_coding/neteq/tools/neteq_replacement_input.cc +++ b/modules/audio_coding/neteq/tools/neteq_replacement_input.cc @@ -107,7 +107,7 @@ void NetEqReplacementInput::ReplacePacket() { next_hdr->timestamp - packet_->header.timestamp; const bool opus_dtx = packet_->payload.size() <= 2; if (next_hdr->sequenceNumber == packet_->header.sequenceNumber + 1 && - timestamp_diff <= 120 * 48 && !opus_dtx) { + timestamp_diff <= 120 * 48 && timestamp_diff > 0 && !opus_dtx) { // Packets are in order and the timestamp diff is less than 5760 samples. // Accept the timestamp diff as a valid frame size. input_frame_size_timestamps = timestamp_diff;