From 74fafbf941e03050b212828b1114118a028c54ca Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Thu, 14 Dec 2023 11:02:13 +0100 Subject: [PATCH] videotoolbox: disable H.264 10-bit on Intel macOS, it's not decoded properly. Disable H.264 level 6.1 and 6.2 too, seems to have issue in some specific cases. --- libavcodec/videotoolbox.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 43fd2e3fea..32a80d6766 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -912,6 +912,23 @@ static int videotoolbox_start(AVCodecContext *avctx) break; } +#if ARCH_X86_64 + if (avctx->codec_id == AV_CODEC_ID_H264 && + avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10) + { + // 10-bit H.264 is not supported on x86_64 + return AVERROR(ENOSYS); + } +#endif + + if (avctx->codec_id == AV_CODEC_ID_H264 && + (avctx->level == 61 || avctx->level == 62)) + { + // H.264 Level 6.1 and 6.2 can't be + // decoded properly + return AVERROR(ENOSYS); + } + #if defined(MAC_OS_X_VERSION_10_9) && !TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && AV_HAS_BUILTIN(__builtin_available) if (avctx->codec_id == AV_CODEC_ID_PRORES) { if (__builtin_available(macOS 10.9, *)) { -- 2.39.3 (Apple Git-145)