Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare to enable HDR media capabilities by default. #42856

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions media-capabilities/decodingInfo.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Minimal VideoConfiguration that will be allowed per spec. All optional
// properties are missing.
var minimalVideoConfiguration = {
const minimalVideoConfiguration = {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 800,
height: 600,
Expand All @@ -13,28 +13,29 @@ var minimalVideoConfiguration = {

// Minimal AudioConfiguration that will be allowed per spec. All optional
// properties are missing.
var minimalAudioConfiguration = {
const minimalAudioConfiguration = {
contentType: 'audio/webm; codecs="opus"',
};

// AudioConfiguration with optional spatialRendering param.
var audioConfigurationWithSpatialRendering = {
const audioConfigurationWithSpatialRendering = {
contentType: 'audio/webm; codecs="opus"',
spatialRendering: true,
};

// VideoConfiguration with optional hdrMetadataType, colorGamut, and
// transferFunction properties.
var videoConfigurationWithDynamicRange = {
contentType: 'video/webm; codecs="vp09.00.10.08"',
const videoConfigurationWithDynamicRange = {
contentType: 'video/webm; codecs="vp09.00.10.08.00.09.16.09.00"',
width: 800,
height: 600,
bitrate: 3000,
framerate: 24,
hdrMetadataType: "smpteSt2086",
colorGamut: "srgb",
transferFunction: "srgb",
}
hdrMetadataType: 'smpteSt2086',
colorGamut: 'rec2020',
transferFunction: 'pq',
};


promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo());
Expand Down Expand Up @@ -363,6 +364,25 @@ promise_test(t => {
});
}, "Test that decodingInfo with hdrMetadataType, colorGamut, and transferFunction set returns a valid MediaCapabilitiesInfo objects");

promise_test(t => {
// VP9 has a default color space of BT.709 in the codec string. So this will
// mismatch against the provided colorGamut and transferFunction.
let bt709Config = videoConfigurationWithDynamicRange;
bt709Config.contentType = 'video/webm; codecs="vp09.00.10.08"';
return navigator.mediaCapabilities
.decodingInfo({
type: 'file',
video: bt709Config,
})
.then(ability => {
assert_equals(typeof ability.supported, 'boolean');
assert_equals(typeof ability.smooth, 'boolean');
assert_equals(typeof ability.powerEfficient, 'boolean');
assert_equals(typeof ability.keySystemAccess, 'object');
assert_false(ability.supported);
});
}, 'Test that decodingInfo with mismatched codec color space is unsupported');

promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({
type: 'file',
Expand Down