Message ID | 1473971779-27524-5-git-send-email-isasi@google.com |
---|---|
State | Accepted |
Commit | b518d809f16359945eded03c2504641a7f497532 |
Headers | show |
On Thu, Sep 15, 2016 at 01:36:18PM -0700, Sasi Inguva wrote: > Signed-off-by: Sasi Inguva <isasi@google.com> > --- > libavformat/utils.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) applied thx [...]
diff --git a/libavformat/utils.c b/libavformat/utils.c index d605a96..f043bae 100644 --- a/libavformat/utils.c +++ b/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;
Signed-off-by: Sasi Inguva <isasi@google.com> --- libavformat/utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+)