Omit all optional fields in AV1 codec string

The spec requires the optional fields to be mutually inclusive
(all or none).

Issue #453.

Change-Id: I6d62bb862957abe7a3517058510f614995a92dd9
This commit is contained in:
KongQun Yang 2018-10-12 13:16:18 -07:00
parent 4b19905bc2
commit 53aa775ea4
12 changed files with 20 additions and 18 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=69160,AVERAGE-BANDWIDTH=69160,CODECS="av01.0.00M.08.0.110",RESOLUTION=320x240
#EXT-X-STREAM-INF:BANDWIDTH=69160,AVERAGE-BANDWIDTH=69160,CODECS="av01.0.00M.08",RESOLUTION=320x240
stream_0.m3u8

View File

@ -3,7 +3,7 @@
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.7360665798187256S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="320" height="240" frameRate="30000/1001" subsegmentAlignment="true" par="4:3">
<Representation id="0" bandwidth="69160" codecs="av01.0.00M.08.0.110" mimeType="video/webm" sar="1:1">
<Representation id="0" bandwidth="69160" codecs="av01.0.00M.08" mimeType="video/webm" sar="1:1">
<BaseURL>bear-av1-video.webm</BaseURL>
<SegmentBase indexRange="314-332" timescale="30000">
<Initialization range="0-313"/>

View File

@ -1,5 +1,5 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08.0.110",RESOLUTION=320x240
#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240
stream_0.m3u8

View File

@ -7,7 +7,7 @@
<ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b">
<cenc:pssh>AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA==</cenc:pssh>
</ContentProtection>
<Representation id="0" bandwidth="69777" codecs="av01.0.00M.08.0.110" mimeType="video/mp4" sar="1:1">
<Representation id="0" bandwidth="69777" codecs="av01.0.00M.08" mimeType="video/mp4" sar="1:1">
<BaseURL>bear-av1-video.mp4</BaseURL>
<SegmentBase indexRange="1041-1084" timescale="30000">
<Initialization range="0-1040"/>

View File

@ -1,5 +1,5 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08.0.110",RESOLUTION=320x240
#EXT-X-STREAM-INF:BANDWIDTH=69777,AVERAGE-BANDWIDTH=69777,CODECS="av01.0.00M.08",RESOLUTION=320x240
stream_0.m3u8

View File

@ -3,7 +3,7 @@
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.7360665798187256S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="320" height="240" frameRate="30000/1001" subsegmentAlignment="true" par="4:3">
<Representation id="0" bandwidth="69777" codecs="av01.0.00M.08.0.110" mimeType="video/mp4" sar="1:1">
<Representation id="0" bandwidth="69777" codecs="av01.0.00M.08" mimeType="video/mp4" sar="1:1">
<BaseURL>bear-av1-video.mp4</BaseURL>
<SegmentBase indexRange="798-841" timescale="30000">
<Initialization range="0-797"/>

View File

@ -1,5 +1,5 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-STREAM-INF:BANDWIDTH=69426,AVERAGE-BANDWIDTH=69426,CODECS="av01.0.00M.08.0.110",RESOLUTION=320x240
#EXT-X-STREAM-INF:BANDWIDTH=69426,AVERAGE-BANDWIDTH=69426,CODECS="av01.0.00M.08",RESOLUTION=320x240
stream_0.m3u8

View File

@ -6,7 +6,7 @@
<ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" cenc:default_KID="31323334-3536-3738-3930-313233343536">
<cenc:pssh>AAAANHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAExMjM0NTY3ODkwMTIzNDU2AAAAAA==</cenc:pssh>
</ContentProtection>
<Representation id="0" bandwidth="69426" codecs="av01.0.00M.08.0.110" mimeType="video/webm" sar="1:1">
<Representation id="0" bandwidth="69426" codecs="av01.0.00M.08" mimeType="video/webm" sar="1:1">
<BaseURL>bear-av1-video.webm</BaseURL>
<SegmentBase indexRange="358-376" timescale="1000000">
<Initialization range="0-357"/>

View File

@ -1,5 +1,5 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#EXT-X-STREAM-INF:BANDWIDTH=70752,AVERAGE-BANDWIDTH=70752,CODECS="av01.0.00M.08.0.110",RESOLUTION=320x240
#EXT-X-STREAM-INF:BANDWIDTH=70752,AVERAGE-BANDWIDTH=70752,CODECS="av01.0.00M.08",RESOLUTION=320x240
stream_0.m3u8

View File

@ -3,7 +3,7 @@
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.734999895095825S">
<Period id="0">
<AdaptationSet id="0" contentType="video" width="320" height="240" frameRate="1000000/33000" subsegmentAlignment="true" par="4:3">
<Representation id="0" bandwidth="70752" codecs="av01.0.00M.08.0.110" mimeType="video/mp4" sar="1:1">
<Representation id="0" bandwidth="70752" codecs="av01.0.00M.08" mimeType="video/mp4" sar="1:1">
<BaseURL>bear-av1-video.mp4</BaseURL>
<SegmentBase indexRange="798-841" timescale="1000000">
<Initialization range="0-797"/>

View File

@ -77,13 +77,15 @@ bool AV1CodecConfigurationRecord::Parse(const uint8_t* data, size_t data_size) {
// <sample entry 4CC>.<profile>.<level><tier>.<bitDepth>.<monochrome>.
// <chromaSubsampling>.<colorPrimaries>.<transferCharacteristics>.
// <matrixCoefficients>.<videoFullRangeFlag>
// The parameters starting from colorPrimaries are omitted as they are not
// present in AV1 Codec Configuration Record and they are optional.
// The parameters sample entry 4CC, profile, level, tier, and bitDepth are all
// mandatory fields.
// All the other fields (including their leading '.') are optional, mutually
// inclusive (all or none) fields.
// Since some of the optional fields (e.g. colorPrimaries) are not present in
// AV1CodecConfigurationRecord, we omit all the optional fields.
std::string AV1CodecConfigurationRecord::GetCodecString() const {
return base::StringPrintf("av01.%d.%02d%c.%02d.%d.%d%d%d", profile_, level_,
tier_ ? 'H' : 'M', bit_depth_, mono_chrome_,
chroma_subsampling_x_, chroma_subsampling_y_,
chroma_sample_position_);
return base::StringPrintf("av01.%d.%02d%c.%02d", profile_, level_,
tier_ ? 'H' : 'M', bit_depth_);
}
} // namespace media

View File

@ -27,7 +27,7 @@ TEST(AV1CodecConfigurationRecordTest, Success) {
std::vector<uint8_t>(std::begin(kAV1CodecConfigurationData),
std::end(kAV1CodecConfigurationData))));
EXPECT_EQ(av1_config.GetCodecString(), "av01.0.04M.10.0.112");
EXPECT_EQ(av1_config.GetCodecString(), "av01.0.04M.10");
}
TEST(AV1CodecConfigurationRecordTest, Success2) {
@ -46,7 +46,7 @@ TEST(AV1CodecConfigurationRecordTest, Success2) {
std::vector<uint8_t>(std::begin(kAV1CodecConfigurationData),
std::end(kAV1CodecConfigurationData))));
EXPECT_EQ(av1_config.GetCodecString(), "av01.1.21H.12.1.010");
EXPECT_EQ(av1_config.GetCodecString(), "av01.1.21H.12");
}
TEST(AV1CodecConfigurationRecordTest, InsufficientData) {