[FFmpeg-cvslog] avcodec/cuvid: Allow reinitialization of decoder

Philip Langdale git at videolan.org
Sun Oct 23 01:01:06 EEST 2016


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Sat Oct 22 14:31:41 2016 -0700| [ee7d6738ca694872f84ed62dd33342d187d76464] | committer: Philip Langdale

avcodec/cuvid: Allow reinitialization of decoder

In practice, this works fine.

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

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

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 27a4c30..24ade94 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -141,9 +141,11 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
         return 1;
 
     if (ctx->cudecoder) {
-        av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not supported\n");
-        ctx->internal_error = AVERROR(EINVAL);
-        return 0;
+        av_log(avctx, AV_LOG_TRACE, "Re-initializing decoder\n");
+        ctx->internal_error = CHECK_CU(cuvidDestroyDecoder(ctx->cudecoder));
+        if (ctx->internal_error < 0)
+            return 0;
+        ctx->cudecoder = NULL;
     }
 
     if (hwframe_ctx->pool && (



More information about the ffmpeg-cvslog mailing list