X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fvorbisfile.c;h=e00087a181efbb98e74b3dd81017081ab5cf2640;hb=d61e0b2a8ae2d8743c9807bf7aa6896151ccec7f;hp=1b7f80aac0b233b7f51dd36ffbf8670a2ea402f0;hpb=e2af029c5be18243bf9ad6009ab3bc4579c8bd67;p=platform%2Fupstream%2Flibvorbis.git diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index 1b7f80a..e00087a 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -438,9 +438,11 @@ static ogg_int64_t _initial_pcmoffset(OggVorbis_File *vf, vorbis_info *vi){ while((result=ogg_stream_packetout(&vf->os,&op))){ if(result>0){ /* ignore holes */ long thisblock=vorbis_packet_blocksize(vi,&op); - if(lastblock!=-1) - accumulated+=(lastblock+thisblock)>>2; - lastblock=thisblock; + if(thisblock>=0){ + if(lastblock!=-1) + accumulated+=(lastblock+thisblock)>>2; + lastblock=thisblock; + } } } @@ -1437,8 +1439,21 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){ ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime; ogg_int64_t target=pos-total+begintime; ogg_int64_t best=-1; + int got_page=0; ogg_page og; + + /* if we have only one page, there will be no bisection. Grab the page here */ + if(begin==end){ + result=_seek_helper(vf,begin); + if(result) goto seek_error; + + result=_get_next_page(vf,&og,1); + if(result<0) goto seek_error; + + got_page=1; + } + /* bisection loop */ while(begindataoffsets[link] && + if(got_page && + begin == vf->dataoffsets[link] && ogg_page_serialno(&og)==vf->serialnos[link]){ /* Yes, this is the beginning-of-stream case. We already have