diff mbox series

[FFmpeg-devel] libavcodec/qsvdec: skip non-key frame after "seek" function

Message ID 20210219050920.1730759-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel] libavcodec/qsvdec: skip non-key frame after "seek" function
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Chen, Wenbin Feb. 19, 2021, 5:09 a.m. UTC
From: "Chen,Wenbin" <wenbin.chen@intel.com>

Fix #9095. Qsv decoder assume that after calling seek funcion, the first
frame should be key frame. However this is not true for some videos. If
the frame is not key frame after seek(), there will be error. Conditional
statements are added to skip these frame until reading a key frame.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavcodec/qsvdec.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index d10f90a0db..8133406085 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -616,6 +616,13 @@  int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
     }
 
     if (!q->initialized) {
+        
+        /*  skip non-key frame when decoder is reinitialized. 
+        Adding before will skip all the non-key frames so add 
+        it here */
+        if (ret < 0)
+            return ret;
+
         ret = qsv_decode_init_context(avctx, q, &param);
         if (ret < 0)
             goto reinit_fail;