[MPlayer-cvslog] r19389 - trunk/libmpcodecs/ad_pcm.c

uau subversion at mplayerhq.hu
Mon Aug 14 01:09:17 CEST 2006


Author: uau
Date: Mon Aug 14 01:09:17 2006
New Revision: 19389

Modified:
   trunk/libmpcodecs/ad_pcm.c

Log:
Change pcm decode_audio to return data based on minlen instead of maxlen
to avoid demuxing unnecessarily much at once.


Modified: trunk/libmpcodecs/ad_pcm.c
==============================================================================
--- trunk/libmpcodecs/ad_pcm.c	(original)
+++ trunk/libmpcodecs/ad_pcm.c	Mon Aug 14 01:09:17 2006
@@ -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;
 }



More information about the MPlayer-cvslog mailing list