Limiting increment in timestamps with neteq simulation.

Bug: None
Change-Id: I9a0688bcf1c887793b5c94ea023b025aed7366a5
Reviewed-on: https://webrtc-review.googlesource.com/74840
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23733}
This commit is contained in:
Minyue Li
2018-06-21 15:30:17 +02:00
committed by Commit Bot
parent 44b98f9917
commit f7789c6e89

View File

@ -37,8 +37,10 @@ int FakeDecodeFromFile::DecodeInternal(const uint8_t* encoded,
ByteReader<uint32_t>::ReadLittleEndian(encoded);
uint32_t samples_to_decode =
ByteReader<uint32_t>::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.