[FFmpeg-devel] [PATCH 4/4] ffmpeg: probe buffersinks once more after EOF.

Nicolas George nicolas.george at normalesup.org
Tue Jul 17 18:13:19 CEST 2012


avfilter_graph_request_oldest() can cause frames to arrive
to the sinks even when it returns EOF.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 ffmpeg.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 61840cc..35ff099 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1930,7 +1930,7 @@ static int poll_filters(void)
     AVFilterBufferRef *picref;
     AVFrame *filtered_frame = NULL;
     int i, ret, ret_all;
-    unsigned nb_success, nb_eof;
+    unsigned nb_success = 1, av_uninit(nb_eof);
     int64_t frame_pts;
 
     while (1) {
@@ -2003,6 +2003,8 @@ static int poll_filters(void)
                 avfilter_unref_buffer(picref);
             }
         }
+        if (!nb_success) /* from last round */
+            break;
         /* Request frames through all the graphs */
         ret_all = nb_success = nb_eof = 0;
         for (i = 0; i < nb_filtergraphs; i++) {
@@ -2019,8 +2021,6 @@ static int poll_filters(void)
                 ret_all = ret;
             }
         }
-        if (!nb_success)
-            break;
         /* Try again if anything succeeded */
     }
     return nb_eof == nb_filtergraphs ? AVERROR_EOF : ret_all;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list