summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-10-16 00:24:26 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-16 15:25:09 +0200
commit377883c4be7a5b27d57737a79d6a58a6af0ae6cd (patch)
tree8e445a7cb5c42e85ed3d979f8186c0a5ba2deb68 /libavfilter/avfilter.c
parent97be5d4d200755c5077684e6ea003d3c452b0b4a (diff)
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: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 51926bfe96..8b1b7d2326 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1147,10 +1147,22 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
av_assert1(frame->height == link->h);
}
} else {
- av_assert1(frame->format == link->format);
- av_assert1(av_frame_get_channels(frame) == link->channels);
- av_assert1(frame->channel_layout == link->channel_layout);
- av_assert1(frame->sample_rate == link->sample_rate);
+ if (frame->format != link->format) {
+ av_log(link->dst, AV_LOG_ERROR, "Format change is not supported\n");
+ goto error;
+ }
+ 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 */
@@ -1163,6 +1175,9 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
} else {
return ff_filter_frame_framed(link, frame);
}
+error:
+ av_frame_free(&frame);
+ return AVERROR_PATCHWELCOME;
}
const AVClass *avfilter_get_class(void)