X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavresample%2Faudio_mix.c;h=e8ab2e3ee71b747b81799fc8920384befb349583;hb=5e3900c7a53cbe3a376ff06c52e54108e94e6427;hp=93192221cdffc9449a33ce9717c5c9947b6b9ac4;hpb=3971be0eb5d382b85f1d8772c51f21cccdc68eab;p=ffmpeg diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c index 93192221cdf..e8ab2e3ee71 100644 --- a/libavresample/audio_mix.c +++ b/libavresample/audio_mix.c @@ -305,8 +305,24 @@ int ff_audio_mix_init(AVAudioResampleContext *avr) { int ret; + if (avr->internal_sample_fmt != AV_SAMPLE_FMT_S16P && + avr->internal_sample_fmt != AV_SAMPLE_FMT_FLTP) { + av_log(avr, AV_LOG_ERROR, "Unsupported internal format for " + "mixing: %s\n", + av_get_sample_fmt_name(avr->internal_sample_fmt)); + return AVERROR(EINVAL); + } + /* build matrix if the user did not already set one */ - if (!avr->am->matrix) { + if (avr->am->matrix) { + if (avr->am->coeff_type != avr->mix_coeff_type || + avr->am->in_layout != avr->in_channel_layout || + avr->am->out_layout != avr->out_channel_layout) { + av_log(avr, AV_LOG_ERROR, + "Custom matrix does not match current parameters\n"); + return AVERROR(EINVAL); + } + } else { int i, j; char in_layout_name[128]; char out_layout_name[128];