[PATCH] seek ver slow -> numeric overflow in ov_pcm_seek_page
For large streams or on platforms that do not support 64 bit integers this will effectively result in a linear search which of course make seeks extremly slow.
In the successive approximation search of ov_pcm_seek_page() the expression
bisect=begin +
(target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
may cause an integer overflow, because it multiplies the stream length by the stream size.
I recommend to use floating point arithmetics for this purpose since it is an approximation anyway. Changing the code as follows cures the problem.
bisect=begin
+ (ogg_int64_t)((double)(target-begintime)*(end-begin)/(endtime-begintime))
- CHUNKSIZE;