From 8d4c7c25674f1967d9ffab69b7ef15381df42ca8 Mon Sep 17 00:00:00 2001
From: Aleksandr Slobodeniuk <alenuke@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;
 
-- 
2.7.1.windows.1

