Skip to content

Commit

Permalink
Changed LL-HLS version to minumum when legacy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
getroot committed Aug 22, 2024
1 parent 39ae98f commit c64f311
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/projects/publishers/llhls/llhls_chunklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ ov::String LLHlsChunklist::MakeExtXKey() const
ov::String LLHlsChunklist::MakeChunklist(const ov::String &query_string, bool skip, bool legacy, bool rewind, bool vod, uint32_t vod_start_segment_number) const
{
std::shared_lock<std::shared_mutex> segment_lock(_segments_guard);

uint8_t version = 10;
if (_segments.size() == 0)
{
return "";
Expand All @@ -302,7 +302,16 @@ ov::String LLHlsChunklist::MakeChunklist(const ov::String &query_string, bool sk

playlist.AppendFormat("#EXTM3U\n");

playlist.AppendFormat("#EXT-X-VERSION:%d\n", 10);
// debug info
// playlist.AppendFormat("#// query_string(%s) skip(%s) legacy(%s) rewind(%s) vod(%s) vod_start_segment_number(%u)\n",
// query_string.CStr(), skip ? "YES" : "NO", legacy ? "YES" : "NO", rewind ? "YES" : "NO", vod ? "YES" : "NO", vod_start_segment_number);


if (legacy == true)
{
version = 6;
}
playlist.AppendFormat("#EXT-X-VERSION:%d\n", version);
// Note that in protocol version 6, the semantics of the EXT-
// X-TARGETDURATION tag changed slightly. In protocol version 5 and
// earlier it indicated the maximum segment duration; in protocol
Expand All @@ -321,7 +330,7 @@ ov::String LLHlsChunklist::MakeChunklist(const ov::String &query_string, bool sk
else
{
// X-PLAYLIST-TYPE
playlist.AppendFormat("#EXT-X-SERVER-CONTROL:HOLD-BACK=%u\n", target_duration * 3);
// playlist.AppendFormat("#EXT-X-SERVER-CONTROL:HOLD-BACK=%u\n", target_duration * 3);
}

std::shared_ptr<LLHlsChunklist::SegmentInfo> first_segment = nullptr;
Expand Down Expand Up @@ -480,7 +489,8 @@ ov::String LLHlsChunklist::MakeChunklist(const ov::String &query_string, bool sk
segment_lock.unlock();

#if 1
if (vod == false)
// only for live and low-latency mode
if (vod == false && legacy == false)
{
// Output #EXT-X-RENDITION-REPORT
// lock
Expand Down
16 changes: 14 additions & 2 deletions src/projects/publishers/llhls/llhls_master_playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,17 @@ ov::String LLHlsMasterPlaylist::MakePlaylist(const ov::String &chunk_query_strin
{
ov::String playlist(10240);

uint8_t version = 7;
if (legacy == true)
{
version = 6;
}

playlist.AppendFormat("#EXTM3U\n");
playlist.AppendFormat("#EXT-X-VERSION:7\n");

// debug info
// playlist.AppendFormat("#// query_string(%s) legacy(%s) rewind(%s) include_path(%s)\n", chunk_query_string.CStr(), legacy ? "YES" : "NO", rewind ? "YES" : "NO", include_path ? "YES" : "NO");
playlist.AppendFormat("#EXT-X-VERSION:%d\n", version);
playlist.AppendFormat("#EXT-X-INDEPENDENT-SEGMENTS\n");

// Write EXT-X-MEDIA from _media_infos
Expand Down Expand Up @@ -339,7 +348,10 @@ ov::String LLHlsMasterPlaylist::MakePlaylist(const ov::String &chunk_query_strin
playlist.AppendFormat("\n");

// Write EXT-X-SESSION-KEY
playlist.Append(MakeSessionKey());
if (legacy == false)
{
playlist.Append(MakeSessionKey());
}

playlist.AppendFormat("\n");

Expand Down

0 comments on commit c64f311

Please sign in to comment.