[xiph-commits] r17012 - trunk/vorbis/lib

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Mar 24 00:37:36 PDT 2010


Author: xiphmont
Date: 2010-03-24 00:37:36 -0700 (Wed, 24 Mar 2010)
New Revision: 17012

Modified:
   trunk/vorbis/lib/vorbisfile.c
Log:
Vorbisfile was always reading very large chunks; a good idea for 
seeking/local file playback, a very bad idea for low-rate streaming.

The large chunksize wasn't needed for read performance, just 
seek-and-scrub performance.  So add a seperate smaller read size.



Modified: trunk/vorbis/lib/vorbisfile.c
===================================================================
--- trunk/vorbis/lib/vorbisfile.c	2010-03-24 06:48:31 UTC (rev 17011)
+++ trunk/vorbis/lib/vorbisfile.c	2010-03-24 07:37:36 UTC (rev 17012)
@@ -61,14 +61,15 @@
 
 /* read a little more data from the file/pipe into the ogg_sync framer
 */
-#define CHUNKSIZE 65536
+#define CHUNKSIZE 65536 /* greater-than-page-size granularity seeking */
+#define READSIZE 2048 /* a smaller read size is needed for low-rate streaming. */
 
 static long _get_data(OggVorbis_File *vf){
   errno=0;
   if(!(vf->callbacks.read_func))return(-1);
   if(vf->datasource){
-    char *buffer=ogg_sync_buffer(&vf->oy,CHUNKSIZE);
-    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
+    char *buffer=ogg_sync_buffer(&vf->oy,READSIZE);
+    long bytes=(vf->callbacks.read_func)(buffer,1,READSIZE,vf->datasource);
     if(bytes>0)ogg_sync_wrote(&vf->oy,bytes);
     if(bytes==0 && errno)return(-1);
     return(bytes);



More information about the commits mailing list