X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvaapi_encode.c;h=36c85a381547a0a7a77e5885963e3e48f8d1b60e;hb=a866cc3ad3fba0b47268f7f5256dde8fc67045c4;hp=590f4be4ed04141bb046529a719294e3285a7901;hpb=2ca3c049cd09527bafd48e50117283a6a965a1b2;p=ffmpeg diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 590f4be4ed0..36c85a38154 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -321,10 +321,12 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } - pic->slices = av_mallocz_array(pic->nb_slices, sizeof(*pic->slices)); - if (!pic->slices) { - err = AVERROR(ENOMEM); - goto fail; + if (pic->nb_slices > 0) { + pic->slices = av_mallocz_array(pic->nb_slices, sizeof(*pic->slices)); + if (!pic->slices) { + err = AVERROR(ENOMEM); + goto fail; + } } for (i = 0; i < pic->nb_slices; i++) { slice = &pic->slices[i]; @@ -1036,6 +1038,8 @@ static av_cold int vaapi_encode_config_attributes(AVCodecContext *avctx) // Unfortunately we have to treat this as "don't know" and hope // for the best, because the Intel MJPEG encoder returns this // for all the interesting attributes. + av_log(avctx, AV_LOG_DEBUG, "Attribute (%d) is not supported.\n", + attr[i].type); continue; } switch (attr[i].type) { @@ -1092,10 +1096,10 @@ static av_cold int vaapi_encode_config_attributes(AVCodecContext *avctx) goto fail; } if (avctx->max_b_frames > 0 && ref_l1 < 1) { - av_log(avctx, AV_LOG_ERROR, "B frames are not " - "supported (%#x).\n", attr[i].value); - err = AVERROR(EINVAL); - goto fail; + av_log(avctx, AV_LOG_WARNING, "B frames are not " + "supported (%#x) by the underlying driver.\n", + attr[i].value); + avctx->max_b_frames = 0; } } break; @@ -1560,6 +1564,8 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) vaapi_encode_free(avctx, pic); } + av_buffer_pool_uninit(&ctx->output_buffer_pool); + if (ctx->va_context != VA_INVALID_ID) { vaDestroyContext(ctx->hwctx->display, ctx->va_context); ctx->va_context = VA_INVALID_ID; @@ -1570,8 +1576,6 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) ctx->va_config = VA_INVALID_ID; } - av_buffer_pool_uninit(&ctx->output_buffer_pool); - av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params);