summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorKevin LaFlamme <kevin@aiera.com>2021-06-24 08:58:07 -0400
committerKarthick J <kjeyapal@akamai.com>2021-07-14 19:54:14 +0530
commit3f5d5c1c2dd71d1b4e5fcc0496337d1b224b0794 (patch)
treed285be32fa342641a9f7a02f921ca3452d19ff22 /libavformat/dashenc.c
parentca56299fb3f71badee457c4c36a893f626c4a274 (diff)
Fix double write of DASH manifest in streaming mode
When streaming mode is enabled, the DASH manifest is written on the first packet for the segment so that the segment can be advertised immediately to clients. It was also still writing the manifest at the end of the segment leading to two duplicate writes.
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index e7a4a3d9e1..2b8fbcbe6e 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2030,7 +2030,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
c->nr_of_streams_flushed = 0;
}
- ret = write_manifest(s, final);
+ // In streaming mode the manifest is written at the beginning
+ // of the segment instead
+ if (!c->streaming || final)
+ ret = write_manifest(s, final);
}
return ret;
}
@@ -2261,7 +2264,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
// in streaming mode, the segments are available for playing
// before fully written but the manifest is needed so that
// clients and discover the segment filenames.
- if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
+ if (c->streaming) {
write_manifest(s, 0);
}