summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2018-04-27 03:51:35 +0300
committerKarthick Jeyapal <kjeyapal@akamai.com>2018-05-03 10:39:39 +0530
commit6f119dc32176e191c7fc796d4c4ca06c7be4ea71 (patch)
tree33f4f91418a7676fed615a5b61ec6756271bc8f7 /libavformat
parentab1114a0f5b32d91e7f56dc1183087a33a96153c (diff)
lavf/dashenc: don't call flush_init_segment before avformat_write_header
Fixes crash when muxing MKV-in-DASH
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dashenc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 211ef23cb0..4f8f61b704 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1026,13 +1026,6 @@ static int dash_init(AVFormatContext *s)
av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename);
- // Flush init segment
- // except for mp4, since delay_moov is set and the init segment
- // is then flushed after the first packets
- if (strcmp(os->format_name, "mp4")) {
- flush_init_segment(s, os);
- }
-
s->streams[i]->time_base = st->time_base;
// If the muxer wants to shift timestamps, request to have them shifted
// already before being handed to this muxer, so we don't have mismatches
@@ -1074,6 +1067,13 @@ static int dash_write_header(AVFormatContext *s)
OutputStream *os = &c->streams[i];
if ((ret = avformat_write_header(os->ctx, NULL)) < 0)
return ret;
+
+ // Flush init segment
+ // Only for WebM segment, since for mp4 delay_moov is set and
+ // the init segment is thus flushed after the first packets.
+ if (strcmp(os->format_name, "mp4") &&
+ (ret = flush_init_segment(s, os)) < 0)
+ return ret;
}
return ret;
}