[FFmpeg-devel] [PATCH] avcodec/cuvid: Use a dummy packet to flush cuvid.

Wiki Wang wikiwang at live.com
Tue May 16 11:27:33 EEST 2017


---
 libavcodec/cuvid.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 218be8495d..0b1710bd46 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -1029,20 +1029,13 @@ static void cuvid_flush(AVCodecContext *avctx)
         return;
     }
 
-    if (ctx->cudecoder) {
-        ctx->cvdl->cuvidDestroyDecoder(ctx->cudecoder);
-        ctx->cudecoder = NULL;
-    }
+    seq_pkt.flags = CUVID_PKT_ENDOFSTREAM;
 
-    if (ctx->cuparser) {
-        ctx->cvdl->cuvidDestroyVideoParser(ctx->cuparser);
-        ctx->cuparser = NULL;
-    }
-
-    ret = CHECK_CU(ctx->cvdl->cuvidCreateVideoParser(&ctx->cuparser, &ctx->cuparseinfo));
+    ret = CHECK_CU(ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &seq_pkt));
     if (ret < 0)
         goto error;
 
+    seq_pkt.flags = 0;
     seq_pkt.payload = ctx->cuparse_ext.raw_seqhdr_data;
     seq_pkt.payload_size = ctx->cuparse_ext.format.seqhdr_data_length;
 
-- 
2.12.2.windows.2



More information about the ffmpeg-devel mailing list