From 0a274ec153484420081f153ebb8a22a8b97b74ff Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 24 Mar 2010 07:37:36 +0000 Subject: [PATCH] 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. svn path=/trunk/vorbis/; revision=17012 --- lib/vorbisfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index b0d884a..c2ef280 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -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); -- 2.7.4