diff mbox series

[FFmpeg-devel,3/3] avcodec/videotoolboxenc: inherit profile from AVCodecContext

Message ID tencent_E81EDC494B91A60C908366F767E9EA861306@qq.com
State Accepted
Commit f66e1862e3140a6d6ba9d35243827832e26b61a1
Headers show
Series [FFmpeg-devel,1/3] avcodec/videotoolboxenc: use int as the type of profile | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili June 9, 2023, 11:14 a.m. UTC
From: Zhao Zhili <zhilizhao@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 mbox series

Patch

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;