Diff
Modified: trunk/LayoutTests/ChangeLog (265166 => 265167)
--- trunk/LayoutTests/ChangeLog 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/LayoutTests/ChangeLog 2020-07-31 23:40:06 UTC (rev 265167)
@@ -1,3 +1,15 @@
+2020-07-31 Jer Noble <[email protected]>
+
+ [Mac] YouTube does not offer HDR variants to devices which support HDR
+ https://bugs.webkit.org/show_bug.cgi?id=215022
+
+ Reviewed by Eric Carlson.
+
+ * platform/mac/media/media-source/is-type-supported-vp9-codec-check-expected.txt: Added.
+ * platform/mac/media/media-source/is-type-supported-vp9-codec-check.html: Added.
+ * platform/mac/media/mediacapabilities/vp9-decodingInfo-sw-expected.txt:
+ * platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html:
+
2020-07-31 Hector Lopez <[email protected]>
[ macOS ] imported/w3c/web-platform-tests/css/css-scoping/css-scoping-shadow-dynamic-remove-style-detached.html is a flaky failure
Modified: trunk/LayoutTests/platform/mac/TestExpectations (265166 => 265167)
--- trunk/LayoutTests/platform/mac/TestExpectations 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2020-07-31 23:40:06 UTC (rev 265167)
@@ -1914,6 +1914,7 @@
# These test requires system platform support.
[ Catalina Mojave ] media/media-source/media-source-webm.html [ Skip ]
[ Catalina Mojave ] platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html [ Skip ]
+[ Catalina Mojave ] platform/mac/media/media-source/is-type-supported-vp9-codec-check.html [ Skip ]
webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
Added: trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check-expected.txt (0 => 265167)
--- trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check-expected.txt 2020-07-31 23:40:06 UTC (rev 265167)
@@ -0,0 +1,129 @@
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="bad-parameter"') == 'false') OK
+
+Test invalid number of required parameters:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41"') == 'false') OK
+
+Test valid default optional parameters:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08"') == 'true') OK
+
+Test invalid number of optional parameters:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01.00"') == 'false') OK
+
+Test valid required and optional parameters:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"') == 'true') OK
+
+Test invalid codec type
+EXPECTED (MediaSource.isTypeSupported('vp10.00.41.08"') == 'false') OK
+
+Test invalid combination of matrixCoefficients and chromaSubsampling
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08.01.01.01.00.00"') == 'false') OK
+
+Test valid profiles:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.41.08"') == 'true') OK
+Test invalid profiles:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.01.41.08"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.03.41.08"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.04.41.08"') == 'false') OK
+
+Test valid levels:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.10.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.11.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.20.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.21.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.30.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.31.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.40.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.50.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.51.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.52.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.60.08"') == 'true') OK
+
+Test invalid levels:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.61.08"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.62.08"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.70.08"') == 'false') OK
+
+Test valid bitDepths:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.10"') == 'true') OK
+
+Test invalid bitDepths:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.12"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.14"') == 'false') OK
+
+Test valid chromaSubsampling:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.00.09.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"') == 'true') OK
+
+Test invalid chromaSubsampling:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.02.09.16.09.01"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.03.09.16.09.01"') == 'false') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.04.09.16.09.01"') == 'false') OK
+
+Test valid colorPrimaries:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.01.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.04.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.05.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.06.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.07.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.08.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.10.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.11.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.12.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.22.16.09.01"') == 'true') OK
+
+Test invalid colorPrimaries:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.03.16.09.01"') == 'false') OK
+
+Test valid transferCharacteristics:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.01.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.04.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.05.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.06.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.07.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.08.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.09.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.10.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.11.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.12.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.13.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.14.09.01"') == 'true') OK
+
+Test invalid transferCharacteristics:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.03.09.01"') == 'false') OK
+
+Test valid matrixCoefficients:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.04.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.05.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.06.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.07.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.08.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.10.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.11.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.12.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.13.01"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.14.01"') == 'true') OK
+
+Test invalid matrixCoefficients:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.03"') == 'false') OK
+
+Test valid videoFullRangeFlag:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.00"') == 'true') OK
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.01"') == 'true') OK
+
+Test invalid videoFullRangeFlag:
+EXPECTED (MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.02"') == 'false') OK
+
+END OF TEST
+
Added: trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check.html (0 => 265167)
--- trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check.html (rev 0)
+++ trunk/LayoutTests/platform/mac/media/media-source/is-type-supported-vp9-codec-check.html 2020-07-31 23:40:06 UTC (rev 265167)
@@ -0,0 +1,97 @@
+<html>
+<head>
+ <title>media-source-change-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ window.addEventListener('load', event => {
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="bad-parameter"')`, false);
+ consoleWrite('');
+ consoleWrite('Test invalid number of required parameters:')
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid default optional parameters:')
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid number of optional parameters:')
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09"')`, false);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01.00"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid required and optional parameters:')
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid codec type');
+ testExpected(`MediaSource.isTypeSupported('vp10.00.41.08"')`, false);
+ consoleWrite('');
+ consoleWrite('Test invalid combination of matrixCoefficients and chromaSubsampling');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.08.01.01.01.00.00"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid profiles:');
+ for (let profile of [0, 2])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.${profile.toString().padStart(2, '0')}.41.08"')`, true);
+ consoleWrite('Test invalid profiles:');
+ for (let profile of [1, 3, 4])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.${profile.toString().padStart(2, '0')}.41.08"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid levels:');
+ for (let level of [10, 11, 20, 21, 30, 31, 40, 41, 50, 51, 52, 60])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.${level.toString().padStart(2, '0')}.08"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid levels:');
+ for (let level of [61, 62, 70])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.${level.toString().padStart(2, '0')}.08"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid bitDepths:');
+ for (let bitDepth of [8, 10])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.${bitDepth.toString().padStart(2, '0')}"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid bitDepths:');
+ for (let bitDepth of [12, 14])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.00.41.${bitDepth.toString().padStart(2, '0')}"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid chromaSubsampling:');
+ for (let chromaSubsampling of [0, 1])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.${chromaSubsampling.toString().padStart(2, '0')}.09.16.09.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid chromaSubsampling:');
+ for (let chromaSubsampling of [2, 3, 4])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.${chromaSubsampling.toString().padStart(2, '0')}.09.16.09.01"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid colorPrimaries:');
+ for (let colorPrimaries of [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 22])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.${colorPrimaries.toString().padStart(2, '0')}.16.09.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid colorPrimaries:');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.03.16.09.01"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid transferCharacteristics:');
+ for (let transferCharacteristics of [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.${transferCharacteristics.toString().padStart(2, '0')}.09.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid transferCharacteristics:');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.03.09.01"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid matrixCoefficients:');
+ for (let matrixCoefficients of [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.${matrixCoefficients.toString().padStart(2, '0')}.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid matrixCoefficients:');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.09.03"')`, false);
+ consoleWrite('');
+ consoleWrite('Test valid videoFullRangeFlag:');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.00"')`, true);
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.01"')`, true);
+ consoleWrite('');
+ consoleWrite('Test invalid videoFullRangeFlag:');
+ testExpected(`MediaSource.isTypeSupported('video/webm; codecs="vp09.02.10.10.01.09.16.01.02"')`, false);
+
+ consoleWrite('');
+ endTest();
+ });
+ </script>
+</head>
Modified: trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw-expected.txt (265166 => 265167)
--- trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw-expected.txt 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw-expected.txt 2020-07-31 23:40:06 UTC (rev 265167)
@@ -6,31 +6,47 @@
Test that 4k @ 30fps is supported, smooth, but not powerEfficient
RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});)
Promise resolved OK
-EXPECTED (info.supported == 'true') OK
-EXPECTED (info.powerEfficient == 'false') OK
-EXPECTED (info.smooth == 'true') OK
+EXPECTED (info === '{ supported: true, powerEfficient: false, smooth: true }') OK
Test that 4k @ 60fps is supported, but not smooth or powerEfficient
RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});)
Promise resolved OK
-EXPECTED (info.supported == 'true') OK
-EXPECTED (info.powerEfficient == 'false') OK
-EXPECTED (info.smooth == 'false') OK
+EXPECTED (info === '{ supported: true, powerEfficient: false, smooth: false }') OK
+Test unsupported codec configurations.
+Profiles 1 and 3 should be unsupported.
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.01.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});)
+Promise resolved OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
+
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.03.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});)
+Promise resolved OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
+
+Pixel depths above 10 are unsupported.
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.12"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});)
+Promise resolved OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
+
+Chroma subsampling 422 or 444 are unsupported.
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08.02.01.01.01.01"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});)
+Promise resolved OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
+
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08.03.01.01.01.01"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});)
+Promise resolved OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
+
Test that SW VP9 decoder is not supported on battery power when screen is not 4k resolution
RUN(internals.setSystemHasACForTesting(false))
RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});)
Promise resolved OK
-EXPECTED (info.supported == 'false') OK
-EXPECTED (info.powerEfficient == 'false') OK
-EXPECTED (info.smooth == 'false') OK
+EXPECTED (info === '{ supported: false, powerEfficient: false, smooth: false }') OK
Test that SW VP9 decoder is supported on battery power when screen is at least 4k resolution
RUN(internals.setVP9ScreenSizeAndScaleForTesting(3840, 2160, 1))
RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs="vp09.00.41.08"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});)
Promise resolved OK
-EXPECTED (info.supported == 'true') OK
-EXPECTED (info.powerEfficient == 'false') OK
-EXPECTED (info.smooth == 'true') OK
+EXPECTED (info === '{ supported: true, powerEfficient: false, smooth: true }') OK
END OF TEST
Modified: trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html (265166 => 265167)
--- trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/LayoutTests/platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html 2020-07-31 23:40:06 UTC (rev 265167)
@@ -6,6 +6,31 @@
var promise;
var info;
+ function MediaCapabilitiesInfoToString(info) {
+ try {
+ return `{ supported: ${ info.supported }, powerEfficient: ${ info.powerEfficient }, smooth: ${ info.smooth } }`;
+ } catch(e) {
+ return `{ ${set} }`;
+ }
+ }
+
+ function isEqualMediaCapabilitiesInfo(infoA, infoB) {
+ try {
+ return infoA.supported === infoB.supported
+ && infoA.powerEfficient === infoB.powerEfficient
+ && infoA.smooth === infoB.smooth;
+ } catch(e) {
+ return false;
+ }
+ }
+
+ function testExpectedMediaCapabilitiesInfo(testFuncString, expected)
+ {
+ let observed = eval(testFuncString);
+ let success = isEqualMediaCapabilitiesInfo(observed, expected);
+ reportExpected(success, testFuncString, '===', MediaCapabilitiesInfoToString(expected), MediaCapabilitiesInfoToString(observed));
+ }
+
async function doTest()
{
if (!window.internals) {
@@ -22,9 +47,7 @@
consoleWrite('Test that 4k @ 30fps is supported, smooth, but not powerEfficient');
run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});");
info = await shouldResolve(promise);
- testExpected('info.supported', true);
- testExpected('info.powerEfficient', false);
- testExpected('info.smooth', true);
+ testExpectedMediaCapabilitiesInfo('info', {supported: true, powerEfficient: false, smooth: true});
consoleWrite('');
consoleWrite('Test that 4k @ 60fps is supported, but not smooth or powerEfficient');
@@ -31,18 +54,45 @@
run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});");
info = await shouldResolve(promise);
- testExpected('info.supported', true);
- testExpected('info.powerEfficient', false);
- testExpected('info.smooth', false);
+ testExpectedMediaCapabilitiesInfo('info', {supported: true, powerEfficient: false, smooth: false});
consoleWrite('');
+ consoleWrite('Test unsupported codec configurations.');
+ consoleWrite('Profiles 1 and 3 should be unsupported.');
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.01.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});");
+ info = await shouldResolve(promise);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
+
+ consoleWrite('');
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.03.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});");
+ info = await shouldResolve(promise);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
+
+ consoleWrite('');
+ consoleWrite('Pixel depths above 10 are unsupported.');
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.12\"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});");
+ info = await shouldResolve(promise);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
+
+ consoleWrite('');
+ consoleWrite('Chroma subsampling 422 or 444 are unsupported.');
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08.02.01.01.01.01\"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});");
+ info = await shouldResolve(promise);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
+
+ consoleWrite('');
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08.03.01.01.01.01\"', height: 1080, bitrate: 800000, width: 3180, framerate: 60 }});");
+ info = await shouldResolve(promise);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
+
+ consoleWrite('');
consoleWrite('Test that SW VP9 decoder is not supported on battery power when screen is not 4k resolution');
run('internals.setSystemHasACForTesting(false)');
run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});");
info = await shouldResolve(promise);
- testExpected('info.supported', false);
- testExpected('info.powerEfficient', false);
- testExpected('info.smooth', false);
+ testExpectedMediaCapabilitiesInfo('info', {supported: false, powerEfficient: false, smooth: false});
consoleWrite('');
consoleWrite('Test that SW VP9 decoder is supported on battery power when screen is at least 4k resolution');
@@ -49,9 +99,7 @@
run('internals.setVP9ScreenSizeAndScaleForTesting(3840, 2160, 1)');
run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'media-source', video: { contentType: 'video/mp4; codecs=\"vp09.00.41.08\"', height: 1080, bitrate: 800000, width: 3180, framerate: 30 }});");
info = await shouldResolve(promise);
- testExpected('info.supported', true);
- testExpected('info.powerEfficient', false);
- testExpected('info.smooth', true);
+ testExpectedMediaCapabilitiesInfo('info', {supported: true, powerEfficient: false, smooth: true});
endTest();
}
Modified: trunk/Source/WebCore/ChangeLog (265166 => 265167)
--- trunk/Source/WebCore/ChangeLog 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/ChangeLog 2020-07-31 23:40:06 UTC (rev 265167)
@@ -1,3 +1,51 @@
+2020-07-31 Jer Noble <[email protected]>
+
+ [Mac] YouTube does not offer HDR variants to devices which support HDR
+ https://bugs.webkit.org/show_bug.cgi?id=215022
+
+ Reviewed by Eric Carlson.
+
+ Test: platform/mac/media/media-source/is-type-supported-vp9-codec-check.html
+
+ There are three separate issues which block YouTube from offering HDR:
+
+ 1) YouTube checks both valid and invalid VP9 strings through MediaSource.isTypeSupported(), and UAs
+ which answer `true` to even invalid VP9 strings are blocked from HDR. To solve this, we will now
+ send isTypeSupported() through the same code path as Media Capabilities.
+
+ 2) YouTube's standard valid and invalid VP9 strings do not include the fullRangeVideoFlag field, which
+ would normally be tossed as invalid. We shouldn't relax our requirements globally, so we will
+ add a Quirk which relaxes the requriement that VP9 strings contain a fullRangeVideoFlag.
+
+ 3) YouTube's HDR query checks that window.screen.pixelDepth is > 24. We obviously don't want to change
+ the value of this field globally, so we will add separate Quirk which sets window.screen.pixelDepth
+ to 25 (a totally nonsensical value) when HDR is available.
+
+ Each of these Quirks has a path towards removal for YouTube. The fullRangeVideoFlag field involves
+ YouTube updating their compatibility check to inculde the fullRangeVideoFlag. The pixelDepth check
+ can be replaced by the `dynamic-range:high` Media Query.
+
+ * Modules/mediasource/MediaSource.cpp:
+ (WebCore::addVP9FullRangeVideoFlagToContentType):
+ (WebCore::MediaSource::addSourceBuffer):
+ (WebCore::MediaSource::removeSourceBuffer):
+ (WebCore::MediaSource::isTypeSupported):
+ (WebCore::MediaSource::onReadyStateChange):
+ (WebCore::MediaSource::activeRanges const):
+ * Modules/mediasource/MediaSource.h:
+ * page/Quirks.cpp:
+ (WebCore::Quirks::needsVP9FullRangeFlagQuirk const):
+ (WebCore::Quirks::needsHDRPixelDepthQuirk const):
+ * page/Quirks.h:
+ * page/Screen.cpp:
+ (WebCore::Screen::pixelDepth const):
+ * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
+ (WebCore::SourceBufferParserWebM::isContentTypeSupported):
+ * platform/graphics/cocoa/VP9UtilitiesCocoa.h:
+ * platform/graphics/cocoa/VP9UtilitiesCocoa.mm:
+ (WebCore::isVPCodecConfigurationRecordSupported):
+ (WebCore::validateVPParameters):
+
2020-07-31 Chris Dumez <[email protected]>
Add linked-on-after check to keep WebSQL working in UIWebView until apps are rebuilt with iOS 14 SDK
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (265166 => 265167)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2020-07-31 23:40:06 UTC (rev 265167)
@@ -42,6 +42,7 @@
#include "Logging.h"
#include "MediaSourcePrivate.h"
#include "MediaSourceRegistry.h"
+#include "Quirks.h"
#include "Settings.h"
#include "SourceBuffer.h"
#include "SourceBufferList.h"
@@ -659,6 +660,36 @@
}
}
+static ContentType addVP9FullRangeVideoFlagToContentType(const ContentType& type)
+{
+ auto countPeriods = [] (const String& codec) {
+ unsigned count = 0;
+ unsigned position = 0;
+
+ while (codec.find('.', position) != notFound) {
+ ++count;
+ ++position;
+ }
+
+ return count;
+ };
+
+ for (auto codec : type.codecs()) {
+ if (!codec.startsWith("vp09") || countPeriods(codec) != 7)
+ continue;
+
+ auto rawType = type.raw();
+ auto position = rawType.find(codec);
+ ASSERT(position != notFound);
+ if (position == notFound)
+ continue;
+
+ rawType.insert(".00", position + codec.length());
+ return ContentType(rawType);
+ }
+ return type;
+}
+
ExceptionOr<Ref<SourceBuffer>> MediaSource::addSourceBuffer(const String& type)
{
DEBUG_LOG(LOGIDENTIFIER, type);
@@ -676,7 +707,11 @@
if (m_mediaElement)
mediaContentTypesRequiringHardwareSupport.appendVector(m_mediaElement->document().settings().mediaContentTypesRequiringHardwareSupport());
- if (!isTypeSupported(type, WTFMove(mediaContentTypesRequiringHardwareSupport)))
+ auto context = scriptExecutionContext();
+ if (!context)
+ return Exception { NotAllowedError };
+
+ if (!isTypeSupported(*context, type, WTFMove(mediaContentTypesRequiringHardwareSupport)))
return Exception { NotSupportedError };
// 4. If the readyState attribute is not in the "open" state then throw an
@@ -686,6 +721,9 @@
// 5. Create a new SourceBuffer object and associated resources.
ContentType contentType(type);
+ if (context->isDocument() && downcast<Document>(context)->quirks().needsVP9FullRangeFlagQuirk())
+ contentType = addVP9FullRangeVideoFlagToContentType(contentType);
+
auto sourceBufferPrivate = createSourceBufferPrivate(contentType);
if (sourceBufferPrivate.hasException()) {
@@ -876,10 +914,10 @@
mediaContentTypesRequiringHardwareSupport.appendVector(document.settings().mediaContentTypesRequiringHardwareSupport());
}
- return isTypeSupported(type, WTFMove(mediaContentTypesRequiringHardwareSupport));
+ return isTypeSupported(context, type, WTFMove(mediaContentTypesRequiringHardwareSupport));
}
-bool MediaSource::isTypeSupported(const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport)
+bool MediaSource::isTypeSupported(ScriptExecutionContext& context, const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport)
{
// Section 2.2 isTypeSupported() method steps.
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
@@ -888,6 +926,9 @@
return false;
ContentType contentType(type);
+ if (context.isDocument() && downcast<Document>(context).quirks().needsVP9FullRangeFlagQuirk())
+ contentType = addVP9FullRangeVideoFlagToContentType(contentType);
+
String codecs = contentType.parameter("codecs");
// 2. If type does not contain a valid MIME type string, then return false.
@@ -1032,8 +1073,14 @@
return activeRanges;
}
-ExceptionOr<Ref<SourceBufferPrivate>> MediaSource::createSourceBufferPrivate(const ContentType& type)
+ExceptionOr<Ref<SourceBufferPrivate>> MediaSource::createSourceBufferPrivate(const ContentType& incomingType)
{
+ ContentType type { incomingType };
+
+ auto context = scriptExecutionContext();
+ if (context && context->isDocument() && downcast<Document>(context)->quirks().needsVP9FullRangeFlagQuirk())
+ type = addVP9FullRangeVideoFlagToContentType(incomingType);
+
RefPtr<SourceBufferPrivate> sourceBufferPrivate;
switch (m_private->addSourceBuffer(type, sourceBufferPrivate)) {
case MediaSourcePrivate::Ok:
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.h (265166 => 265167)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.h 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.h 2020-07-31 23:40:06 UTC (rev 265167)
@@ -130,7 +130,7 @@
void stop() final;
const char* activeDOMObjectName() const final;
bool virtualHasPendingActivity() const final;
- static bool isTypeSupported(const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport);
+ static bool isTypeSupported(ScriptExecutionContext&, const String& type, Vector<ContentType>&& contentTypesRequiringHardwareSupport);
void setPrivateAndOpen(Ref<MediaSourcePrivate>&&) final;
void seekToTime(const MediaTime&) final;
Modified: trunk/Source/WebCore/page/Quirks.cpp (265166 => 265167)
--- trunk/Source/WebCore/page/Quirks.cpp 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/page/Quirks.cpp 2020-07-31 23:40:06 UTC (rev 265167)
@@ -961,4 +961,27 @@
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
+bool Quirks::needsVP9FullRangeFlagQuirk() const
+{
+ if (!needsQuirks())
+ return false;
+
+ if (!m_needsVP9FullRangeFlagQuirk)
+ m_needsVP9FullRangeFlagQuirk = equalLettersIgnoringASCIICase(m_document->url().host(), "www.youtube.com");
+
+ return *m_needsVP9FullRangeFlagQuirk;
}
+
+bool Quirks::needsHDRPixelDepthQuirk() const
+{
+ if (!needsQuirks())
+ return false;
+
+ if (!m_needsHDRPixelDepthQuirk)
+ m_needsHDRPixelDepthQuirk = equalLettersIgnoringASCIICase(m_document->url().host(), "www.youtube.com");
+
+ return *m_needsHDRPixelDepthQuirk;
+}
+
+
+}
Modified: trunk/Source/WebCore/page/Quirks.h (265166 => 265167)
--- trunk/Source/WebCore/page/Quirks.h 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/page/Quirks.h 2020-07-31 23:40:06 UTC (rev 265167)
@@ -108,6 +108,9 @@
enum StorageAccessResult : bool { ShouldNotCancelEvent, ShouldCancelEvent };
StorageAccessResult triggerOptionalStorageAccessQuirk(const Element&, const AtomString& eventType) const;
+ bool needsVP9FullRangeFlagQuirk() const;
+ bool needsHDRPixelDepthQuirk() const;
+
private:
bool needsQuirks() const;
@@ -133,6 +136,8 @@
#endif
mutable Optional<bool> m_needsCanPlayAfterSeekedQuirk;
mutable Optional<bool> m_shouldBypassAsyncScriptDeferring;
+ mutable Optional<bool> m_needsVP9FullRangeFlagQuirk;
+ mutable Optional<bool> m_needsHDRPixelDepthQuirk;
};
}
Modified: trunk/Source/WebCore/page/Screen.cpp (265166 => 265167)
--- trunk/Source/WebCore/page/Screen.cpp 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/page/Screen.cpp 2020-07-31 23:40:06 UTC (rev 265167)
@@ -33,6 +33,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "PlatformScreen.h"
+#include "Quirks.h"
#include "ResourceLoadObserver.h"
#include "RuntimeEnabledFeatures.h"
#include <wtf/IsoMallocInlines.h>
@@ -85,7 +86,12 @@
return 0;
if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled())
ResourceLoadObserver::shared().logScreenAPIAccessed(*frame->document(), ResourceLoadStatistics::ScreenAPI::PixelDepth);
- return static_cast<unsigned>(screenDepth(frame->view()));
+
+ auto* document = window()->document();
+ if (!document || !document->quirks().needsHDRPixelDepthQuirk() || !screenSupportsHighDynamicRange(frame->view()))
+ return static_cast<unsigned>(screenDepth(frame->view()));
+
+ return static_cast<unsigned>(screenDepth(frame->view())) + 1;
}
int Screen::availLeft() const
Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (265166 => 265167)
--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp 2020-07-31 23:40:06 UTC (rev 265167)
@@ -243,8 +243,13 @@
auto splitResults = StringView(codecsParameter).split(',');
for (auto split : splitResults) {
if (split.startsWith("vp09")) {
- if (!isVP9DecoderAvailable())
+ auto codecParameters = parseVPCodecParameters(split);
+ if (!codecParameters)
return MediaPlayerEnums::SupportsType::IsNotSupported;
+
+ if (!isVPCodecConfigurationRecordSupported(*codecParameters))
+ return MediaPlayerEnums::SupportsType::IsNotSupported;
+
continue;
}
// FIXME: Add Opus Support
Modified: trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h (265166 => 265167)
--- trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h 2020-07-31 23:40:06 UTC (rev 265167)
@@ -41,6 +41,7 @@
WEBCORE_EXPORT extern void registerWebKitVP9Decoder();
WEBCORE_EXPORT extern void registerSupplementalVP9Decoder();
extern bool isVP9DecoderAvailable();
+extern bool isVPCodecConfigurationRecordSupported(VPCodecConfigurationRecord&);
extern bool validateVPParameters(VPCodecConfigurationRecord&, MediaCapabilitiesInfo&, const VideoConfiguration&);
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm (265166 => 265167)
--- trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm 2020-07-31 23:36:43 UTC (rev 265166)
+++ trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm 2020-07-31 23:40:06 UTC (rev 265167)
@@ -118,11 +118,63 @@
return noErr == VTSelectAndCreateVideoDecoderInstance(kCMVideoCodecType_VP9, kCFAllocatorDefault, nullptr, nullptr);
}
-bool validateVPParameters(VPCodecConfigurationRecord& codecConfiguration, MediaCapabilitiesInfo& info, const VideoConfiguration& videoConfiguration)
+bool isVPCodecConfigurationRecordSupported(VPCodecConfigurationRecord& codecConfiguration)
{
if (!isVP9DecoderAvailable())
return false;
+ // HW & SW VP9 Decoders support Profile 0 & 2:
+ if (codecConfiguration.profile && codecConfiguration.profile != 2)
+ return false;
+
+ // HW & SW VP9 Decoders support only 420 chroma subsampling:
+ if (codecConfiguration.chromaSubsampling > VPConfigurationChromaSubsampling::Subsampling_420_Colocated)
+ return false;
+
+ // HW & SW VP9 Decoders support 8 or 10 bit color:
+ if (codecConfiguration.bitDepth > 10)
+ return false;
+
+ // HW & SW VP9 Decoders support up to Level 6:
+ if (codecConfiguration.level > VPConfigurationLevel::Level_6)
+ return false;
+
+ // Hardware decoders are always available.
+ if (canLoad_VideoToolbox_VTIsHardwareDecodeSupported() && VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9) && !hardwareVP9DecoderDisabledForTesting)
+ return true;
+
+ // For wall-powered devices, always report VP9 as supported, even if not powerEfficient.
+ if (!systemHasBattery())
+ return true;
+
+ // For battery-powered devices, always report VP9 as supported when running on AC power,
+ // but only on battery when there is an attached screen whose resolution is large enough
+ // to support 4K video.
+ if (systemHasAC())
+ return true;
+
+ bool has4kScreen = false;
+
+ if (screenSizeAndScaleForTesting) {
+ auto screenSize = FloatSize(screenSizeAndScaleForTesting->width, screenSizeAndScaleForTesting->height).scaled(screenSizeAndScaleForTesting->scale);
+ has4kScreen = resolutionCategory(screenSize) >= ResolutionCategory::R_4K;
+ } else {
+ for (auto& screenData : getScreenProperties().screenDataMap.values()) {
+ if (resolutionCategory(screenData.screenRect.size().scaled(screenData.scaleFactor)) >= ResolutionCategory::R_4K) {
+ has4kScreen = true;
+ break;
+ }
+ }
+ }
+
+ return has4kScreen;
+}
+
+bool validateVPParameters(VPCodecConfigurationRecord& codecConfiguration, MediaCapabilitiesInfo& info, const VideoConfiguration& videoConfiguration)
+{
+ if (!isVPCodecConfigurationRecordSupported(codecConfiguration))
+ return false;
+
// VideoConfiguration and VPCodecConfigurationRecord can have conflicting values for HDR properties. If so, reject.
if (videoConfiguration.transferFunction) {
// Note: Transfer Characteristics are defined by ISO/IEC 23091-2:2019.
@@ -140,24 +192,6 @@
}
if (canLoad_VideoToolbox_VTIsHardwareDecodeSupported() && VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9) && !hardwareVP9DecoderDisabledForTesting) {
- info.powerEfficient = true;
-
- // HW VP9 Decoder supports Profile 0 & 2:
- if (codecConfiguration.profile && codecConfiguration.profile != 2)
- return false;
-
- // HW VP9 Decoder supports up to Level 6:
- if (codecConfiguration.level > VPConfigurationLevel::Level_6)
- return false;
-
- // HW VP9 Decoder supports 8 or 10 bit color:
- if (codecConfiguration.bitDepth > 10)
- return false;
-
- // HW VP9 Decoder suports only 420 chroma subsampling:
- if (codecConfiguration.chromaSubsampling > VPConfigurationChromaSubsampling::Subsampling_420_Colocated)
- return false;
-
// HW VP9 Decoder does not support alpha channel:
if (videoConfiguration.alphaChannel && *videoConfiguration.alphaChannel)
return false;
@@ -173,9 +207,13 @@
else
info.smooth = true;
+ info.powerEfficient = true;
+ info.supported = true;
return true;
}
+ info.powerEfficient = false;
+
// SW VP9 Decoder has much more variable capabilities depending on CPU characteristics.
// FIXME: Add a lookup table for device-to-capabilities. For now, assume that the SW VP9
// decoder can support 4K @ 30.
@@ -214,11 +252,10 @@
}
}
- if (!has4kScreen) {
- info.supported = false;
+ if (!has4kScreen)
return false;
- }
+ info.supported = true;
return true;
}