From f0a52cbbf254e4e852a4d291a0d856fa33535dce Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Thu, 25 Feb 2021 16:17:00 -0800 Subject: [PATCH] Fix TTML codec string in HLS. Issue #903 Change-Id: I1f73d16ad79c2593996d7d50f9556984302fe21e --- packager/hls/base/master_playlist.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packager/hls/base/master_playlist.cc b/packager/hls/base/master_playlist.cc index b35ef4757e..4ae4005489 100644 --- a/packager/hls/base/master_playlist.cc +++ b/packager/hls/base/master_playlist.cc @@ -85,6 +85,13 @@ std::set GetGroupCodecString( if (wvtt != codecs.end()) { codecs.erase(wvtt); } + // TTML is specified using 'stpp.ttml.im1t'; see section 5.10 of + // https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices + auto ttml = codecs.find("ttml"); + if (ttml != codecs.end()) { + codecs.erase(ttml); + codecs.insert("stpp.ttml.im1t"); + } return codecs; } @@ -225,8 +232,9 @@ void BuildStreamInfTag(const MediaPlaylist& playlist, // Right now the frame-rate returned may not be accurate in some scenarios. // TODO(kqyang): Fix frame-rate computation. - const bool is_iframe_playlist = playlist.stream_type() == - MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly; + const bool is_iframe_playlist = + playlist.stream_type() == + MediaPlaylist::MediaPlaylistStreamType::kVideoIFramesOnly; if (!is_iframe_playlist) { const double frame_rate = playlist.GetFrameRate(); if (frame_rate > 0) @@ -486,7 +494,7 @@ bool MasterPlaylist::WriteMasterPlaylist( const std::list& playlists) { std::string content = "#EXTM3U\n"; AppendVersionString(&content); - + if (is_independent_segments_) { content.append("\n#EXT-X-INDEPENDENT-SEGMENTS\n"); }