[FFmpeg-cvslog] avcodec/cuvid: Fully re-initialize the parser after a flush.

Philip Langdale git at videolan.org
Sat Sep 17 15:10:46 EEST 2016


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Wed Sep 14 19:56:07 2016 -0700| [8a066697023e3eab3fc6c2bccc5bd0adb07f4579] | committer: Timo Rothenpieler

avcodec/cuvid: Fully re-initialize the parser after a flush.

I'm not really sure how this worked at all before, but we do need to
reinitalize the parser with the stream extradata.

Signed-off-by: Philip Langdale <philipl at overt.org>
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a066697023e3eab3fc6c2bccc5bd0adb07f4579
---

 libavcodec/cuvid.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 19a7772..1310005 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -706,6 +706,7 @@ static void cuvid_flush(AVCodecContext *avctx)
     AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data;
     AVCUDADeviceContext *device_hwctx = device_ctx->hwctx;
     CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx;
+    CUVIDSOURCEDATAPACKET seq_pkt = { 0 };
     int ret;
 
     ctx->ever_flushed = 1;
@@ -736,6 +737,15 @@ static void cuvid_flush(AVCodecContext *avctx)
     if (ret < 0)
         goto error;
 
+    seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
+    seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
+
+    if (seq_pkt.payload && seq_pkt.payload_size) {
+        ret = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &seq_pkt));
+        if (ret < 0)
+            goto error;
+    }
+
     ret = CHECK_CU(cuCtxPopCurrent(&dummy));
     if (ret < 0)
         goto error;



More information about the ffmpeg-cvslog mailing list