[FFmpeg-devel] [PATCH] libavformat/matroskadec.c: Fix support seek to non keyframes

Seokjin Hong seokjin.hong.kr at gmail.com
Mon Oct 22 15:36:08 EEST 2018


After a seek with AVSEEK_FLAG_ANY to reach near end of the stream,
matroskadec.c always drops packets which consists of non-keyframe.

Signed-off-by: Seokjin Hong <seokjin.hong.kr at gmail.com>
---
 libavformat/matroskadec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2daa1dba6f..40c33e6d64 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3590,12 +3590,13 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
     matroska->current_id       = 0;
     if (flags & AVSEEK_FLAG_ANY) {
         st->skip_to_keyframe = 0;
+        matroska->skip_to_keyframe = 0;
         matroska->skip_to_timecode = timestamp;
     } else {
         st->skip_to_keyframe = 1;
+        matroska->skip_to_keyframe = 1;
         matroska->skip_to_timecode = st->index_entries[index].timestamp;
     }
-    matroska->skip_to_keyframe = 1;
     matroska->done             = 0;
     matroska->num_levels       = 0;
     ff_update_cur_dts(s, st, st->index_entries[index].timestamp);
-- 
2.13.6 (Apple Git-96)



More information about the ffmpeg-devel mailing list