ref: cf6f6c7c9f0eaba9302fc7d0e385268fb73c0305
parent: 8e4c06e00773c0bcf0c1076686f7cc3fe53a7e3e
author: Jean-Marc Valin <[email protected]>
date: Wed Aug 3 13:45:57 EDT 2011
Adding code to drain the resampler Makes (sort of) gapless playback possible on resampled files
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -632,7 +632,26 @@
break;
}
-
+
+ /* Drain the resampler */
+ if (resampler)
+ {
+ int i;
+ opus_int16 zeros[200];
+ int drain;
+
+ for (i=0;i<200;i++)
+ zeros[i] = 200;
+ drain = speex_resampler_get_input_latency(resampler);
+ do {
+ int tmp = drain;
+ if (tmp > 100)
+ tmp = 100;
+ audio_write(zeros, channels, tmp, fout, resampler);
+ drain -= tmp;
+ } while (drain>0);
+ }
+
if (fout && wav_format)
{
if (fseek(fout,4,SEEK_SET)==0)