diff --git a/debian/patches/0084-fix-a-race-condition-in-vaapi-csc-to-yuv420p.patch b/debian/patches/0084-fix-a-race-condition-in-vaapi-csc-to-yuv420p.patch new file mode 100644 index 0000000000..6d2b57f4e8 --- /dev/null +++ b/debian/patches/0084-fix-a-race-condition-in-vaapi-csc-to-yuv420p.patch @@ -0,0 +1,58 @@ +Index: FFmpeg/libavutil/hwcontext_vaapi.c +=================================================================== +--- FFmpeg.orig/libavutil/hwcontext_vaapi.c ++++ FFmpeg/libavutil/hwcontext_vaapi.c +@@ -72,6 +72,7 @@ typedef struct VAAPIDevicePriv { + typedef struct VAAPISurfaceFormat { + enum AVPixelFormat pix_fmt; + VAImageFormat image_format; ++ unsigned int fourcc; + } VAAPISurfaceFormat; + + typedef struct VAAPIDeviceContext { +@@ -221,15 +222,21 @@ static int vaapi_get_image_format(AVHWDe + VAImageFormat **image_format) + { + VAAPIDeviceContext *ctx = hwdev->hwctx; ++ const VAAPIFormatDescriptor *desc; + int i; + ++ desc = vaapi_format_from_pix_fmt(pix_fmt); ++ if (!desc || !image_format) ++ goto fail; ++ + for (i = 0; i < ctx->nb_formats; i++) { +- if (ctx->formats[i].pix_fmt == pix_fmt) { +- if (image_format) +- *image_format = &ctx->formats[i].image_format; ++ if (ctx->formats[i].fourcc == desc->fourcc) { ++ *image_format = &ctx->formats[i].image_format; + return 0; + } + } ++ ++fail: + return AVERROR(ENOSYS); + } + +@@ -446,6 +453,7 @@ static int vaapi_device_init(AVHWDeviceC + av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> %s.\n", + fourcc, av_get_pix_fmt_name(pix_fmt)); + ctx->formats[ctx->nb_formats].pix_fmt = pix_fmt; ++ ctx->formats[ctx->nb_formats].fourcc = fourcc; + ctx->formats[ctx->nb_formats].image_format = image_list[i]; + ++ctx->nb_formats; + } +@@ -1022,12 +1030,6 @@ static int vaapi_map_to_memory(AVHWFrame + { + int err; + +- if (dst->format != AV_PIX_FMT_NONE) { +- err = vaapi_get_image_format(hwfc->device_ctx, dst->format, NULL); +- if (err < 0) +- return err; +- } +- + err = vaapi_map_frame(hwfc, dst, src, flags); + if (err) + return err; diff --git a/debian/patches/series b/debian/patches/series index e4e9f38836..bddc6b0850 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -81,3 +81,4 @@ 0081-backport-av1-videotoolbox.patch 0082-fix-ass-incorrect-null-copy.patch 0083-default-to-input-timebase-for-streamcopy.patch +0084-fix-a-race-condition-in-vaapi-csc-to-yuv420p.patch