]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_dynaudnorm: fix hang with too short input
authorPaul B Mahol <onemda@gmail.com>
Sun, 8 Jan 2017 19:41:36 +0000 (20:41 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 8 Jan 2017 19:42:17 +0000 (20:42 +0100)
The only thing we can do at such point is return samples unchanged.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavfilter/af_dynaudnorm.c

index 91ec45a2daf78d8d30615640782aefce8efbb854..ddbef26ab5954b2e67453ca5acaa594d1a68579a 100644 (file)
@@ -708,8 +708,15 @@ static int request_frame(AVFilterLink *outlink)
 
     ret = ff_request_frame(ctx->inputs[0]);
 
-    if (ret == AVERROR_EOF && !ctx->is_disabled && s->delay)
-        ret = flush_buffer(s, ctx->inputs[0], outlink);
+    if (ret == AVERROR_EOF && !ctx->is_disabled && s->delay) {
+        if (!cqueue_empty(s->gain_history_smoothed[0])) {
+            ret = flush_buffer(s, ctx->inputs[0], outlink);
+        } else if (s->queue.available) {
+            AVFrame *out = ff_bufqueue_get(&s->queue);
+
+            ret = ff_filter_frame(outlink, out);
+        }
+    }
 
     return ret;
 }