From f7789c6e89586ad5ee4004ca6aeda505e14aba3a Mon Sep 17 00:00:00 2001 From: Minyue Li Date: Thu, 21 Jun 2018 15:30:17 +0200 Subject: [PATCH] Limiting increment in timestamps with neteq simulation. Bug: None Change-Id: I9a0688bcf1c887793b5c94ea023b025aed7366a5 Reviewed-on: https://webrtc-review.googlesource.com/74840 Reviewed-by: Ivo Creusen Commit-Queue: Minyue Li Cr-Commit-Position: refs/heads/master@{#23733} --- modules/audio_coding/neteq/tools/fake_decode_from_file.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/audio_coding/neteq/tools/fake_decode_from_file.cc b/modules/audio_coding/neteq/tools/fake_decode_from_file.cc index f4376088b8..b0345b08b2 100644 --- a/modules/audio_coding/neteq/tools/fake_decode_from_file.cc +++ b/modules/audio_coding/neteq/tools/fake_decode_from_file.cc @@ -37,8 +37,10 @@ int FakeDecodeFromFile::DecodeInternal(const uint8_t* encoded, ByteReader::ReadLittleEndian(encoded); uint32_t samples_to_decode = ByteReader::ReadLittleEndian(&encoded[4]); - if (samples_to_decode == 0) { - // Number of samples in packet is unknown. + if (samples_to_decode == 0 || + samples_to_decode % rtc::CheckedDivExact(sample_rate_hz, 100) != 0) { + // Number of samples being zero or non-multiple of 10ms is considered + // erroneous. if (last_decoded_length_ > 0) { // Use length of last decoded packet, but since this is the total for all // channels, we have to divide by 2 in the stereo case.