]> git.sesse.net Git - ffmpeg/commitdiff
avconv: flush decoders immediately after an EOF.
authorAnton Khirnov <anton@khirnov.net>
Mon, 2 Apr 2012 18:13:29 +0000 (20:13 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 15 Apr 2012 18:37:47 +0000 (20:37 +0200)
Prevents extensive buffering when overlaying a single picture.

avconv.c

index a8824efff48000c0efebce0bac728890908dc9ba..347f80493d68a4bfa56a30d3edee4986d9d619c6 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -3054,6 +3054,13 @@ static int transcode(void)
         }
         if (ret < 0) {
             input_files[file_index]->eof_reached = 1;
+
+            for (i = 0; i < input_files[file_index]->nb_streams; i++) {
+                ist = input_streams[input_files[file_index]->ist_index + i];
+                if (ist->decoding_needed)
+                    output_packet(ist, NULL);
+            }
+
             if (opt_shortest)
                 break;
             else
@@ -3125,7 +3132,7 @@ static int transcode(void)
     /* at the end of stream, we must flush the decoder buffers */
     for (i = 0; i < nb_input_streams; i++) {
         ist = input_streams[i];
-        if (ist->decoding_needed) {
+        if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) {
             output_packet(ist, NULL);
         }
     }