avformat/mux: flush after header writing, like after packets
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 3 Aug 2014 15:44:56 +0000 (17:44 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 3 Aug 2014 16:10:04 +0000 (18:10 +0200)
This makes problematic unconditional flushes in mpegts redundant
And is thus part of a fix for ticket 2748

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

index be72d91..dbb9b55 100644 (file)
@@ -421,6 +421,8 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
             ret = s->pb->error;
         if (ret < 0)
             return ret;
+        if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
+            avio_flush(s->pb);
     }
 
     if ((ret = init_pts(s)) < 0)