Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hls - output EXT-X-DISCONTINUITY-SEQUENCE #751

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions vod/hls/m3u8_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define M3U8_HEADER_PART1 "#EXTM3U\n#EXT-X-TARGETDURATION:%uL\n#EXT-X-ALLOW-CACHE:YES\n"
#define M3U8_HEADER_VOD "#EXT-X-PLAYLIST-TYPE:VOD\n"
#define M3U8_HEADER_PART2 "#EXT-X-VERSION:%d\n#EXT-X-MEDIA-SEQUENCE:%uD\n"
#define M3U8_DISCONTINUITY_SEQUENCE "#EXT-X-DISCONTINUITY-SEQUENCE:%uD\n"

#define M3U8_EXT_MEDIA_PART1 "#EXT-X-MEDIA:TYPE=%s,GROUP-ID=\"%s%uD\",LANGUAGE=\"%s\",NAME=\"%V\","
#define M3U8_EXT_MEDIA_PART2_DEFAULT "AUTOSELECT=YES,DEFAULT=YES,"
Expand Down Expand Up @@ -403,6 +404,7 @@ m3u8_builder_build_index_playlist(
sizeof(M3U8_HEADER_PART1) + VOD_INT64_LEN +
sizeof(M3U8_HEADER_VOD) +
sizeof(M3U8_HEADER_PART2) + VOD_INT64_LEN + VOD_INT32_LEN +
sizeof(M3U8_DISCONTINUITY_SEQUENCE) + VOD_INT32_LEN +
segment_length * segment_durations.segment_count +
segment_durations.discontinuities * (sizeof(m3u8_discontinuity) - 1) +
(sizeof(m3u8_map_prefix) - 1 +
Expand Down Expand Up @@ -562,6 +564,16 @@ m3u8_builder_build_index_playlist(
container_format == HLS_CONTAINER_FMP4 ? 6 : conf->m3u8_version,
segment_durations.items[0].segment_index + 1);

if (media_set->type == MEDIA_SET_LIVE &&
media_set->use_discontinuity &&
media_set->initial_clip_index != INVALID_CLIP_INDEX)
{
p = vod_sprintf(
p,
M3U8_DISCONTINUITY_SEQUENCE,
media_set->initial_clip_index);
}

if (container_format == HLS_CONTAINER_FMP4)
{
p = vod_copy(p, m3u8_map_prefix, sizeof(m3u8_map_prefix) - 1);
Expand Down