X-Git-Url: https://git.libav.org/?p=libav.git;a=blobdiff_plain;f=libavcodec%2Fnvenc.c;h=c151ad50556acb86a52d2a21b57e7c1fa19268f1;hp=02cb8b42254ef3b8e8810f0c019aca4fe9845c71;hb=aac7d6b284c3976eb0c48d61f342f008fb6e4103;hpb=ee359c72ef8735122929da96006565e1558f1e55;ds=sidebyside diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 02cb8b4225..c151ad5055 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -825,6 +825,14 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx) NV_ENCODE_API_FUNCTION_LIST *nv = &ctx->nvel.nvenc_funcs; int i; + /* the encoder has to be flushed before it can be closed */ + if (ctx->nvenc_ctx) { + NV_ENC_PIC_PARAMS params = { .version = NV_ENC_PIC_PARAMS_VER, + .encodePicFlags = NV_ENC_PIC_FLAG_EOS }; + + nv->nvEncEncodePicture(ctx->nvenc_ctx, ¶ms); + } + av_fifo_free(ctx->timestamps); av_fifo_free(ctx->pending); av_fifo_free(ctx->ready);