[HLS] Always signal Dolby Vision as PQ

Issue #341.

Change-Id: I9665ba032b1e069500d866281cb8569ce59876f9
This commit is contained in:
KongQun Yang 2019-09-30 18:22:21 -07:00
parent 0f15ce149b
commit ab8fa87d18
3 changed files with 36 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-STREAM-INF:BANDWIDTH=375371,AVERAGE-BANDWIDTH=368196,CODECS="dvh1.05.01",RESOLUTION=426x240
#EXT-X-STREAM-INF:BANDWIDTH=375371,AVERAGE-BANDWIDTH=368196,CODECS="dvh1.05.01",RESOLUTION=426x240,VIDEO-RANGE=PQ
stream_0.m3u8

View File

@ -533,6 +533,10 @@ bool MediaPlaylist::GetDisplayResolution(uint32_t* width,
}
std::string MediaPlaylist::GetVideoRange() const {
// Dolby Vision (dvh1 or dvhe) is always HDR.
if (codec_.find("dvh") == 0)
return "PQ";
// HLS specification:
// https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-02#section-4.4.4.2
switch (media_info_.video_info().transfer_characteristics()) {

View File

@ -1054,9 +1054,38 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair("hvc1.2.4.L63.90", "hvc1.2.4.L63.90"),
// Replace hev1 with hvc1.
std::make_pair("hev1.2.4.L63.90", "hvc1.2.4.L63.90"),
std::make_pair("dvh1.2.4.L63.90", "dvh1.2.4.L63.90"),
std::make_pair("dvh1.05.08", "dvh1.05.08"),
// Replace dvhe with dvh1.
std::make_pair("dvhe.2.4.L63.90", "dvh1.2.4.L63.90")));
std::make_pair("dvhe.05.08", "dvh1.05.08")));
struct VideoRangeTestData {
std::string codec;
int transfer_characteristics;
std::string expected_video_range;
};
class MediaPlaylistVideoRangeTest
: public MediaPlaylistTest,
public WithParamInterface<VideoRangeTestData> {};
TEST_P(MediaPlaylistVideoRangeTest, GetVideoRange) {
const VideoRangeTestData& test_data = GetParam();
MediaInfo media_info;
media_info.set_reference_time_scale(kTimeScale);
MediaInfo::VideoInfo* video_info = media_info.mutable_video_info();
video_info->set_codec(test_data.codec);
video_info->set_transfer_characteristics(test_data.transfer_characteristics);
ASSERT_TRUE(media_playlist_->SetMediaInfo(media_info));
EXPECT_EQ(test_data.expected_video_range, media_playlist_->GetVideoRange());
}
INSTANTIATE_TEST_CASE_P(VideoRanges,
MediaPlaylistVideoRangeTest,
Values(VideoRangeTestData{"hvc1.2.4.L63.90", 0, ""},
VideoRangeTestData{"hvc1.2.4.L63.90", 1, "SDR"},
VideoRangeTestData{"hvc1.2.4.L63.90", 16, "PQ"},
VideoRangeTestData{"hvc1.2.4.L63.90", 18, "PQ"},
VideoRangeTestData{"dvh1.05.08", 0, "PQ"}));
} // namespace hls
} // namespace shaka