1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Kevin LaFlamme 2021-06-08 15:03:43 -04:00 committed by Karthick J
parent f21626b67b
commit 7d1464721e

View File

@ -2257,6 +2257,14 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0) { if (ret < 0) {
return handle_io_open_error(s, ret, os->temp_path); 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) { if (c->lhls) {
char *prefetch_url = use_rename ? NULL : os->filename; char *prefetch_url = use_rename ? NULL : os->filename;
write_hls_media_playlist(os, s, pkt->stream_index, 0, prefetch_url); write_hls_media_playlist(os, s, pkt->stream_index, 0, prefetch_url);