lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with discarded packets.
Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2dbedc20ce
commit
b518d809f1
@ -1937,6 +1937,16 @@ int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
|
||||
|
||||
while (b - a > 1) {
|
||||
m = (a + b) >> 1;
|
||||
|
||||
// Search for the next non-discarded packet.
|
||||
while ((entries[m].flags & AVINDEX_DISCARD_FRAME) && m < b) {
|
||||
m++;
|
||||
if (m == b && entries[m].timestamp >= wanted_timestamp) {
|
||||
m = b - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
timestamp = entries[m].timestamp;
|
||||
if (timestamp >= wanted_timestamp)
|
||||
b = m;
|
||||
|
Loading…
x
Reference in New Issue
Block a user