diff mbox

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

Message ID 20181022123608.79954-1-seokjin.hong.kr@gmail.com
State New
Headers show

Commit Message

Seokjin Hong Oct. 22, 2018, 12:36 p.m. UTC
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@gmail.com>
---
 libavformat/matroskadec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Oct. 22, 2018, 7:10 p.m. UTC | #1
2018-10-22 14:36 GMT+02:00, Seokjin Hong <seokjin.hong.kr@gmail.com>:
> After a seek with AVSEEK_FLAG_ANY to reach near end of the stream,
> matroskadec.c always drops packets which consists of non-keyframe.

I believe the current behaviour is expected unless seek2any flag was set.

Carl Eugen
diff mbox

Patch

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);