Commit 377883c4 authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/avfilter: Error out if audio parameters change instead of failing an assert

Filters which support such changes should be excluded from these checks

Fixes Ticket4884
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 97be5d4d
...@@ -1147,10 +1147,22 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) ...@@ -1147,10 +1147,22 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
av_assert1(frame->height == link->h); av_assert1(frame->height == link->h);
} }
} else { } else {
av_assert1(frame->format == link->format); if (frame->format != link->format) {
av_assert1(av_frame_get_channels(frame) == link->channels); av_log(link->dst, AV_LOG_ERROR, "Format change is not supported\n");
av_assert1(frame->channel_layout == link->channel_layout); goto error;
av_assert1(frame->sample_rate == link->sample_rate); }
if (av_frame_get_channels(frame) != link->channels) {
av_log(link->dst, AV_LOG_ERROR, "Channel count change is not supported\n");
goto error;
}
if (frame->channel_layout != link->channel_layout) {
av_log(link->dst, AV_LOG_ERROR, "Channel layout change is not supported\n");
goto error;
}
if (frame->sample_rate != link->sample_rate) {
av_log(link->dst, AV_LOG_ERROR, "Sample rate change is not supported\n");
goto error;
}
} }
/* Go directly to actual filtering if possible */ /* Go directly to actual filtering if possible */
...@@ -1163,6 +1175,9 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) ...@@ -1163,6 +1175,9 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
} else { } else {
return ff_filter_frame_framed(link, frame); return ff_filter_frame_framed(link, frame);
} }
error:
av_frame_free(&frame);
return AVERROR_PATCHWELCOME;
} }
const AVClass *avfilter_get_class(void) const AVClass *avfilter_get_class(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment