Set MediaPlaylist version to 5

- Required for KEYFORMAT and KEYFORAMTVERSIONS attributes.

Change-Id: I834cde6e475e4f1192db0c93c4b88e2ab838532e
This commit is contained in:
Rintaro Kuroiwa 2016-06-29 10:12:09 -07:00
parent abb1abf5c5
commit dad07c95d7
2 changed files with 8 additions and 8 deletions

View File

@ -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) {

View File

@ -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"