[FFmpeg-cvslog] avcodec/videotoolboxenc: inherit profile from AVCodecContext

Zhao Zhili git at videolan.org
Mon Jun 19 07:33:43 EEST 2023


ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Fri Jun  9 19:14:55 2023 +0800| [f66e1862e3140a6d6ba9d35243827832e26b61a1] | committer: Zhao Zhili

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 <zhilizhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f66e1862e3140a6d6ba9d35243827832e26b61a1
---

 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;



More information about the ffmpeg-cvslog mailing list