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

Submitted by Seokjin Hong on Sept. 2, 2018, 12:50 p.m.

Details

Message ID CAF32h+mteXqAkiVzSkBFmPS8jXtj5=AgKYyPGNwfsjq0+dGFGA@mail.gmail.com
State New
Headers show

Commit Message

Seokjin Hong Sept. 2, 2018, 12:50 p.m.
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@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(-)

     ff_update_cur_dts(s, st, st->index_entries[index].timestamp);
--
2.17.1

Patch hide | download patch | download mbox

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;