[xiph-commits] r13794 - trunk/Tremor

msmith at svn.xiph.org msmith at svn.xiph.org
Thu Sep 13 16:01:16 PDT 2007


Author: msmith
Date: 2007-09-13 16:01:16 -0700 (Thu, 13 Sep 2007)
New Revision: 13794

Modified:
   trunk/Tremor/vorbisfile.c
Log:
Calculate number of samples correctly for any number of channels, so we don't
overrun our destination array for > 2 channels.


Modified: trunk/Tremor/vorbisfile.c
===================================================================
--- trunk/Tremor/vorbisfile.c	2007-09-13 01:59:33 UTC (rev 13793)
+++ trunk/Tremor/vorbisfile.c	2007-09-13 23:01:16 UTC (rev 13794)
@@ -1564,13 +1564,8 @@
     
     long channels=ov_info(vf,-1)->channels;
 
-    if(channels==1){
-      if(samples>(bytes_req/2))
-        samples=bytes_req/2;      
-    }else{
-      if(samples>(bytes_req/4))
-        samples=bytes_req/4;
-    }
+    if(samples>(bytes_req/(2*channels)))
+      samples=bytes_req/(2*channels);      
     
     for(i=0;i<channels;i++) { /* It's faster in this order */
       ogg_int32_t *src=pcm[i];



More information about the commits mailing list