From f66e1862e3140a6d6ba9d35243827832e26b61a1 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Fri, 9 Jun 2023 19:14:55 +0800 Subject: [PATCH] avcodec/videotoolboxenc: inherit profile from AVCodecContext This can happen when user set the avctx->profile field directly instead of specify profile via option. Signed-off-by: Zhao Zhili --- libavcodec/videotoolboxenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 9f65519700..a313087876 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -1746,6 +1746,9 @@ static av_cold int vtenc_init(AVCodecContext *avctx) pthread_mutex_init(&vtctx->lock, NULL); pthread_cond_init(&vtctx->cv_sample_sent, NULL); + // It can happen when user set avctx->profile directly. + if (vtctx->profile == FF_PROFILE_UNKNOWN) + vtctx->profile = avctx->profile; vtctx->session = NULL; status = vtenc_configure_encoder(avctx); if (status) return status;