avconv: move flushing the queued frames to configure_filtergraph()
authorAnton Khirnov <anton@khirnov.net>
Mon, 27 Jun 2016 16:59:23 +0000 (18:59 +0200)
committerAnton Khirnov <anton@khirnov.net>
Tue, 28 Jun 2016 06:30:20 +0000 (08:30 +0200)
This is a more appropriate place for it, and will also be useful in the
following commit.

avconv.c
avconv_filter.c

index 4eae015..778de65 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -1231,17 +1231,6 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
             av_log(NULL, AV_LOG_ERROR, "Error reinitializing filters!\n");
             return ret;
         }
-
-        for (i = 0; i < fg->nb_inputs; i++) {
-            while (av_fifo_size(fg->inputs[i]->frame_queue)) {
-                AVFrame *tmp;
-                av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
-                ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
-                av_frame_free(&tmp);
-                if (ret < 0)
-                    return ret;
-            }
-        }
     }
 
     ret = av_buffersrc_add_frame(ifilter->filter, frame);
index f7ce76f..1acbd88 100644 (file)
@@ -769,6 +769,17 @@ int configure_filtergraph(FilterGraph *fg)
         ofilter->channel_layout = link->channel_layout;
     }
 
+    for (i = 0; i < fg->nb_inputs; i++) {
+        while (av_fifo_size(fg->inputs[i]->frame_queue)) {
+            AVFrame *tmp;
+            av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
+            ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
+            av_frame_free(&tmp);
+            if (ret < 0)
+                return ret;
+        }
+    }
+
     return 0;
 }