ref: ac7490cbac7b5790a3ea2e9f7c8518af24336091
parent: f456150b74e6a86ff8dc9bab2dd114a713ad6f14
author: Gregory Maxwell <greg@xiph.org>
date: Sat Jun 2 18:55:41 EDT 2012
Fix for Opusdec output at 44.1kHz adding a pop at ~1 second. Gainless, 2012, and Ivqcl on Hydrogenaudio reported and helped identify an issue where opusdec was adding a click in 44.1kHz output. This was becaue the loop needed to feed the resampler for >1024 sample input wasn't accounting for the preskip and was putting too many samples into the resampler on the first packet. Eventually the output got ahead of the container granpos and the decoder dropped some samples to catch up. For 1 second pages, the opusenc default, dropped samples happened just about at the 1 second mark.
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -478,8 +478,8 @@
in_len = frame_size-tmp_skip;
out_len = 1024<maxout?1024:maxout;
speex_resampler_process_interleaved_float(resampler, pcm+channels*tmp_skip, &in_len, buf, &out_len);
- pcm += channels*in_len;
- frame_size -= in_len;
+ pcm += channels*(in_len+tmp_skip);
+ frame_size -= in_len+tmp_skip;
} else {
output=pcm+channels*tmp_skip;
out_len=frame_size-tmp_skip;