[FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: inherit profile from AVCodecContext
Zhao Zhili
quinkblack at foxmail.com
Fri Jun 9 14:14:55 EEST 2023
From: Zhao Zhili <zhilizhao at tencent.com>
This can happen when user set the avctx->profile field directly
instead of specify profile via option.
---
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;
--
2.40.1
More information about the ffmpeg-devel
mailing list