aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorKevin LaFlamme <kevin@aiera.com>2021-06-08 15:03:43 -0400
committerKarthick J <kjeyapal@akamai.com>2021-06-14 21:47:09 +0530
commit7d1464721ebf5c90308e48cb81ad52dbada47c18 (patch)
tree503687c7eab020ba53a02705cf9d258b4657c00f /libavformat/dashenc.c
parentf21626b67b157e5ae117d3e8ef0326776da42077 (diff)
downloadffmpeg-7d1464721ebf5c90308e48cb81ad52dbada47c18.tar.gz
dashenc: Write out DASH manifest immediately in streaming mode
When streaming mode is enabled with fMP4/CMAF for DASH output, the segment files are available to read by players as soon as the first byte is written instead of only after the file is fully written. The DASH manifest currently only gets written when the final write to the segment file occurs. This means that players cannot stream the first segment while it is being written. When -lhls is enabled with MP4 segments the HLS manifest is written immediately to advertise the in-flight segments. This change adds the same behavior for the DASH manifest so players can stream it immediately.
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index b7622bc09d..e7a4a3d9e1 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2257,6 +2257,14 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0) {
return handle_io_open_error(s, ret, os->temp_path);
}
+
+ // 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) {
+ write_manifest(s, 0);
+ }
+
if (c->lhls) {
char *prefetch_url = use_rename ? NULL : os->filename;
write_hls_media_playlist(os, s, pkt->stream_index, 0, prefetch_url);