]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vaapi_encode.c
Merge commit '785bfb1d7bb8de567c3aac1d9cc369b55ac9fb7b'
[ffmpeg] / libavcodec / vaapi_encode.c
index 24b05a903190dfac76e2bf5f8ef8f5fc1d41d4ba..329b33cbee8ba1ad7b68352cb8a7bf10ab8d2301 100644 (file)
@@ -202,6 +202,19 @@ 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.
+
+        for (i = 0; i < ctx->nb_global_params; i++) {
+            err = vaapi_encode_make_param_buffer(avctx, pic,
+                                                 VAEncMiscParameterBufferType,
+                                                 (char*)ctx->global_params[i],
+                                                 ctx->global_params_size[i]);
+            if (err < 0)
+                goto fail;
+        }
+    }
+
     if (pic->type == PICTURE_TYPE_IDR && ctx->codec->init_sequence_params) {
         err = vaapi_encode_make_param_buffer(avctx, pic,
                                              VAEncSequenceParameterBufferType,
@@ -892,6 +905,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx,
     }
 
     ctx->codec = type;
+    ctx->codec_options = ctx->codec_options_data;
 
     ctx->priv_data = av_mallocz(type->priv_data_size);
     if (!ctx->priv_data) {