changeset 20752:0617c67ad68f

Fix code that cuts audio data if the filters produce too much. It incorrectly used the channel count and sample size values from the decoder even though the filters can change those.
author uau
date Tue, 07 Nov 2006 23:16:55 +0000
parents 3dbb3fa4e5fc
children f61f0fc6ee8d
files libmpcodecs/dec_audio.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Tue Nov 07 23:06:42 2006 +0000
+++ b/libmpcodecs/dec_audio.c	Tue Nov 07 23:16:55 2006 +0000
@@ -415,7 +415,8 @@
   
   // copy filter==>out:
   if(maxlen < pafd->len) {
-    maxlen -= maxlen % (sh_audio->channels * sh_audio->samplesize);
+    af_stream_t *afs = sh_audio->afilter;
+    maxlen -= maxlen % (afs->output.nch * afs->output.bps);
     mp_msg(MSGT_DECAUDIO,MSGL_WARN,"%i bytes of audio data lost due to buffer overflow, len = %i\n", pafd->len - maxlen,pafd->len);
   }
   else