diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-09-18 23:30:44 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-09-23 14:42:33 +0100 |
commit | 2562dd9e7831743ba6dc5680501fb7d26a2ec62c (patch) | |
tree | 45a2de5838060d83e0bb9fb890a45ff34fa1f14d /libavcodec/vaapi_encode.c | |
parent | ac31d84506cde8e055edf8fab807cb0ee5878554 (diff) | |
download | ffmpeg-2562dd9e7831743ba6dc5680501fb7d26a2ec62c.tar.gz |
vaapi_encode: Always reapply global parameters after the sequence header
The codec sequence headers may contain fields which can overwrite the
fine parameters given in the specific settings (e.g. a crude bitrate
value vs. the max-rate / target-percentage / etc. values in
VAEncMiscParameterRateControl). Always reapply all global parameters
after a sequence header to avoid this causing problems.
Diffstat (limited to 'libavcodec/vaapi_encode.c')
-rw-r--r-- | libavcodec/vaapi_encode.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 35a4e90f67..1969c9252f 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -207,9 +207,16 @@ static int vaapi_encode_issue(AVCodecContext *avctx, pic->nb_param_buffers = 0; - if (pic->encode_order == 0) { - // Global parameter buffers are set on the first picture only. + if (pic->type == PICTURE_TYPE_IDR && ctx->codec->init_sequence_params) { + err = vaapi_encode_make_param_buffer(avctx, pic, + VAEncSequenceParameterBufferType, + ctx->codec_sequence_params, + ctx->codec->sequence_params_size); + if (err < 0) + goto fail; + } + if (pic->type == PICTURE_TYPE_IDR) { for (i = 0; i < ctx->nb_global_params; i++) { err = vaapi_encode_make_param_buffer(avctx, pic, VAEncMiscParameterBufferType, @@ -220,15 +227,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } - if (pic->type == PICTURE_TYPE_IDR && ctx->codec->init_sequence_params) { - err = vaapi_encode_make_param_buffer(avctx, pic, - VAEncSequenceParameterBufferType, - ctx->codec_sequence_params, - ctx->codec->sequence_params_size); - if (err < 0) - goto fail; - } - if (ctx->codec->init_picture_params) { err = ctx->codec->init_picture_params(avctx, pic); if (err < 0) { |