Diff
Modified: trunk/LayoutTests/ChangeLog (237267 => 237268)
--- trunk/LayoutTests/ChangeLog 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/LayoutTests/ChangeLog 2018-10-18 21:44:24 UTC (rev 237268)
@@ -1,3 +1,13 @@
+2018-10-18 Jer Noble <jer.no...@apple.com>
+
+ Add support for MediaKeyEncryptionScheme
+ https://bugs.webkit.org/show_bug.cgi?id=190173
+
+ Reviewed by Eric Carlson.
+
+ * media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-expected.txt:
+ * media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html:
+
2018-10-18 Youenn Fablet <you...@apple.com>
Handle MDNS resolution of candidates through libwebrtc directly
Modified: trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-expected.txt (237267 => 237268)
--- trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-expected.txt 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-expected.txt 2018-10-18 21:44:24 UTC (rev 237268)
@@ -85,5 +85,24 @@
Promise resolved OK
EXPECTED (access.getConfiguration().label == 'persistent-state-not-required') OK
EXPECTED (access.getConfiguration().persistentState == 'not-allowed') OK
+
+RUN(mock.supportedEncryptionSchemes = ["cenc"])
+SET capabilities = '[ { "label": "encryption-scheme-cenc", "initDataTypes": [ "mock" ], "videoCapabilities": [ { "contentType": "video/mock; codecs=\"mock\"", "encryptionScheme": "cenc" } ] } ]'
+RUN(promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", capabilities))
+Promise resolved OK
+EXPECTED (access.getConfiguration().label == 'encryption-scheme-cenc') OK
+EXPECTED (access.getConfiguration().videoCapabilities[0].encryptionScheme == 'cenc') OK
+
+SET capabilities = '[ { "initDataTypes": [ "mock" ], "videoCapabilities": [ { "contentType": "video/mock; codecs=\"mock\"", "encryptionScheme": "cbcs" } ] } ]'
+RUN(promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", capabilities))
+Promise rejected correctly OK
+EXPECTED (exceptionCode.name == 'NotSupportedError') OK
+
+RUN(mock.supportedEncryptionSchemes = ["cenc", "cbcs"])
+SET capabilities = '[ { "label": "encryption-scheme-cbcs", "initDataTypes": [ "mock" ], "videoCapabilities": [ { "contentType": "video/mock; codecs=\"mock\"", "encryptionScheme": "cbcs" } ] } ]'
+RUN(promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", capabilities))
+Promise resolved OK
+EXPECTED (access.getConfiguration().label == 'encryption-scheme-cbcs') OK
+EXPECTED (access.getConfiguration().videoCapabilities[0].encryptionScheme == 'cbcs') OK
END OF TEST
Modified: trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html (237267 => 237268)
--- trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html 2018-10-18 21:44:24 UTC (rev 237268)
@@ -230,6 +230,45 @@
testExpected('access.getConfiguration().persistentState', 'not-allowed');
});
},
+
+ function() {
+ run('mock.supportedEncryptionSchemes = ["cenc"]');
+ passingTestWithCapabilities([{
+ label: 'encryption-scheme-cenc',
+ initDataTypes: ['mock'],
+ videoCapabilities: [{ contentType: 'video/mock; codecs="mock"', encryptionScheme: 'cenc'}],
+ }],
+ mediaKeySystemAccess => {
+ window.access = mediaKeySystemAccess;
+ testExpected('access.getConfiguration().label', 'encryption-scheme-cenc');
+ testExpected('access.getConfiguration().videoCapabilities[0].encryptionScheme', 'cenc');
+ });
+ },
+
+ function() {
+ failingTestWithCapabilities([{
+ initDataTypes: ['mock'],
+ videoCapabilities: [{ contentType: 'video/mock; codecs="mock"', encryptionScheme: 'cbcs'}],
+ }],
+ exceptionCode => {
+ window.exceptionCode = exceptionCode;
+ testExpected('exceptionCode.name', 'NotSupportedError');
+ });
+ },
+
+ function() {
+ run('mock.supportedEncryptionSchemes = ["cenc", "cbcs"]');
+ passingTestWithCapabilities([{
+ label: 'encryption-scheme-cbcs',
+ initDataTypes: ['mock'],
+ videoCapabilities: [{ contentType: 'video/mock; codecs="mock"', encryptionScheme: 'cbcs'}],
+ }],
+ mediaKeySystemAccess => {
+ window.access = mediaKeySystemAccess;
+ testExpected('access.getConfiguration().label', 'encryption-scheme-cbcs');
+ testExpected('access.getConfiguration().videoCapabilities[0].encryptionScheme', 'cbcs');
+ });
+ },
];
</script>
</head>
Modified: trunk/Source/WebCore/CMakeLists.txt (237267 => 237268)
--- trunk/Source/WebCore/CMakeLists.txt 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-10-18 21:44:24 UTC (rev 237268)
@@ -1177,6 +1177,7 @@
html/MediaEncryptedEvent.cpp
)
list(APPEND WebCore_IDL_FILES
+ Modules/encryptedmedia/MediaKeyEncryptionScheme.idl
Modules/encryptedmedia/MediaKeyMessageEvent.idl
Modules/encryptedmedia/MediaKeySession.idl
Modules/encryptedmedia/MediaKeySessionType.idl
Modified: trunk/Source/WebCore/ChangeLog (237267 => 237268)
--- trunk/Source/WebCore/ChangeLog 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/ChangeLog 2018-10-18 21:44:24 UTC (rev 237268)
@@ -1,3 +1,44 @@
+2018-10-18 Jer Noble <jer.no...@apple.com>
+
+ Add support for MediaKeyEncryptionScheme
+ https://bugs.webkit.org/show_bug.cgi?id=190173
+
+ Reviewed by Eric Carlson.
+
+ Added sub-tests to: media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html
+
+ Add support for the MediaKeyEncryptionScheme extension to EME, as detailed here:
+ <https://github.com/WICG/encrypted-media-encryption-scheme/blob/master/explainer.md>
+
+ As the strings "cenc" and "cbcs" are explicitly lower-case, add support to the bindings generator to keep
+ those strings as lower-case when converting from IDL.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Modules/encryptedmedia/MediaKeyEncryptionScheme.h:
+ * Modules/encryptedmedia/MediaKeyEncryptionScheme.idl:
+ * Modules/encryptedmedia/MediaKeySystemMediaCapability.h:
+ * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/scripts/CodeGenerator.pm:
+ (WK_ucfirst):
+ * platform/encryptedmedia/CDMEncryptionScheme.h: Copied from Source/WebCore/testing/MockCDMFactory.idl.
+ * platform/encryptedmedia/CDMMediaCapability.h:
+ * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
+ (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsMediaCapability):
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
+ * testing/MockCDMFactory.cpp:
+ (WebCore::m_supportedEncryptionSchemes):
+ (WebCore::MockCDM::supportsConfiguration const):
+ * testing/MockCDMFactory.h:
+ (WebCore::MockCDMFactory::supportedEncryptionSchemes const):
+ (WebCore::MockCDMFactory::setSupportedEncryptionSchemes):
+ * testing/MockCDMFactory.idl:
+
2018-10-18 Alexey Proskuryakov <a...@apple.com>
Switch from PLATFORM(IOS) to PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/DerivedSources.make (237267 => 237268)
--- trunk/Source/WebCore/DerivedSources.make 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/DerivedSources.make 2018-10-18 21:44:24 UTC (rev 237268)
@@ -128,6 +128,7 @@
$(WebCore)/Modules/credentialmanagement/CredentialRequestOptions.idl \
$(WebCore)/Modules/credentialmanagement/CredentialsContainer.idl \
$(WebCore)/Modules/credentialmanagement/NavigatorCredentials.idl \
+ $(WebCore)/Modules/encryptedmedia/MediaKeyEncryptionScheme.idl \
$(WebCore)/Modules/encryptedmedia/MediaKeyMessageEvent.idl \
$(WebCore)/Modules/encryptedmedia/MediaKeySession.idl \
$(WebCore)/Modules/encryptedmedia/MediaKeySessionType.idl \
Copied: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.h (from rev 237267, trunk/Source/WebCore/testing/MockCDMFactory.idl) (0 => 237268)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.h (rev 0)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ENCRYPTED_MEDIA)
+
+#include "CDMEncryptionScheme.h"
+
+namespace WebCore {
+
+using MediaKeyEncryptionScheme = CDMEncryptionScheme;
+
+} // namespace WebCore
+
+#endif // ENABLE(ENCRYPTED_MEDIA)
Copied: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.idl (from rev 237267, trunk/Source/WebCore/testing/MockCDMFactory.idl) (0 => 237268)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.idl (rev 0)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyEncryptionScheme.idl 2018-10-18 21:44:24 UTC (rev 237268)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=ENCRYPTED_MEDIA,
+ ImplementedAs=MediaKeyEncryptionScheme,
+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT
+]
+enum MediaKeyEncryptionScheme {
+ "cenc",
+ "cbcs"
+};
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.h (237267 => 237268)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.h 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -31,6 +31,7 @@
#if ENABLE(ENCRYPTED_MEDIA)
#include "CDMMediaCapability.h"
+#include "MediaKeyEncryptionScheme.h"
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.idl (237267 => 237268)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.idl 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.idl 2018-10-18 21:44:24 UTC (rev 237268)
@@ -32,4 +32,5 @@
] dictionary MediaKeySystemMediaCapability {
DOMString contentType = "";
DOMString robustness = "";
+ MediaKeyEncryptionScheme? encryptionScheme = null;
};
Modified: trunk/Source/WebCore/Sources.txt (237267 => 237268)
--- trunk/Source/WebCore/Sources.txt 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/Sources.txt 2018-10-18 21:44:24 UTC (rev 237268)
@@ -3248,6 +3248,7 @@
#if ENABLE_ENCRYPTED_MEDIA
+JSMediaKeyEncryptionScheme.cpp
JSMediaKeyMessageEvent.cpp
JSMediaKeySession.cpp
JSMediaKeySessionType.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237267 => 237268)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-10-18 21:44:24 UTC (rev 237268)
@@ -4141,6 +4141,7 @@
CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD27F6E4145767870078207D /* MediaController.h */; settings = {ATTRIBUTES = (Private, ); }; };
CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
CDF7483F18FEBCEC0006ECC0 /* GridPositionsResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF7483D18FEBCEC0006ECC0 /* GridPositionsResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ CDF756A3215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF756A1215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h */; };
CDFC360618CA61C20026E56F /* RemoteCommandListener.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFC360418CA61C20026E56F /* RemoteCommandListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE057FA41220731100A476D5 /* DocumentMarkerController.h */; settings = {ATTRIBUTES = (Private, ); }; };
CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE08C3D0152B599A0021B8C2 /* AlternativeTextController.h */; settings = {ATTRIBUTES = (); }; };
@@ -13581,6 +13582,11 @@
CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControllerInterface.h; sourceTree = "<group>"; };
CDF7483C18FEBCEC0006ECC0 /* GridPositionsResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GridPositionsResolver.cpp; sourceTree = "<group>"; };
CDF7483D18FEBCEC0006ECC0 /* GridPositionsResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridPositionsResolver.h; sourceTree = "<group>"; };
+ CDF7569B215C23A400EFCB50 /* CDMEncryptionScheme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDMEncryptionScheme.h; sourceTree = "<group>"; };
+ CDF7569D215C244400EFCB50 /* MediaKeyEncryptionScheme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaKeyEncryptionScheme.h; sourceTree = "<group>"; };
+ CDF7569E215C285E00EFCB50 /* MediaKeyEncryptionScheme.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaKeyEncryptionScheme.idl; sourceTree = "<group>"; };
+ CDF756A0215C29E800EFCB50 /* JSMediaKeyEncryptionScheme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaKeyEncryptionScheme.cpp; sourceTree = "<group>"; };
+ CDF756A1215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaKeyEncryptionScheme.h; sourceTree = "<group>"; };
CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCommandListenerIOS.h; sourceTree = "<group>"; };
CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteCommandListenerIOS.mm; sourceTree = "<group>"; };
CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteCommandListener.cpp; sourceTree = "<group>"; };
@@ -19793,6 +19799,8 @@
A5071E841C56D079009951BE /* ResourceUsageThread.h */,
7C52229B1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.cpp */,
7C52229C1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.h */,
+ CD9A87F2215D43A6006F17B5 /* Quirks.cpp */,
+ CD9A87F1215D43A6006F17B5 /* Quirks.h */,
BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
BCEC01BC0C274DAC009F4EC9 /* Screen.idl */,
@@ -25072,6 +25080,7 @@
isa = PBXGroup;
children = (
CD94A5D91F71CB9F00F525C5 /* clearkey */,
+ CDF7569B215C23A400EFCB50 /* CDMEncryptionScheme.h */,
CD94A5D11F71CB6B00F525C5 /* CDMFactory.cpp */,
CD94A5D21F71CB6B00F525C5 /* CDMFactory.h */,
CD94A5CE1F71CB6A00F525C5 /* CDMInstance.h */,
@@ -25143,6 +25152,8 @@
2D9BF7331DBFDC0F007A7D99 /* MediaKeys.cpp */,
2D9BF7341DBFDC0F007A7D99 /* MediaKeys.h */,
2D9BF6F61DBFB71F007A7D99 /* MediaKeys.idl */,
+ CDF7569D215C244400EFCB50 /* MediaKeyEncryptionScheme.h */,
+ CDF7569E215C285E00EFCB50 /* MediaKeyEncryptionScheme.idl */,
2D9BF7351DBFDC0F007A7D99 /* MediaKeySession.cpp */,
2D9BF7361DBFDC0F007A7D99 /* MediaKeySession.h */,
2D9BF6F71DBFB71F007A7D99 /* MediaKeySession.idl */,
@@ -25172,6 +25183,8 @@
CDA98DCD1601515C00FEA3B1 /* EncryptedMedia */ = {
isa = PBXGroup;
children = (
+ CDF756A0215C29E800EFCB50 /* JSMediaKeyEncryptionScheme.cpp */,
+ CDF756A1215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h */,
2D9BF7131DBFDAB1007A7D99 /* JSMediaKeyMessageEvent.cpp */,
2D9BF7141DBFDAB1007A7D99 /* JSMediaKeyMessageEvent.h */,
2D9BF7151DBFDAB1007A7D99 /* JSMediaKeys.cpp */,
@@ -29942,6 +29955,7 @@
51058AE01D67C229009A538C /* MockGamepad.h in Headers */,
51058AE21D67C229009A538C /* MockGamepadProvider.h in Headers */,
413CCD4A20DE034F0065A21A /* MockMediaDevice.h in Headers */,
+ CDF756A3215C29E900EFCB50 /* JSMediaKeyEncryptionScheme.h in Headers */,
CDF2B0131820540600F2B424 /* MockMediaPlayerMediaSource.h in Headers */,
CDF2B0151820540600F2B424 /* MockMediaSourcePrivate.h in Headers */,
A1BB85A92159B02C0067E07D /* MockPaymentError.h in Headers */,
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (237267 => 237268)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2018-10-18 21:44:24 UTC (rev 237268)
@@ -694,6 +694,8 @@
$ret =~ s/Xml/XML/ if $ret =~ /^Xml[^a-z]/;
$ret =~ s/Svg/SVG/ if $ret =~ /^Svg/;
$ret =~ s/Srgb/SRGB/ if $ret =~ /^Srgb/;
+ $ret =~ s/Cenc/cenc/ if $ret =~ /^Cenc/;
+ $ret =~ s/Cbcs/cbcs/ if $ret =~ /^Cbcs/;
return $ret;
}
Copied: trunk/Source/WebCore/platform/encryptedmedia/CDMEncryptionScheme.h (from rev 237267, trunk/Source/WebCore/testing/MockCDMFactory.idl) (0 => 237268)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMEncryptionScheme.h (rev 0)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMEncryptionScheme.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ENCRYPTED_MEDIA)
+
+namespace WebCore {
+
+enum class CDMEncryptionScheme {
+ cenc,
+ cbcs,
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h (237267 => 237268)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMMediaCapability.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -30,6 +30,7 @@
#if ENABLE(ENCRYPTED_MEDIA)
+#include "CDMEncryptionScheme.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -37,6 +38,7 @@
struct CDMMediaCapability {
String contentType;
String robustness;
+ std::optional<CDMEncryptionScheme> encryptionScheme;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp (237267 => 237268)
--- trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp 2018-10-18 21:44:24 UTC (rev 237268)
@@ -260,13 +260,13 @@
if (!configuration.audioCapabilities.isEmpty()
&& !WTF::anyOf(configuration.audioCapabilities, [](auto& capability) {
- return CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(capability.contentType);
+ return CDMInstanceFairPlayStreamingAVFObjC::supportsMediaCapability(capability);
}))
return false;
if (!configuration.videoCapabilities.isEmpty()
&& !WTF::anyOf(configuration.videoCapabilities, [](auto& capability) {
- return CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(capability.contentType);
+ return CDMInstanceFairPlayStreamingAVFObjC::supportsMediaCapability(capability);
}))
return false;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (237267 => 237268)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -44,6 +44,7 @@
namespace WebCore {
class CDMInstanceSessionFairPlayStreamingAVFObjC;
+struct CDMMediaCapability;
class CDMInstanceFairPlayStreamingAVFObjC final : public CDMInstance, public CanMakeWeakPtr<CDMInstanceFairPlayStreamingAVFObjC> {
public:
@@ -52,6 +53,7 @@
static bool supportsPersistableState();
static bool supportsPersistentKeys();
+ static bool supportsMediaCapability(const CDMMediaCapability&);
static bool mimeTypeIsPlayable(const String&);
ImplementationType implementationType() const final { return ImplementationType::FairPlayStreaming; }
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (237267 => 237268)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2018-10-18 21:44:24 UTC (rev 237268)
@@ -30,6 +30,7 @@
#import "CDMFairPlayStreaming.h"
#import "CDMKeySystemConfiguration.h"
+#import "CDMMediaCapability.h"
#import "NotImplemented.h"
#import "SharedBuffer.h"
#import "TextDecoder.h"
@@ -158,9 +159,16 @@
#endif
}
-bool CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable(const String& contentType)
+bool CDMInstanceFairPlayStreamingAVFObjC::supportsMediaCapability(const CDMMediaCapability& capability)
{
- return [getAVURLAssetClass() isPlayableExtendedMIMEType:contentType];
+ if (![getAVURLAssetClass() isPlayableExtendedMIMEType:capability.contentType])
+ return false;
+
+ // FairPlay only supports 'cbcs' encryption:
+ if (capability.encryptionScheme && capability.encryptionScheme.value() != CDMEncryptionScheme::cbcs)
+ return false;
+
+ return true;
}
CDMInstance::SuccessValue CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration(const CDMKeySystemConfiguration& configuration)
Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (237267 => 237268)
--- trunk/Source/WebCore/testing/MockCDMFactory.cpp 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp 2018-10-18 21:44:24 UTC (rev 237268)
@@ -30,6 +30,7 @@
#include "InitDataRegistry.h"
#include <_javascript_Core/ArrayBuffer.h>
+#include <wtf/Algorithms.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/UUID.h>
#include <wtf/text/StringHash.h>
@@ -39,6 +40,7 @@
MockCDMFactory::MockCDMFactory()
: m_supportedSessionTypes({ MediaKeySessionType::Temporary, MediaKeySessionType::PersistentUsageRecord, MediaKeySessionType::PersistentLicense })
+ , m_supportedEncryptionSchemes({ MediaKeyEncryptionScheme::cenc })
{
CDMFactory::registerFactory(*this);
}
@@ -113,9 +115,20 @@
return false;
}
-bool MockCDM::supportsConfiguration(const MediaKeySystemConfiguration&) const
+bool MockCDM::supportsConfiguration(const MediaKeySystemConfiguration& configuration) const
{
- // NOTE: Implement;
+ auto capabilityHasSupportedEncryptionScheme = [&] (auto& capability) {
+ if (capability.encryptionScheme)
+ return m_factory->supportedEncryptionSchemes().contains(capability.encryptionScheme.value());
+ return true;
+ };
+
+ if (!configuration.audioCapabilities.isEmpty() && !anyOf(configuration.audioCapabilities, capabilityHasSupportedEncryptionScheme))
+ return false;
+
+ if (!configuration.videoCapabilities.isEmpty() && !anyOf(configuration.videoCapabilities, capabilityHasSupportedEncryptionScheme))
+ return false;
+
return true;
}
Modified: trunk/Source/WebCore/testing/MockCDMFactory.h (237267 => 237268)
--- trunk/Source/WebCore/testing/MockCDMFactory.h 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/testing/MockCDMFactory.h 2018-10-18 21:44:24 UTC (rev 237268)
@@ -32,6 +32,7 @@
#include "CDMInstance.h"
#include "CDMInstanceSession.h"
#include "CDMPrivate.h"
+#include "MediaKeyEncryptionScheme.h"
#include "MediaKeysRequirement.h"
#include <wtf/HashMap.h>
#include <wtf/RefCounted.h>
@@ -69,6 +70,9 @@
bool supportsSessions() const { return m_supportsSessions; }
void setSupportsSessions(bool flag) { m_supportsSessions = flag; }
+ const Vector<MediaKeyEncryptionScheme>& supportedEncryptionSchemes() const { return m_supportedEncryptionSchemes; }
+ void setSupportedEncryptionSchemes(Vector<MediaKeyEncryptionScheme>&& schemes) { m_supportedEncryptionSchemes = WTFMove(schemes); }
+
void unregister();
bool hasSessionWithID(const String& id) { return m_sessions.contains(id); }
@@ -87,6 +91,7 @@
Vector<AtomicString> m_supportedDataTypes;
Vector<MediaKeySessionType> m_supportedSessionTypes;
Vector<String> m_supportedRobustness;
+ Vector<MediaKeyEncryptionScheme> m_supportedEncryptionSchemes;
bool m_registered { true };
bool m_canCreateInstances { true };
bool m_supportsServerCertificates { true };
Modified: trunk/Source/WebCore/testing/MockCDMFactory.idl (237267 => 237268)
--- trunk/Source/WebCore/testing/MockCDMFactory.idl 2018-10-18 21:41:41 UTC (rev 237267)
+++ trunk/Source/WebCore/testing/MockCDMFactory.idl 2018-10-18 21:44:24 UTC (rev 237268)
@@ -36,6 +36,7 @@
attribute boolean canCreateInstances;
attribute boolean supportsServerCertificates;
attribute boolean supportsSessions;
+ attribute sequence<MediaKeyEncryptionScheme> supportedEncryptionSchemes;
void unregister();
};