avfilter/atempo: Flush all buffered input samples
authorPavel Koshevoy <pkoshevoy@gmail.com>
Tue, 19 Aug 2014 06:17:59 +0000 (00:17 -0600)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 19 Aug 2014 10:53:09 +0000 (12:53 +0200)
Fixes ticket #3829

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/af_atempo.c

index 6a3fd61..fcd0cb0 100644 (file)
@@ -949,7 +949,13 @@ static int yae_flush(ATempoContext *atempo,
         }
     }
 
-    // flush the remaininder of the current fragment:
+    // check whether all of the input samples have been consumed:
+    if (frag->position[0] + frag->nsamples < atempo->position[0]) {
+        yae_advance_to_next_frag(atempo);
+        return AVERROR(EAGAIN);
+    }
+
+    // flush the remainder of the current fragment:
     start_here = FFMAX(atempo->position[1], overlap_end);
     stop_here  = frag->position[1] + frag->nsamples;
     offset     = start_here - frag->position[1];