This commit is contained in:
wrapper 2025-08-17 15:31:14 +07:00
parent af417a0790
commit ec65dd4d79

View file

@ -1008,17 +1008,20 @@ static int mf_choose_output_type(AVCodecContext *avctx)
}
if (ret >= 0) {
unsigned int profile_set;
unsigned int profile_negotiated;
av_log(avctx, AV_LOG_VERBOSE, "setting output type:\n");
ff_media_type_dump(avctx, out_type);
IMFAttributes_GetUINT32(out_type, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &profile_set);
hr = IMFTransform_SetOutputType(c->mft, c->out_stream_id, out_type, 0);
if (!FAILED(hr)) {
if (avctx->codec_id == AV_CODEC_ID_AAC) {
unsigned int profile_set;
unsigned int profile_negotiated;
hr = IMFTransform_GetOutputCurrentType(c->mft, c->out_stream_id, &out_type_negotiated);
IMFAttributes_GetUINT32(out_type, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &profile_set);
IMFAttributes_GetUINT32(out_type_negotiated, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &profile_negotiated);
IMFAttributes_GetUINT32(out_type, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &profile_negotiated);
av_log(avctx, AV_LOG_TRACE, "cmp1: %d, cmp2: %d\n", out_type, out_type_negotiated);
if (!FAILED(hr) && profile_set != profile_negotiated) { // Setting PROFILE_LEVEL_INDICATION in AAC Encoder is only supported starting from Win11 24H2, fail if reported a mismatch in profile level indication.
av_log(avctx, AV_LOG_ERROR, "profile level indication mismatch: (out_type profile_level) %d != (out_type_negotiated profile_level) %d\n", profile_set, profile_negotiated);