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

Seokjin Hong seokjin.hong.kr at gmail.com
Sun Sep 2 15:50:25 EEST 2018


In previous commit from 7c00d853a65884870e2a7a916197d87c125ed630,
It looks like adjust skip_to_keyframe param to support seek to non
keyframes.

But this code seems to avoid adjust matroska->skip_to_keyframe param.
It always set to 1 without considering AVSEEK_FLAG_ANY flag.

I don't think this code is what you intended.

Please check this patch or explain the reason why matroska->skip_to_keyframe
is always set to 1.

Regards.
------------------------------------------------------------------------------------------

>From 0b35c837ce61d87a4e74865c0d968b258a7c76c3 Mon Sep 17 00:00:00 2001
From: Seokjin Hong <seokjin.hong.kr at gmail.com>
Date: Sun, 2 Sep 2018 21:37:06 +0900
Subject: [PATCH] avformat/matroskadec.c: Fix support seek to non keyframes

---
 libavformat/matroskadec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index e6793988e1..b66fcec4a5 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.17.1


More information about the ffmpeg-devel mailing list