Re: [FFmpeg-devel] [PATCH] avfilter/avfilter: Error out if audio parameters change instead of failing an assert
On 10/16/15, Michael Niedermayerwrote: > From: Michael Niedermayer > > Filters which support such changes should be excluded from these checks > > Fixes Ticket4884 > > Signed-off-by: Michael Niedermayer > --- > libavfilter/avfilter.c | 23 +++ > 1 file changed, 19 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c > index 51926bf..8b1b7d2 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(); > +return AVERROR_PATCHWELCOME; > } > > const AVClass *avfilter_get_class(void) > -- > 1.7.9.5 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > probably ok ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/avfilter: Error out if audio parameters change instead of failing an assert
On Fri, Oct 16, 2015 at 10:19:11AM +0200, Paul B Mahol wrote: > On 10/16/15, Michael Niedermayerwrote: > > From: Michael Niedermayer > > > > Filters which support such changes should be excluded from these checks > > > > Fixes Ticket4884 > > > > Signed-off-by: Michael Niedermayer > > --- > > libavfilter/avfilter.c | 23 +++ > > 1 file changed, 19 insertions(+), 4 deletions(-) > > > > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c > > index 51926bf..8b1b7d2 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(); > > +return AVERROR_PATCHWELCOME; > > } > > > > const AVClass *avfilter_get_class(void) > > -- > > 1.7.9.5 > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > probably ok applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/avfilter: Error out if audio parameters change instead of failing an assert
From: Michael NiedermayerFilters which support such changes should be excluded from these checks Fixes Ticket4884 Signed-off-by: Michael Niedermayer --- libavfilter/avfilter.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 51926bf..8b1b7d2 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(); +return AVERROR_PATCHWELCOME; } const AVClass *avfilter_get_class(void) -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel