From fee982048e338efd3b8c1b2dcaf826cb7944cd81 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sun, 3 Aug 2014 17:44:56 +0200
Subject: avformat/mux: flush after header writing, like after packets

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 | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'libavformat/mux.c')

diff --git a/libavformat/mux.c b/libavformat/mux.c
index be72d91867..dbb9b55f39 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -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)
-- 
cgit v1.2.3