Skip to content

Commit

Permalink
Implement MediaCapabilities: HDR decoding query
Browse files Browse the repository at this point in the history
This CL allows for HDR to be queried with MediaCapabilities.decodingInfo
with hdrMetadataType, colorGamut, and transferFunction. Both Blink- and
Media-side changes are included. The feature is flagged by
MediaCapabilitiesDynamicRange.

Bug: 1048045
Change-Id: I9f144726bbc7aaead4dcc1c9f69cf536da1bf2a9
  • Loading branch information
vi-dot-cpp authored and chromium-wpt-export-bot committed Mar 24, 2020
1 parent 275e939 commit c280d39
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions media-capabilities/decodingInfo.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ var audioConfigurationWithSpatialRendering = {
spatialRendering: true,
};

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

promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo());
}, "Test that decodingInfo rejects if it doesn't get a configuration");
Expand Down Expand Up @@ -314,3 +327,57 @@ promise_test(t => {
assert_equals(typeof ability.keySystemAccess, "object");
});
}, "Test that decodingInfo with spatialRendering set returns a valid MediaCapabilitiesInfo objects");

promise_test(t => {
return navigator.mediaCapabilities.decodingInfo({
type: 'file',
audio: videoConfigurationWithDynamicRange,
}).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");
});
}, "Test that decodingInfo with hdrMetadataType, colorGamut, and transferFunction set returns a valid MediaCapabilitiesInfo objects");

promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({
type: 'file',
video: {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 800,
height: 600,
bitrate: 3000,
framerate: 24,
hdrMetadataType: ""
},
}));
}, "Test that decodingInfo rejects if the video configuration has an empty hdrMetadataType);
promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({
type: 'file',
video: {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 800,
height: 600,
bitrate: 3000,
framerate: 24,
colorGamut: true
},
}));
}, "Test that decodingInfo rejects if the video configuration has a colorGamut set to true");

promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({
type: 'file',
video: {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 800,
height: 600,
bitrate: 3000,
framerate: 24,
transferFunction: 3
},
}));
}, "Test that decodingInfo rejects if the video configuration has a transferFunction set to 3");

0 comments on commit c280d39

Please sign in to comment.