[HLS] Fixes attributes for DVS tracks
Always set AUTOSELECT=YES for DVS tracks and also exclude it from standard AUTOSELECT and DEFAULT configuration logic. Fixes #857. Change-Id: Ie179d02390ff09f6e8c0b54892c1d6d32a3c38d6
This commit is contained in:
parent
1f21cc78cd
commit
4a777b6207
|
@ -366,6 +366,13 @@ void BuildMediaTags(
|
||||||
bool is_default = false;
|
bool is_default = false;
|
||||||
bool is_autoselect = false;
|
bool is_autoselect = false;
|
||||||
|
|
||||||
|
if (playlist->is_dvs()) {
|
||||||
|
// According to HLS Authoring Specification for Apple Devices
|
||||||
|
// https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices#overview
|
||||||
|
// section 2.13 If you provide DVS, the AUTOSELECT attribute MUST have
|
||||||
|
// a value of "YES".
|
||||||
|
is_autoselect = true;
|
||||||
|
} else {
|
||||||
const std::string language = playlist->language();
|
const std::string language = playlist->language();
|
||||||
if (languages.find(language) == languages.end()) {
|
if (languages.find(language) == languages.end()) {
|
||||||
is_default = !language.empty() && language == default_language;
|
is_default = !language.empty() && language == default_language;
|
||||||
|
@ -373,6 +380,7 @@ void BuildMediaTags(
|
||||||
|
|
||||||
languages.insert(language);
|
languages.insert(language);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BuildMediaTag(*playlist, group_id, is_default, is_autoselect, base_url,
|
BuildMediaTag(*playlist, group_id, is_default, is_autoselect, base_url,
|
||||||
out);
|
out);
|
||||||
|
|
|
@ -523,6 +523,51 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndTextWithCharacteritics) {
|
||||||
ASSERT_EQ(expected, actual);
|
ASSERT_EQ(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndDvsAudio) {
|
||||||
|
// Video, sd.m3u8.
|
||||||
|
std::unique_ptr<MockMediaPlaylist> video =
|
||||||
|
CreateVideoPlaylist("sd.m3u8", "sdvideocodec", 300000, 200000);
|
||||||
|
|
||||||
|
// DVS Audio, dvs_eng.m3u8.
|
||||||
|
std::unique_ptr<MockMediaPlaylist> dvs_audio = CreateAudioPlaylist(
|
||||||
|
"dvs_eng.m3u8", "DVS english", "audiogroup", "audiocodec", "en", 2, 50000,
|
||||||
|
30000, kEC3JocComplexityZero, !kAC4IMSFlagEnabled, !kAC4CBIFlagEnabled);
|
||||||
|
dvs_audio->SetCharacteristicsForTesting(
|
||||||
|
std::vector<std::string>{"public.accessibility.describes-video"});
|
||||||
|
|
||||||
|
// Normal Audio, eng.m3u8.
|
||||||
|
std::unique_ptr<MockMediaPlaylist> audio = CreateAudioPlaylist(
|
||||||
|
"eng.m3u8", "english", "audiogroup", "audiocodec", "en", 2, 50000, 30000,
|
||||||
|
kEC3JocComplexityZero, !kAC4IMSFlagEnabled, !kAC4CBIFlagEnabled);
|
||||||
|
|
||||||
|
const char kBaseUrl[] = "http://playlists.org/";
|
||||||
|
EXPECT_TRUE(master_playlist_->WriteMasterPlaylist(
|
||||||
|
kBaseUrl, test_output_dir_, {video.get(), dvs_audio.get(), audio.get()}));
|
||||||
|
|
||||||
|
std::string actual;
|
||||||
|
ASSERT_TRUE(File::ReadFileToString(master_playlist_path_.c_str(), &actual));
|
||||||
|
|
||||||
|
const std::string expected =
|
||||||
|
"#EXTM3U\n"
|
||||||
|
"## Generated with https://github.com/google/shaka-packager version "
|
||||||
|
"test\n"
|
||||||
|
"\n"
|
||||||
|
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/dvs_eng.m3u8\","
|
||||||
|
"GROUP-ID=\"audiogroup\",LANGUAGE=\"en\",NAME=\"DVS english\","
|
||||||
|
"AUTOSELECT=YES,CHARACTERISTICS=\"public.accessibility.describes-video\","
|
||||||
|
"CHANNELS=\"2\"\n"
|
||||||
|
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/eng.m3u8\","
|
||||||
|
"GROUP-ID=\"audiogroup\",LANGUAGE=\"en\",NAME=\"english\","
|
||||||
|
"DEFAULT=YES,AUTOSELECT=YES,CHANNELS=\"2\"\n"
|
||||||
|
"\n"
|
||||||
|
"#EXT-X-STREAM-INF:BANDWIDTH=350000,AVERAGE-BANDWIDTH=230000,"
|
||||||
|
"CODECS=\"sdvideocodec,audiocodec\",RESOLUTION=800x600,"
|
||||||
|
"AUDIO=\"audiogroup\"\n"
|
||||||
|
"http://playlists.org/sd.m3u8\n";
|
||||||
|
|
||||||
|
ASSERT_EQ(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndTextGroups) {
|
TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndTextGroups) {
|
||||||
// Video, sd.m3u8.
|
// Video, sd.m3u8.
|
||||||
std::unique_ptr<MockMediaPlaylist> video =
|
std::unique_ptr<MockMediaPlaylist> video =
|
||||||
|
|
|
@ -221,6 +221,15 @@ class MediaPlaylist {
|
||||||
return characteristics_;
|
return characteristics_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_dvs() const {
|
||||||
|
// HLS Authoring Specification for Apple Devices
|
||||||
|
// https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices#overview
|
||||||
|
// Section 2.12.
|
||||||
|
const char DVS_CHARACTERISTICS[] = "public.accessibility.describes-video";
|
||||||
|
return characteristics_.size() == 1 &&
|
||||||
|
characteristics_[0] == DVS_CHARACTERISTICS;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Add a SegmentInfoEntry (#EXTINF).
|
// Add a SegmentInfoEntry (#EXTINF).
|
||||||
void AddSegmentInfoEntry(const std::string& segment_file_name,
|
void AddSegmentInfoEntry(const std::string& segment_file_name,
|
||||||
|
|
Loading…
Reference in New Issue