Commit 0a274ec1 authored by Monty's avatar Monty
Browse files

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
parent 3efb9e12
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment