changeset 19383:0a6382b5b6ee

Change pcm decode_audio to return data based on minlen instead of maxlen to avoid demuxing unnecessarily much at once.
author uau
date Sun, 13 Aug 2006 23:09:17 +0000
parents 7c6c205b88b6
children 8469056e77e8
files libmpcodecs/ad_pcm.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_pcm.c	Sun Aug 13 22:14:32 2006 +0000
+++ b/libmpcodecs/ad_pcm.c	Sun Aug 13 23:09:17 2006 +0000
@@ -120,7 +120,11 @@
 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
 {
   unsigned len = sh_audio->channels*sh_audio->samplesize;
-  len = maxlen - maxlen % len; // sample align
+  len = (minlen + len - 1) / len * len;
+  if (len > maxlen)
+      // if someone needs hundreds of channels adjust audio_out_minsize
+      // based on channels in preinit()
+      return -1;
   len=demux_read_data(sh_audio->ds,buf,len);
   return len;
 }