From b0b1b82c3f0ab8662115c11397718b77849e3e49 Mon Sep 17 00:00:00 2001 From: Vi Nguyen Date: Fri, 10 Apr 2020 14:26:46 +0000 Subject: [PATCH] Bug 1615460 [wpt PR 21791] - Implement MediaCapabilities: HDR decoding query, a=testonly Automatic update from web-platform-tests Implement MediaCapabilities: HDR decoding query 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035053 Commit-Queue: Vi Nguyen Reviewed-by: Yuchen Liu Reviewed-by: Dave Tapuska Reviewed-by: Mounir Lamouri Reviewed-by: Chrome Cunningham Cr-Commit-Position: refs/heads/master@{#756829} -- wpt-commits: 52b1ba4e190f45ab8d49ebe2a1c3d79f6d3c6f06 wpt-pr: 21791 --- .../media-capabilities/decodingInfo.any.js | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/testing/web-platform/tests/media-capabilities/decodingInfo.any.js b/testing/web-platform/tests/media-capabilities/decodingInfo.any.js index 2d74d30eeb62..772d47e87295 100644 --- a/testing/web-platform/tests/media-capabilities/decodingInfo.any.js +++ b/testing/web-platform/tests/media-capabilities/decodingInfo.any.js @@ -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"); @@ -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', + video: 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");