Avoid zero duration packets in NetEq test with replacement audio.

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‎ <jakobi@webrtc.org>
Reviewed-by: Henrik Lundin <hlundin@google.com>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41669}
This commit is contained in:
Jakob Ivarsson 2024-02-05 15:03:58 +01:00 committed by WebRTC LUCI CQ
parent 5b90b963de
commit 5ff04d1b60

View file

@ -107,7 +107,7 @@ void NetEqReplacementInput::ReplacePacket() {
next_hdr->timestamp - packet_->header.timestamp; next_hdr->timestamp - packet_->header.timestamp;
const bool opus_dtx = packet_->payload.size() <= 2; const bool opus_dtx = packet_->payload.size() <= 2;
if (next_hdr->sequenceNumber == packet_->header.sequenceNumber + 1 && 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. // Packets are in order and the timestamp diff is less than 5760 samples.
// Accept the timestamp diff as a valid frame size. // Accept the timestamp diff as a valid frame size.
input_frame_size_timestamps = timestamp_diff; input_frame_size_timestamps = timestamp_diff;