mirror of
https://github.com/nothings/stb
synced 2025-01-19 04:39:17 +03:00
stb_vorbis: fix theoretical seek performance problem
This commit is contained in:
parent
052dce117e
commit
6ca87a9e0e
18
stb_vorbis.c
18
stb_vorbis.c
@ -4707,14 +4707,16 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we've just found the last page again then we're in a tricky file,
|
// if we've just found the last page again then we're in a tricky file,
|
||||||
// and we're close enough.
|
// and we're close enough (if it wasn't an interpolation probe).
|
||||||
if (mid.page_start == right.page_start)
|
if (mid.page_start == right.page_start) {
|
||||||
break;
|
if (probe >= 2)
|
||||||
|
break;
|
||||||
if (sample_number < mid.last_decoded_sample)
|
} else {
|
||||||
right = mid;
|
if (last_sample_limit < mid.last_decoded_sample)
|
||||||
else
|
right = mid;
|
||||||
left = mid;
|
else
|
||||||
|
left = mid;
|
||||||
|
}
|
||||||
|
|
||||||
++probe;
|
++probe;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user