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>
pull/210/merge
Sasi Inguva 8 years ago committed by Michael Niedermayer
parent 2dbedc20ce
commit b518d809f1
  1. 10
      libavformat/utils.c

@ -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…
Cancel
Save