Commit 2862e2ea authored by Timothy B. Terriberry's avatar Timothy B. Terriberry

Fix seeking near the start of saved live streams.

If a stream starts with a non-zero granpos, we would subtract 80 ms
 from the target time, and then report failure when the best page
 we could find (the first page in the link) had a granpos larger
 than that.
This worked for normal streams because the subtraction would fail
 (granpos can't wrap past -1) and we checked for that.
parent 14da0dd2
......@@ -2194,7 +2194,8 @@ static int op_pcm_seek_page(OggOpusFile *_of,
/*We discard the first 80 ms of data after a seek, so seek back that much
farther.
If we can't, simply seek to the beginning of the link.*/
if(OP_UNLIKELY(op_granpos_add(&_target_gp,_target_gp,-80*48)<0)){
if(OP_UNLIKELY(op_granpos_add(&_target_gp,_target_gp,-80*48)<0)
||OP_UNLIKELY(op_granpos_cmp(_target_gp,pcm_start)<0)){
_target_gp=pcm_start;
}
/*Special case seeking to the start of the link.*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment