[FFmpeg-devel] [PATCH] avfilter/showwavespic : case of empty audio stream, fixes ticket 6107

wm4 nfxjfg at googlemail.com
Sat Jan 28 13:26:32 EET 2017


On Fri, 27 Jan 2017 15:09:28 +0300
Александр Слободенюк <alexander.slobodeniuk at bramtech.ru> wrote:

> From 8d4c7c25674f1967d9ffab69b7ef15381df42ca8 Mon Sep 17 00:00:00 2001
> From: Aleksandr Slobodeniuk <alenuke at yandex.ru>
> Date: Fri, 27 Jan 2017 14:57:30 +0300
> Subject: [PATCH] avfilter/showwavespic : case of empty audio stream, fixes
>  ticket 6107
> 
> ---
>  libavfilter/avf_showspectrum.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
> index 8776668..b422216 100644
> --- a/libavfilter/avf_showspectrum.c
> +++ b/libavfilter/avf_showspectrum.c
> @@ -1032,6 +1032,11 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
>          int ch, spf, spb;
>          AVFrame *fin;
>  
> +        if (samples == 0) {
> +            av_log(ctx, AV_LOG_ERROR, "Too few samples\n");
> +            return AVERROR(EINVAL);
> +        }
> +
>          spf = s->win_size * (samples / ((s->win_size * sz) * ceil(samples / (float)(s->win_size * sz))));
>          spb = (samples / (spf * sz)) * spf;
>  

Any reason why it should error, instead of returning nothing?


More information about the ffmpeg-devel mailing list