Browse code

lavfi/atempo: Avoid false triggering an assertion failure

Steps to reproduce:
1. revert 4240e5b047379b29c33dd3f4438bc4e610527b83
2. ./ffmpeg -f lavfi -i sine=d=1 -af aselect=e=0,atempo=0.5 -y atempo.wav

Signed-off-by: Marton Balint <cus@passwd.hu>

Pavel Koshevoy authored on 2017/09/04 11:44:31
Showing 1 changed files
... ...
@@ -914,6 +914,11 @@ static int yae_flush(ATempoContext *atempo,
914 914
 
915 915
     atempo->state = YAE_FLUSH_OUTPUT;
916 916
 
917
+    if (!atempo->nfrag) {
918
+        // there is nothing to flush:
919
+        return 0;
920
+    }
921
+
917 922
     if (atempo->position[0] == frag->position[0] + frag->nsamples &&
918 923
         atempo->position[1] == frag->position[1] + frag->nsamples) {
919 924
         // the current fragment is already flushed: