avcodec: validate the channel layout vs. channel count for decoders
Set avctx->channel_layout to 0 if the channel count does not match avctx->channels.
This commit is contained in:
parent
b2db35995f
commit
1337de0c4b
@ -810,6 +810,15 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
|
|||||||
goto free_and_end;
|
goto free_and_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (av_codec_is_decoder(avctx->codec)) {
|
||||||
|
/* validate channel layout from the decoder */
|
||||||
|
if (avctx->channel_layout &&
|
||||||
|
av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) {
|
||||||
|
av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n");
|
||||||
|
avctx->channel_layout = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
end:
|
end:
|
||||||
entangled_thread_counter--;
|
entangled_thread_counter--;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user