Re: [libvorbis] Bugfix: seek broken for large files and on pure 32 bit architectures

Erik de Castro Lopo <[email protected]>
Newsgroups gmane.comp.multimedia.ogg.vorbis.devel
Organization Erik Conspiracy Secret Labs
Message-ID <[email protected]>
Hi all,

This has been sitting here for a while. Anyone see any obvious
prblems with this? If not, I will test it and commit it if it
seems to work ok.

Cheers,
Erik

Marcel Müller wrote:

> In file vorbisfile.c, function
> 
>    int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos)
> 
> the calculation of the approximate seek point causes an overflow for
> very large files and on pure 32 bit architectures.
> 
>    /* take a (pretty decent) guess. */
>    bisect=begin +
>      (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
> 
> The temporary expression (target-begintime)*(end-begin) grows with the
> square of the file size. This effectively limits the file size to the
> square root of the maximum value of ogg_int64_t. In consequence the file
> is scanned from the very beginning which is pretty slow over a network.
> 
> 
> FIX:
> 
>    bisect=begin +
> (ogg_int64_t)((double)(target-begintime)*(end-begin)/(endtime-begintime))
> - CHUNKSIZE;
> 
> Since it is an approximation anyway, the calculation should be done
> using floating point arithmetics.
> 
> 
> Marcel
> 
> _______________________________________________
> Vorbis-dev mailing list
> [email protected]
> http://lists.xiph.org/mailman/listinfo/vorbis-dev


-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Everything that I've learned about computers I have boiled
down into three principles:
  PC/Windows: You think it won't work, and it won't.
  Macintosh: You think it will work, but it won't.
  Unix: You think it won't work, but if you find the right
        guru, you can make it work.
_______________________________________________
Vorbis-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/vorbis-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.