From dad07c95d746b184edefcdacf8914ceaaa315be1 Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Wed, 29 Jun 2016 10:12:09 -0700 Subject: [PATCH] Set MediaPlaylist version to 5 - Required for KEYFORMAT and KEYFORAMTVERSIONS attributes. Change-Id: I834cde6e475e4f1192db0c93c4b88e2ab838532e --- packager/hls/base/media_playlist.cc | 4 ++-- packager/hls/base/media_playlist_unittest.cc | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packager/hls/base/media_playlist.cc b/packager/hls/base/media_playlist.cc index 28c58e5df0..e4df80067d 100644 --- a/packager/hls/base/media_playlist.cc +++ b/packager/hls/base/media_playlist.cc @@ -273,9 +273,9 @@ bool MediaPlaylist::WriteToFile(media::File* file) { SetTargetDuration(ceil(GetLongestSegmentDuration())); } - // EXTINF with floating point duration requires version 4. + // KEYFORMAT and KEYFORMATVERSIONS on EXT-X-KEY requires 5 or above. std::string header = base::StringPrintf("#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:%d\n", target_duration_); if (type_ == MediaPlaylistType::kVod) { diff --git a/packager/hls/base/media_playlist_unittest.cc b/packager/hls/base/media_playlist_unittest.cc index ad894ba31b..fc73465668 100644 --- a/packager/hls/base/media_playlist_unittest.cc +++ b/packager/hls/base/media_playlist_unittest.cc @@ -116,7 +116,7 @@ TEST_F(MediaPlaylistTest, WriteToFile) { ASSERT_TRUE(media_playlist_.SetMediaInfo(valid_video_media_info_)); const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:0\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-ENDLIST\n"; @@ -171,7 +171,7 @@ TEST_F(MediaPlaylistTest, SetTargetDuration) { EXPECT_TRUE(media_playlist_.SetTargetDuration(20)); const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:20\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-ENDLIST\n"; @@ -197,7 +197,7 @@ TEST_F(MediaPlaylistTest, WriteToFileWithSegments) { media_playlist_.AddSegment("file2.ts", 2700000, 5000000); const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXTINF:10.000,\n" @@ -226,7 +226,7 @@ TEST_F(MediaPlaylistTest, WriteToFileWithEncryptionInfo) { media_playlist_.AddSegment("file2.ts", 2700000, 5000000); const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," @@ -258,7 +258,7 @@ TEST_F(MediaPlaylistTest, WriteToFileWithEncryptionInfoEmptyIv) { media_playlist_.AddSegment("file2.ts", 2700000, 5000000); const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXT-X-KEY:METHOD=SAMPLE-AES," @@ -288,7 +288,7 @@ TEST_F(MediaPlaylistTest, RemoveOldestSegment) { const std::string kExpectedOutput = "#EXTM3U\n" - "#EXT-X-VERSION:4\n" + "#EXT-X-VERSION:5\n" "#EXT-X-TARGETDURATION:30\n" "#EXT-X-PLAYLIST-TYPE:VOD\n" "#EXTINF:30.000,\n"