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

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Mon Apr 26 01:05:07 PDT 2010


Author: xiphmont
Date: 2010-04-26 01:05:07 -0700 (Mon, 26 Apr 2010)
New Revision: 17176

Modified:
   trunk/vorbis/lib/vorbisfile.c
Log:
Try out a new seek bisect optimization in vorbisfile.



Modified: trunk/vorbis/lib/vorbisfile.c
===================================================================
--- trunk/vorbis/lib/vorbisfile.c	2010-04-26 07:26:57 UTC (rev 17175)
+++ trunk/vorbis/lib/vorbisfile.c	2010-04-26 08:05:07 UTC (rev 17176)
@@ -1427,13 +1427,14 @@
         bisect=begin +
           (ogg_int64_t)((double)(target-begintime)*(end-begin)/(endtime-begintime))
           - CHUNKSIZE;
-        if(bisect<=begin)
-          bisect=begin+1;
+        if(bisect>begin+CHUNKSIZE){
+          result=_seek_helper(vf,bisect);
+          if(result) goto seek_error;
+        }else{
+          bisect=begin;
+        }
       }
 
-      result=_seek_helper(vf,bisect);
-      if(result) goto seek_error;
-
       while(begin<end){
         result=_get_next_page(vf,&og,end-vf->offset);
         if(result==OV_EREAD) goto seek_error;



More information about the commits mailing list