mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-18 14:54:19 +08:00
Add special case to avoid binary search when appending index entries.
Originally committed as revision 22400 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -1305,6 +1305,10 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
|
|||||||
a = - 1;
|
a = - 1;
|
||||||
b = nb_entries;
|
b = nb_entries;
|
||||||
|
|
||||||
|
//optimize appending index entries at the end
|
||||||
|
if(b && entries[b-1].timestamp < wanted_timestamp)
|
||||||
|
a= b-1;
|
||||||
|
|
||||||
while (b - a > 1) {
|
while (b - a > 1) {
|
||||||
m = (a + b) >> 1;
|
m = (a + b) >> 1;
|
||||||
timestamp = entries[m].timestamp;
|
timestamp = entries[m].timestamp;
|
||||||
|
Reference in New Issue
Block a user