mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-16 11:54:09 +02:00
nvenc: flush the encoder before closing it, as required by the docs
Otherwise, closing the encoder can crash.
This commit is contained in:
parent
ee359c72ef
commit
aac7d6b284
@ -825,6 +825,14 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
|
|||||||
NV_ENCODE_API_FUNCTION_LIST *nv = &ctx->nvel.nvenc_funcs;
|
NV_ENCODE_API_FUNCTION_LIST *nv = &ctx->nvel.nvenc_funcs;
|
||||||
int i;
|
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->timestamps);
|
||||||
av_fifo_free(ctx->pending);
|
av_fifo_free(ctx->pending);
|
||||||
av_fifo_free(ctx->ready);
|
av_fifo_free(ctx->ready);
|
||||||
|
Loading…
Reference in New Issue
Block a user