[FFmpeg-cvslog] lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with discarded packets.
Sasi Inguva
git at videolan.org
Mon Sep 19 20:58:55 EEST 2016
ffmpeg | branch: master | Sasi Inguva <isasi-at-google.com at ffmpeg.org> | Thu Sep 15 13:36:18 2016 -0700| [b518d809f16359945eded03c2504641a7f497532] | committer: Michael Niedermayer
lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with discarded packets.
Signed-off-by: Sasi Inguva <isasi at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b518d809f16359945eded03c2504641a7f497532
---
libavformat/utils.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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;
More information about the ffmpeg-cvslog
mailing list