summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2016-06-11 20:25:58 +0200
committerMarton Balint <cus@passwd.hu>2016-06-20 00:27:26 +0200
commite07b8d68f5ee7da3a0f4c5b9063b928d7c35a9a9 (patch)
treec0c21c344df555807767865655e5b5c3c39fde67
parent517fe64406d4b0f5ae2b1428f17063ac7a1643aa (diff)
avformat/mux: do not call write_packet with a flush packet if header is not written
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavformat/mux.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index b1b65a1e96..f21b4dd071 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -823,6 +823,11 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
if (!pkt) {
if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
+ if (!s->internal->header_written) {
+ ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s);
+ if (ret < 0)
+ return ret;
+ }
ret = s->oformat->write_packet(s, NULL);
if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
avio_flush(s->pb);