From 03a40b19bf7e5a284ddc0d7416b3068de8adae5a Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 26 Apr 2010 08:05:07 +0000 Subject: [PATCH] Try out a new seek bisect optimization in vorbisfile. svn path=/trunk/vorbis/; revision=17176 --- lib/vorbisfile.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index c2ef280..a3569c9 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -1427,13 +1427,14 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){ 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(beginoffset); if(result==OV_EREAD) goto seek_error; -- 2.7.4