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@tencent.com>
This commit is contained in:
Zhao Zhili 2023-06-09 19:14:55 +08:00
parent 3fafc842f1
commit f66e1862e3
1 changed files with 3 additions and 0 deletions

View File

@ -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;