WebKit Bugzilla
Attachment 349921 Details for
Bug 189565
: Add support for HEVC codec types in Media Capabilities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-189565-20180917130254.patch (text/plain), 60.72 KB, created by
Jer Noble
on 2018-09-17 13:02:55 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-09-17 13:02:55 PDT
Size:
60.72 KB
patch
obsolete
>Subversion Revision: 236078 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index ef794f8f358aa9d6679f2a9fb0fbbec79a68a4d0..6775e0dcdaa91752d8c659d117b83b7ed718a8bf 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-09-12 Jer Noble <jer.noble@apple.com> >+ >+ Add support for HEVC codec types in Media Capabilities >+ https://bugs.webkit.org/show_bug.cgi?id=189565 >+ >+ Reviewed by Eric Carlson. >+ >+ Extract the toIntegralType template into its own header. >+ >+ * wtf/CMakeLists.txt: >+ * wtf/text/StringConversion.h: Added. >+ (isCharacterAllowedInBase): >+ (toIntegralType): >+ * wtf/text/WTFString.cpp: >+ > 2018-09-17 Jer Noble <jer.noble@apple.com> > > Enable USE_MEDIAREMOTE on iOS >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c19c24da1025bf6e498de9b361de8d4370f988db..7535dee7b2e4a12d31a1d008c41f34aca741df1f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,42 @@ >+2018-09-12 Jer Noble <jer.noble@apple.com> >+ >+ Add support for HEVC codec types in Media Capabilities >+ https://bugs.webkit.org/show_bug.cgi?id=189565 >+ >+ Reviewed by Eric Carlson. >+ >+ Test: media/hevc-codec-parameters.html >+ >+ Add some utility methods for parsing HEVC codec strings, and using those parsed >+ values to query the platform for detailed support for HEVC decoding. >+ >+ Drive-by fix: Modify MediaEngineConfigurationFactory to allow for null function >+ pointers in the encode/decode factory pair. >+ >+ * Sources.txt: >+ * SourcesCocoa.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * platform/cocoa/VideoToolboxSoftLink.cpp: >+ * platform/cocoa/VideoToolboxSoftLink.h: >+ * platform/graphics/HEVCUtilities.cpp: Added. >+ (WebCore::parseHEVCCodecParameters): >+ * platform/graphics/HEVCUtilities.h: Added. >+ * platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp: Added. >+ (WebCore::validateHEVCParameters): >+ * platform/graphics/cocoa/HEVCUtilitiesCocoa.h: Added. >+ * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp: Added. >+ (WebCore::videoCodecTypeFromRFC4281Type): >+ (WebCore::createMediaPlayerDecodingConfigurationCocoa): >+ * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h: Added. >+ * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: >+ (WebCore::factories): >+ (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration): >+ (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration): >+ * testing/Internals.cpp: >+ (WebCore::Internals::parseHEVCCodecParameters): >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2018-09-17 Simon Fraser <simon.fraser@apple.com> > > Add more ResourceLoading logging, particularly in MemoryCache code >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index 86f4bdbad73ce0f63a4648f03386bffc8e95f4db..0337fec72f0d3716ce618568a84f9e1c8f3c6026 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -329,6 +329,7 @@ > 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoopCF.cpp; sourceTree = "<group>"; }; > 2CDED0F118115C85004DBA70 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; }; > 2CDED0F218115C85004DBA70 /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; }; >+ 304CA4E41375437EBE931D03 /* Markable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Markable.h; sourceTree = "<group>"; }; > 3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSet.h; sourceTree = "<group>"; }; > 313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackTrace.cpp; sourceTree = "<group>"; }; > 37C7CC291EA40A73007BD956 /* WeakLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakLinking.h; sourceTree = "<group>"; }; >@@ -604,6 +605,7 @@ > C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = "<group>"; }; > C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASCIILiteral.cpp; sourceTree = "<group>"; }; > C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomDevice.cpp; sourceTree = "<group>"; }; >+ CD00360D21501F7800F4ED4C /* StringToIntegerConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StringToIntegerConversion.h; sourceTree = "<group>"; }; > CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; }; > CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; }; > CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Algorithms.h; sourceTree = "<group>"; }; >@@ -632,7 +634,6 @@ > E38D6E261F5522E300A75CC4 /* StringBuilderJSON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilderJSON.cpp; sourceTree = "<group>"; }; > E3A32BC21FC830E2007D7E76 /* JSValueMalloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSValueMalloc.cpp; sourceTree = "<group>"; }; > E3A32BC31FC830E2007D7E76 /* JSValueMalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueMalloc.h; sourceTree = "<group>"; }; >- 304CA4E41375437EBE931D03 /* Markable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Markable.h; sourceTree = "<group>"; }; > E3CF76902115D6BA0091DE48 /* CompactPointerTuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactPointerTuple.h; sourceTree = "<group>"; }; > E3E158251EADA53C004A079D /* SystemFree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemFree.h; sourceTree = "<group>"; }; > E431CC4A21187ADB000C8A07 /* DispatchSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DispatchSPI.h; sourceTree = "<group>"; }; >@@ -1226,6 +1227,7 @@ > A8A47328151A825B004123FF /* StringImpl.cpp */, > A8A47329151A825B004123FF /* StringImpl.h */, > A8A4732A151A825B004123FF /* StringOperators.h */, >+ CD00360D21501F7800F4ED4C /* StringToIntegerConversion.h */, > 93F1993D19D7958D00C2390B /* StringView.cpp */, > 1A6EB1DF187D0BD30030126F /* StringView.h */, > F72BBDB107FA424886178B9E /* SymbolImpl.cpp */, >diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt >index fb348abc3f82d05398581718d64ac0f523dcfca6..83f9a4cc57a9f21b609b8a65e26664ba162361c2 100644 >--- a/Source/WTF/wtf/CMakeLists.txt >+++ b/Source/WTF/wtf/CMakeLists.txt >@@ -297,6 +297,7 @@ set(WTF_PUBLIC_HEADERS > text/StringCommon.h > text/StringConcatenate.h > text/StringConcatenateNumbers.h >+ text/StringConversion.h > text/StringHash.h > text/StringHasher.h > text/StringImpl.h >diff --git a/Source/WTF/wtf/text/StringToIntegerConversion.h b/Source/WTF/wtf/text/StringToIntegerConversion.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ed4b2b2c0def130a0faa1d3b484b8a7a4e6bf055 >--- /dev/null >+++ b/Source/WTF/wtf/text/StringToIntegerConversion.h >@@ -0,0 +1,131 @@ >+/* >+ * 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 >+ >+namespace WTF { >+ >+inline bool isCharacterAllowedInBase(UChar c, int base) >+{ >+ if (c > 0x7F) >+ return false; >+ if (isASCIIDigit(c)) >+ return c - '0' < base; >+ if (isASCIIAlpha(c)) { >+ if (base > 36) >+ base = 36; >+ return (c >= 'a' && c < 'a' + base - 10) >+ || (c >= 'A' && c < 'A' + base - 10); >+ } >+ return false; >+} >+ >+template<typename IntegralType, typename CharacterType> >+inline IntegralType toIntegralType(const CharacterType* data, size_t length, bool* ok = nullptr, int base = 10) >+{ >+ static const IntegralType integralMax = std::numeric_limits<IntegralType>::max(); >+ static const bool isSigned = std::numeric_limits<IntegralType>::is_signed; >+ const IntegralType maxMultiplier = integralMax / base; >+ >+ IntegralType value = 0; >+ bool isOk = false; >+ bool isNegative = false; >+ >+ if (!data) >+ goto bye; >+ >+ // skip leading whitespace >+ while (length && isSpaceOrNewline(*data)) { >+ --length; >+ ++data; >+ } >+ >+ if (isSigned && length && *data == '-') { >+ --length; >+ ++data; >+ isNegative = true; >+ } else if (length && *data == '+') { >+ --length; >+ ++data; >+ } >+ >+ if (!length || !isCharacterAllowedInBase(*data, base)) >+ goto bye; >+ >+ while (length && isCharacterAllowedInBase(*data, base)) { >+ --length; >+ IntegralType digitValue; >+ auto c = *data; >+ if (isASCIIDigit(c)) >+ digitValue = c - '0'; >+ else if (c >= 'a') >+ digitValue = c - 'a' + 10; >+ else >+ digitValue = c - 'A' + 10; >+ >+ if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative)) >+ goto bye; >+ >+ value = base * value + digitValue; >+ ++data; >+ } >+ >+#if COMPILER(MSVC) >+#pragma warning(push, 0) >+#pragma warning(disable:4146) >+#endif >+ >+ if (isNegative) >+ value = -value; >+ >+#if COMPILER(MSVC) >+#pragma warning(pop) >+#endif >+ >+ // skip trailing space >+ while (length && isSpaceOrNewline(*data)) { >+ --length; >+ ++data; >+ } >+ >+ if (!length) >+ isOk = true; >+bye: >+ if (ok) >+ *ok = isOk; >+ return isOk ? value : 0; >+} >+ >+template<typename IntegralType, typename StringOrStringView> >+inline IntegralType toIntegralType(const StringOrStringView& stringView, bool* ok = nullptr, int base = 10) >+{ >+ if (stringView.is8Bit()) >+ return toIntegralType<IntegralType, LChar>(stringView.characters8(), stringView.length(), ok, base); >+ return toIntegralType<IntegralType, UChar>(stringView.characters16(), stringView.length(), ok, base); >+} >+ >+} >+ >+using WTF::toIntegralType; >diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp >index a87529fc6b3b82f238ae750ff9c293d648b2c3e7..38b68f5f081c18d73199a36a62a87fef86c91c25 100644 >--- a/Source/WTF/wtf/text/WTFString.cpp >+++ b/Source/WTF/wtf/text/WTFString.cpp >@@ -29,9 +29,10 @@ > #include <wtf/HexNumber.h> > #include <wtf/MathExtras.h> > #include <wtf/NeverDestroyed.h> >-#include <wtf/text/CString.h> > #include <wtf/Vector.h> > #include <wtf/dtoa.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringToIntegerConversion.h> > #include <wtf/unicode/CharacterNames.h> > #include <wtf/unicode/UTF8.h> > >@@ -930,98 +931,6 @@ String String::fromUTF8WithLatin1Fallback(const LChar* string, size_t size) > } > > // String Operations >- >-static bool isCharacterAllowedInBase(UChar c, int base) >-{ >- if (c > 0x7F) >- return false; >- if (isASCIIDigit(c)) >- return c - '0' < base; >- if (isASCIIAlpha(c)) { >- if (base > 36) >- base = 36; >- return (c >= 'a' && c < 'a' + base - 10) >- || (c >= 'A' && c < 'A' + base - 10); >- } >- return false; >-} >- >-template<typename IntegralType, typename CharacterType> >-static inline IntegralType toIntegralType(const CharacterType* data, size_t length, bool* ok, int base) >-{ >- static const IntegralType integralMax = std::numeric_limits<IntegralType>::max(); >- static const bool isSigned = std::numeric_limits<IntegralType>::is_signed; >- const IntegralType maxMultiplier = integralMax / base; >- >- IntegralType value = 0; >- bool isOk = false; >- bool isNegative = false; >- >- if (!data) >- goto bye; >- >- // skip leading whitespace >- while (length && isSpaceOrNewline(*data)) { >- --length; >- ++data; >- } >- >- if (isSigned && length && *data == '-') { >- --length; >- ++data; >- isNegative = true; >- } else if (length && *data == '+') { >- --length; >- ++data; >- } >- >- if (!length || !isCharacterAllowedInBase(*data, base)) >- goto bye; >- >- while (length && isCharacterAllowedInBase(*data, base)) { >- --length; >- IntegralType digitValue; >- auto c = *data; >- if (isASCIIDigit(c)) >- digitValue = c - '0'; >- else if (c >= 'a') >- digitValue = c - 'a' + 10; >- else >- digitValue = c - 'A' + 10; >- >- if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative)) >- goto bye; >- >- value = base * value + digitValue; >- ++data; >- } >- >-#if COMPILER(MSVC) >-#pragma warning(push, 0) >-#pragma warning(disable:4146) >-#endif >- >- if (isNegative) >- value = -value; >- >-#if COMPILER(MSVC) >-#pragma warning(pop) >-#endif >- >- // skip trailing space >- while (length && isSpaceOrNewline(*data)) { >- --length; >- ++data; >- } >- >- if (!length) >- isOk = true; >-bye: >- if (ok) >- *ok = isOk; >- return isOk ? value : 0; >-} >- > template<typename CharacterType> > static unsigned lengthOfCharactersAsInteger(const CharacterType* data, size_t length) > { >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 789006d9ce0dd0ecde606ba3ad3af101aa92dca6..a13d20d9391a5cdce73697e7abbfbc1b0b80231e 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1622,6 +1622,7 @@ platform/graphics/GraphicsLayer.cpp > platform/graphics/GraphicsLayerTransform.cpp > platform/graphics/GraphicsLayerUpdater.cpp > platform/graphics/GraphicsTypes.cpp >+platform/graphics/HEVCUtilities.cpp > platform/graphics/Image.cpp > platform/graphics/ImageBuffer.cpp > platform/graphics/ImageDecoder.cpp >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 8033a36a1e645a4d4bc516ac8fe7a56f1e419f49..62bfd8d8c207a0949893e5c458abce707bcff67f 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -301,8 +301,10 @@ platform/graphics/cocoa/FontCocoa.mm > platform/graphics/cocoa/FontDescriptionCocoa.cpp > platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp > platform/graphics/cocoa/FontPlatformDataCocoa.mm >+platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp > platform/graphics/cocoa/IOSurface.mm > platform/graphics/cocoa/IOSurfacePoolCocoa.mm >+platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp > platform/graphics/cocoa/WebActionDisablingCALayerDelegate.mm > platform/graphics/cocoa/WebCoreCALayerExtras.mm > platform/graphics/cocoa/WebCoreDecompressionSession.mm >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 7b3ce3348ab7724d0cb4b7bb6481e163ce063328..6172a038ba3bf57298dd85037ad201e2226aeb80 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -4033,6 +4033,8 @@ > CDA29A171CBDA56C00901CCF /* PlaybackSessionInterfaceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA29A151CBDA56C00901CCF /* PlaybackSessionInterfaceMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; > CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDA29A2F1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.mm */; }; > CDA29A321CC01A9500901CCF /* PlaybackSessionInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ CDA595932146DEC300A84185 /* HEVCUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA595912146DEC300A84185 /* HEVCUtilities.h */; }; >+ CDA595982146DF7800A84185 /* HEVCUtilitiesCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA595962146DF7800A84185 /* HEVCUtilitiesCocoa.h */; }; > CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDA79825170A279000D45C55 /* AudioSessionIOS.mm */; }; > CDA7982A170A3D0000D45C55 /* AudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA79821170A22DC00D45C55 /* AudioSession.h */; settings = {ATTRIBUTES = (Private, ); }; }; > CDA98E0B1603CD6000FEA3B1 /* LegacyCDM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDA98E091603CD5900FEA3B1 /* LegacyCDM.cpp */; }; >@@ -4046,6 +4048,7 @@ > CDC224281F756966005F077B /* CDMInstanceFairPlayStreamingAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */; }; > CDC26B40160A8CC60026757B /* LegacyMockCDM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDC26B3C160A62B00026757B /* LegacyMockCDM.cpp */; }; > CDC26B41160A8CCE0026757B /* LegacyMockCDM.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC26B3D160A62B00026757B /* LegacyMockCDM.h */; }; >+ CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */; }; > CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC675201EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm */; }; > CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC675211EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h */; }; > CDC675271EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC675251EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h */; }; >@@ -13333,6 +13336,10 @@ > CDA29A2D1CBF73FC00901CCF /* WebAVPlayerController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAVPlayerController.mm; sourceTree = "<group>"; }; > CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaybackSessionInterfaceAVKit.h; sourceTree = "<group>"; }; > CDA29A2F1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlaybackSessionInterfaceAVKit.mm; sourceTree = "<group>"; }; >+ CDA595912146DEC300A84185 /* HEVCUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HEVCUtilities.h; sourceTree = "<group>"; }; >+ CDA595922146DEC300A84185 /* HEVCUtilities.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HEVCUtilities.cpp; sourceTree = "<group>"; }; >+ CDA595962146DF7800A84185 /* HEVCUtilitiesCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HEVCUtilitiesCocoa.h; sourceTree = "<group>"; }; >+ CDA595972146DF7800A84185 /* HEVCUtilitiesCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HEVCUtilitiesCocoa.cpp; sourceTree = "<group>"; }; > CDA79821170A22DC00D45C55 /* AudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioSession.h; sourceTree = "<group>"; }; > CDA79823170A258300D45C55 /* AudioSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSession.cpp; sourceTree = "<group>"; }; > CDA79825170A279000D45C55 /* AudioSessionIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AudioSessionIOS.mm; sourceTree = "<group>"; }; >@@ -13389,6 +13396,8 @@ > CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = mediaControlsApple.css; sourceTree = "<group>"; }; > CDC26B3C160A62B00026757B /* LegacyMockCDM.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyMockCDM.cpp; sourceTree = "<group>"; }; > CDC26B3D160A62B00026757B /* LegacyMockCDM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LegacyMockCDM.h; sourceTree = "<group>"; }; >+ CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaEngineConfigurationFactoryCocoa.h; sourceTree = "<group>"; }; >+ CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEngineConfigurationFactoryCocoa.cpp; sourceTree = "<group>"; }; > CDC675201EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AVAudioSessionCaptureDeviceManager.mm; sourceTree = "<group>"; }; > CDC675211EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVAudioSessionCaptureDeviceManager.h; sourceTree = "<group>"; }; > CDC675241EAEA9D400727C84 /* AVAudioSessionCaptureDevice.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AVAudioSessionCaptureDevice.mm; sourceTree = "<group>"; }; >@@ -23715,6 +23724,8 @@ > B2A015940AF6CD53006BCE0E /* GraphicsTypes.cpp */, > B2A015950AF6CD53006BCE0E /* GraphicsTypes.h */, > 77A17A7A12F2890B004E02F6 /* GraphicsTypes3D.h */, >+ CDA595922146DEC300A84185 /* HEVCUtilities.cpp */, >+ CDA595912146DEC300A84185 /* HEVCUtilities.h */, > B27535400B053814002CE64F /* Icon.h */, > B27535410B053814002CE64F /* Image.cpp */, > B27535420B053814002CE64F /* Image.h */, >@@ -23927,9 +23938,13 @@ > B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */, > 49FFBF1C11C8550E006A7118 /* GraphicsContext3DCocoa.mm */, > B277B4030B22F37C0004BEC6 /* GraphicsContextCocoa.mm */, >+ CDA595972146DF7800A84185 /* HEVCUtilitiesCocoa.cpp */, >+ CDA595962146DF7800A84185 /* HEVCUtilitiesCocoa.h */, > 2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */, > 2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */, > AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */, >+ CDC48AC72149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h */, >+ CDC48AC82149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.cpp */, > 526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */, > 526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */, > 2D3EF4441917915C00034184 /* WebActionDisablingCALayerDelegate.h */, >@@ -28146,6 +28161,8 @@ > 26EA89A71B4F2B75008C5FD2 /* HashableActionList.h in Headers */, > 8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */, > A8748BE012CBF2DC001FBA41 /* HashTools.h in Headers */, >+ CDA595932146DEC300A84185 /* HEVCUtilities.h in Headers */, >+ CDA595982146DF7800A84185 /* HEVCUtilitiesCocoa.h in Headers */, > F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */, > 515BE19C1D54F6C100DD7C68 /* HIDGamepad.h in Headers */, > 515BE19E1D54F6C100DD7C68 /* HIDGamepadProvider.h in Headers */, >@@ -30261,6 +30278,7 @@ > 517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */, > 517A53291F4B90B900DCDC0A /* ServiceWorkerRegistrationKey.h in Headers */, > 51F175691F3EBC8300C74950 /* ServiceWorkerRegistrationOptions.h in Headers */, >+ CDC48AC92149CF2A0024FD59 /* MediaEngineConfigurationFactoryCocoa.h in Headers */, > 51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */, > 4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */, > 515E37F61FAA940200D7F22A /* ServiceWorkerTypes.h in Headers */, >diff --git a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >index 23287aae3f3303c2ac3c5e64a82d9649ddb13810..987fbcf61966d24cf05ca084699d0580a2f111df 100644 >--- a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >+++ b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp >@@ -45,6 +45,8 @@ SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTImageRotationSessionTrans > SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, VTIsHardwareDecodeSupported, Boolean, (CMVideoCodecType codecType), (codecType)) > SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, VTGetGVADecoderAvailability, OSStatus, (uint32_t* totalInstanceCountOut, uint32_t* freeInstanceCountOut), (totalInstanceCountOut, freeInstanceCountOut)) > SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, VTCreateCGImageFromCVPixelBuffer, OSStatus, (CVPixelBufferRef pixelBuffer, CFDictionaryRef options, CGImageRef* imageOut), (pixelBuffer, options, imageOut)) >+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, VTCopyHEVCDecoderCapabilitiesDictionary, CFDictionaryRef, (), ()) >+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, VTGetHEVCCapabilitesForFormatDescription, OSStatus, (CMVideoFormatDescriptionRef formatDescription, CFDictionaryRef decoderCapabilitiesDict, Boolean* isDecodable, Boolean* mayBePlayable), (formatDescription, decoderCapabilitiesDict, isDecodable, mayBePlayable)) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTDecompressionPropertyKey_PixelBufferPool, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTDecompressionPropertyKey_SuggestedQualityOfServiceTiers, CFStringRef) >@@ -57,3 +59,9 @@ SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTPixelTransferSessionTrans > SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTSessionSetProperty, OSStatus, (VTSessionRef session, CFStringRef propertyKey, CFTypeRef propertyValue), (session, propertyKey, propertyValue)) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTPixelTransferPropertyKey_ScalingMode, CFStringRef) > SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) >+ >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, kVTHEVCDecoderCapability_SupportedProfiles, CFStringRef) >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, kVTHEVCDecoderCapability_PerProfileSupport, CFStringRef) >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_IsHardwareAccelerated, CFStringRef) >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_MaxDecodeLevel, CFStringRef) >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_MaxPlaybackLevel, CFStringRef) >diff --git a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >index 7215d3aea34e742638db2f8b299ad77c788291de..f319b188ed160580947612eb37286de22324e25d 100644 >--- a/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >+++ b/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h >@@ -57,6 +57,10 @@ SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, VTGetGVADecoderAva > #define VTGetGVADecoderAvailability softLink_VideoToolbox_VTGetGVADecoderAvailability > SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, VTCreateCGImageFromCVPixelBuffer, OSStatus, (CVPixelBufferRef pixelBuffer, CFDictionaryRef options, CGImageRef* imageOut), (pixelBuffer, options, imageOut)) > #define VTCreateCGImageFromCVPixelBuffer softLink_VideoToolbox_VTCreateCGImageFromCVPixelBuffer >+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, VTCopyHEVCDecoderCapabilitiesDictionary, CFDictionaryRef, (), ()) >+#define VTCopyHEVCDecoderCapabilitiesDictionary softLink_VideoToolbox_VTCopyHEVCDecoderCapabilitiesDictionary >+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, VTGetHEVCCapabilitesForFormatDescription, OSStatus, (CMVideoFormatDescriptionRef formatDescription, CFDictionaryRef decoderCapabilitiesDict, Boolean* isDecodable, Boolean* mayBePlayable), (formatDescription, decoderCapabilitiesDict, isDecodable, mayBePlayable)) >+#define VTGetHEVCCapabilitesForFormatDescription softLink_VideoToolbox_VTGetHEVCCapabilitesForFormatDescription > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder, CFStringRef) > #define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder get_VideoToolbox_kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder() > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTDecompressionPropertyKey_PixelBufferPool, CFStringRef) >@@ -81,3 +85,14 @@ SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTPixelTransferPropertyKey > #define kVTPixelTransferPropertyKey_ScalingMode get_VideoToolbox_kVTPixelTransferPropertyKey_ScalingMode() > SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, VideoToolbox, kVTScalingMode_Trim, CFStringRef) > #define kVTScalingMode_Trim get_VideoToolbox_kVTScalingMode_Trim() >+ >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, kVTHEVCDecoderCapability_SupportedProfiles, CFStringRef) >+#define kVTHEVCDecoderCapability_SupportedProfiles get_VideoToolbox_kVTHEVCDecoderCapability_SupportedProfiles() >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, kVTHEVCDecoderCapability_PerProfileSupport, CFStringRef) >+#define kVTHEVCDecoderCapability_PerProfileSupport get_VideoToolbox_kVTHEVCDecoderCapability_PerProfileSupport() >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_IsHardwareAccelerated, CFStringRef) >+#define kVTHEVCDecoderProfileCapability_IsHardwareAccelerated get_VideoToolbox_kVTHEVCDecoderProfileCapability_IsHardwareAccelerated() >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_MaxDecodeLevel, CFStringRef) >+#define kVTHEVCDecoderProfileCapability_MaxDecodeLevel get_VideoToolbox_kVTHEVCDecoderProfileCapability_MaxDecodeLevel() >+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, VideoToolbox, kVTHEVCDecoderProfileCapability_MaxPlaybackLevel, CFStringRef) >+#define kVTHEVCDecoderProfileCapability_MaxPlaybackLevel get_VideoToolbox_kVTHEVCDecoderProfileCapability_MaxPlaybackLevel() >diff --git a/Source/WebCore/platform/graphics/HEVCUtilities.cpp b/Source/WebCore/platform/graphics/HEVCUtilities.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d17600c91bf706121e43ae7595b87fb1e56b9dad >--- /dev/null >+++ b/Source/WebCore/platform/graphics/HEVCUtilities.cpp >@@ -0,0 +1,113 @@ >+/* >+ * 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. >+ */ >+ >+#include "config.h" >+#include "HEVCUtilities.h" >+ >+#include <wtf/text/StringToIntegerConversion.h> >+ >+namespace WebCore { >+ >+std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString) >+{ >+ // The format of the 'hevc' codec string is specified in ISO/IEC 14496-15:2014, Annex E.3. >+ StringView codecView(codecString); >+ auto codecSplit = codecView.split('.'); >+ auto nextElement = codecSplit.begin(); >+ if (nextElement == codecSplit.end()) >+ return std::nullopt; >+ >+ HEVCParameterSet parameters; >+ >+ // Codec identifier: legal values are specified in ISO/IEC 14496-15:2014, section 8: >+ parameters.codecName = (*nextElement).toString(); >+ if (!equal(parameters.codecName, "hvc1") && !equal(parameters.codecName, "hev1")) >+ return std::nullopt; >+ >+ if (++nextElement == codecSplit.end()) >+ return std::nullopt; >+ >+ // First element: Optional General Profile Space parameter ['A', 'B', 'C'], mapping to [1, 2, 3] >+ // and [0] for absent, then General Profile IDC as a 5-bit decimal number. >+ auto profileSpace = *nextElement; >+ if (!profileSpace.length()) >+ return std::nullopt; >+ >+ auto firstCharacter = profileSpace[0]; >+ bool hasProfileSpace = firstCharacter >= 'A' && firstCharacter <= 'C'; >+ if (hasProfileSpace) { >+ parameters.generalProfileSpace = 1 + (firstCharacter - 'A'); >+ profileSpace = profileSpace.substring(1); >+ } >+ >+ bool isValidProfileIDC = false; >+ parameters.generalProfileIDC = toIntegralType<uint8_t>(profileSpace, &isValidProfileIDC); >+ if (!isValidProfileIDC) >+ return std::nullopt; >+ >+ if (++nextElement == codecSplit.end()) >+ return std::nullopt; >+ >+ // Second element: 32 bit of General Profile Compatibility Flags, in reverse bit order, >+ // in hex with leading zeros omitted. >+ auto compatibilityFlags = *nextElement; >+ bool isValidCompatibilityFlags = false; >+ parameters.generalProfileCompatibilityFlags = toIntegralType<uint32_t>(compatibilityFlags, &isValidCompatibilityFlags, 16); >+ if (!isValidCompatibilityFlags) >+ return std::nullopt; >+ >+ if (++nextElement == codecSplit.end()) >+ return std::nullopt; >+ >+ // Third element: General Tier Flag ['L', 'H'], mapping to [false, true], followed by >+ // General Level IDC as a 8-bit decimal number. >+ auto generalTier = *nextElement; >+ firstCharacter = generalTier[0]; >+ if (firstCharacter != 'L' && firstCharacter != 'H') >+ return std::nullopt; >+ >+ parameters.generalTierFlag = firstCharacter == 'H'; >+ bool isValidGeneralLevelIDC = false; >+ parameters.generalLevelIDC = toIntegralType<uint8_t>(generalTier.substring(1), &isValidGeneralLevelIDC); >+ if (!isValidGeneralLevelIDC) >+ return std::nullopt; >+ >+ // Optional fourth and remaning elements: a sequence of 6 1-byte constraint flags, each byte encoded >+ // in hex, and separated by a period, with trailing zero bytes omitted. >+ parameters.constraintFlags.fill(0, 6); >+ for (auto& flag : parameters.constraintFlags) { >+ if (++nextElement == codecSplit.end()) >+ break; >+ >+ bool isValidFlag = false; >+ flag = toIntegralType<uint8_t>(*nextElement, &isValidFlag, 16); >+ if (!isValidFlag) >+ return std::nullopt; >+ } >+ >+ return WTFMove(parameters); >+} >+ >+} >diff --git a/Source/WebCore/platform/graphics/HEVCUtilities.h b/Source/WebCore/platform/graphics/HEVCUtilities.h >new file mode 100644 >index 0000000000000000000000000000000000000000..466d9ff0886fb27b5b642f9cefffde9f6dcf34ce >--- /dev/null >+++ b/Source/WebCore/platform/graphics/HEVCUtilities.h >@@ -0,0 +1,45 @@ >+/* >+ * 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 >+ >+#include <wtf/Vector.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+struct HEVCParameterSet { >+ String codecName; >+ unsigned short generalProfileSpace { 0 }; >+ unsigned short generalProfileIDC { 0 }; >+ uint32_t generalProfileCompatibilityFlags { 0 }; >+ bool generalTierFlag { false }; >+ unsigned short generalLevelIDC { 0 }; >+ Vector<unsigned short> constraintFlags { 6, 0 }; >+}; >+ >+WEBCORE_EXPORT std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); >+ >+} >diff --git a/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp b/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..f6719a8ec61206defa1da811b6e56238326d2bb1 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp >@@ -0,0 +1,101 @@ >+/* >+ * 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. >+ */ >+ >+#include "config.h" >+#include "HEVCUtilitiesCocoa.h" >+ >+#if PLATFORM(COCOA) >+ >+#include "HEVCUtilities.h" >+#include "MediaCapabilitiesInfo.h" >+ >+#include "VideoToolboxSoftLink.h" >+ >+namespace WebCore { >+ >+bool validateHEVCParameters(HEVCParameterSet& parameters, MediaCapabilitiesInfo& info) >+{ >+ if (!canLoad_VideoToolbox_VTCopyHEVCDecoderCapabilitiesDictionary() >+ || !canLoad_VideoToolbox_kVTHEVCDecoderCapability_SupportedProfiles() >+ || !canLoad_VideoToolbox_kVTHEVCDecoderCapability_PerProfileSupport() >+ || !canLoad_VideoToolbox_kVTHEVCDecoderProfileCapability_IsHardwareAccelerated() >+ || !canLoad_VideoToolbox_kVTHEVCDecoderProfileCapability_MaxDecodeLevel() >+ || !canLoad_VideoToolbox_kVTHEVCDecoderProfileCapability_MaxPlaybackLevel()) >+ return false; >+ >+ RetainPtr<CFDictionaryRef> capabilities = adoptCF(VTCopyHEVCDecoderCapabilitiesDictionary()); >+ if (!capabilities) >+ return false; >+ >+ auto supportedProfiles = (CFArrayRef)CFDictionaryGetValue(capabilities.get(), kVTHEVCDecoderCapability_SupportedProfiles); >+ if (!supportedProfiles || CFGetTypeID(supportedProfiles) != CFArrayGetTypeID()) >+ return false; >+ >+ int16_t generalProfileIDC = parameters.generalProfileIDC; >+ auto cfGeneralProfileIDC = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt16Type, &generalProfileIDC)); >+ auto searchRange = CFRangeMake(0, CFArrayGetCount(supportedProfiles)); >+ if (!CFArrayContainsValue(supportedProfiles, searchRange, cfGeneralProfileIDC.get())) >+ return false; >+ >+ auto perProfileSupport = (CFDictionaryRef)CFDictionaryGetValue(capabilities.get(), kVTHEVCDecoderCapability_PerProfileSupport); >+ if (!perProfileSupport || CFGetTypeID(perProfileSupport) != CFDictionaryGetTypeID()) >+ return false; >+ >+ auto generalProfileIDCString = String::number(generalProfileIDC).createCFString(); >+ auto profileSupport = (CFDictionaryRef)CFDictionaryGetValue(perProfileSupport, generalProfileIDCString.get()); >+ if (!profileSupport || CFGetTypeID(profileSupport) != CFDictionaryGetTypeID()) >+ return false; >+ >+ auto isHardwareAccelerated = (CFBooleanRef)CFDictionaryGetValue(profileSupport, kVTHEVCDecoderProfileCapability_IsHardwareAccelerated); >+ if (isHardwareAccelerated && CFGetTypeID(isHardwareAccelerated) == CFBooleanGetTypeID()) >+ info.powerEfficient = CFBooleanGetValue(isHardwareAccelerated); >+ >+ auto cfMaxDecodeLevel = (CFNumberRef)CFDictionaryGetValue(profileSupport, kVTHEVCDecoderProfileCapability_MaxDecodeLevel); >+ if (cfMaxDecodeLevel && CFGetTypeID(cfMaxDecodeLevel) == CFNumberGetTypeID()) { >+ int16_t maxDecodeLevel = 0; >+ if (!CFNumberGetValue(cfMaxDecodeLevel, kCFNumberSInt16Type, &maxDecodeLevel)) >+ return false; >+ >+ if (parameters.generalLevelIDC > maxDecodeLevel) >+ return false; >+ >+ info.supported = true; >+ } >+ >+ auto cfMaxPlaybackLevel = (CFNumberRef)CFDictionaryGetValue(profileSupport, kVTHEVCDecoderProfileCapability_MaxPlaybackLevel); >+ if (cfMaxPlaybackLevel && CFGetTypeID(cfMaxPlaybackLevel) == CFNumberGetTypeID()) { >+ int16_t maxPlaybackLevel = 0; >+ if (!CFNumberGetValue(cfMaxPlaybackLevel, kCFNumberSInt16Type, &maxPlaybackLevel)) >+ return false; >+ >+ info.smooth = parameters.generalLevelIDC <= maxPlaybackLevel; >+ } >+ >+ return true; >+} >+ >+} >+ >+#endif // PLATFORM(COCOA) >diff --git a/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h b/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ec5f74295f51db27561d5d12a29b292303563d75 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h >@@ -0,0 +1,40 @@ >+/* >+ * 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 PLATFORM(COCOA) >+ >+#include "HEVCUtilities.h" >+ >+namespace WebCore { >+ >+struct MediaCapabilitiesInfo; >+ >+extern bool validateHEVCParameters(HEVCParameterSet&, MediaCapabilitiesInfo&); >+ >+} >+ >+#endif >diff --git a/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp b/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..685573a1fcaaed22ee61ce94dc583349367323b4 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp >@@ -0,0 +1,104 @@ >+/* >+ * 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. >+ */ >+ >+#include "config.h" >+#include "MediaEngineConfigurationFactoryCocoa.h" >+ >+#if PLATFORM(COCOA) >+ >+#include "HEVCUtilitiesCocoa.h" >+#include "MediaCapabilitiesInfo.h" >+#include "MediaDecodingConfiguration.h" >+#include "MediaPlayer.h" >+ >+#include "VideoToolboxSoftLink.h" >+ >+namespace WebCore { >+ >+static CMVideoCodecType videoCodecTypeFromRFC4281Type(String type) >+{ >+ if (type.startsWith("mp4v")) >+ return kCMVideoCodecType_MPEG4Video; >+ if (type.startsWith("avc1") || type.startsWith("avc3")) >+ return kCMVideoCodecType_H264; >+ if (type.startsWith("hvc1") || type.startsWith("hev1")) >+ return kCMVideoCodecType_HEVC; >+ return 0; >+} >+ >+void createMediaPlayerDecodingConfigurationCocoa(MediaDecodingConfiguration& configuration, WTF::Function<void(MediaCapabilitiesInfo&&)>&& callback) >+{ >+ MediaCapabilitiesInfo info; >+ if (configuration.video) { >+ auto& videoConfiguration = configuration.video.value(); >+ MediaEngineSupportParameters parameters { }; >+ parameters.type = ContentType(videoConfiguration.contentType); >+ parameters.isMediaSource = configuration.type == MediaDecodingType::MediaSource; >+ if (MediaPlayer::supportsType(parameters) != MediaPlayer::IsSupported) { >+ callback({ }); >+ return; >+ } >+ info.supported = true; >+ >+ auto codecs = parameters.type.codecs(); >+ if (codecs.size() != 1) { >+ callback({ }); >+ return; >+ } >+ >+ info.supported = true; >+ auto& codec = codecs[0]; >+ auto videoCodecType = videoCodecTypeFromRFC4281Type(codec); >+ if (!videoCodecType) { >+ callback({ }); >+ return; >+ } >+ >+ if (videoCodecType == kCMVideoCodecType_HEVC) { >+ auto parameters = parseHEVCCodecParameters(codec); >+ if (!parameters || !validateHEVCParameters(parameters.value(), info)) { >+ callback({ }); >+ return; >+ } >+ } else if (canLoad_VideoToolbox_VTIsHardwareDecodeSupported()) >+ info.powerEfficient = VTIsHardwareDecodeSupported(videoCodecType); >+ } >+ >+ if (configuration.audio) { >+ MediaEngineSupportParameters parameters { }; >+ parameters.type = ContentType(configuration.audio.value().contentType); >+ parameters.isMediaSource = configuration.type == MediaDecodingType::MediaSource; >+ if (MediaPlayer::supportsType(parameters) != MediaPlayer::IsSupported) { >+ callback({ }); >+ return; >+ } >+ info.supported = true; >+ } >+ >+ callback(WTFMove(info)); >+} >+ >+} >+#endif >diff --git a/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h b/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h >new file mode 100644 >index 0000000000000000000000000000000000000000..362b6b620d7b5643b01ed9fb8604929ccc6adf0f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h >@@ -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 PLATFORM(COCOA) >+ >+namespace WebCore { >+ >+struct MediaCapabilitiesInfo; >+struct MediaDecodingConfiguration; >+ >+extern void createMediaPlayerDecodingConfigurationCocoa(MediaDecodingConfiguration&, WTF::Function<void(MediaCapabilitiesInfo&&)>&&); >+ >+} >+ >+#endif >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >index c0a1c0d9e4045c88bf77b8f731e2d529baa2e6c4..329e294ca2f6019aca49f39a61178dd526691661 100644 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >+++ b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >@@ -35,6 +35,10 @@ > #include <wtf/NeverDestroyed.h> > #include <wtf/Vector.h> > >+#if PLATFORM(COCOA) >+#include "MediaEngineConfigurationFactoryCocoa.h" >+#endif >+ > namespace WebCore { > > static bool& mockEnabled() >@@ -51,7 +55,11 @@ struct MediaEngineFactory { > using FactoryVector = Vector<MediaEngineFactory>; > static const FactoryVector& factories() > { >- static NeverDestroyed<FactoryVector> factories = makeNeverDestroyed(FactoryVector({ })); >+ static NeverDestroyed<FactoryVector> factories = makeNeverDestroyed(FactoryVector({ >+#if PLATFORM(COCOA) >+ { &createMediaPlayerDecodingConfigurationCocoa, nullptr }, >+#endif >+ })); > return factories; > } > >@@ -69,6 +77,11 @@ void MediaEngineConfigurationFactory::createDecodingConfiguration(MediaDecodingC > } > > auto& factory = *nextFactory; >+ if (!factory.createDecodingConfiguration) { >+ callback({ }); >+ return; >+ } >+ > factory.createDecodingConfiguration(config, [factoryCallback, nextFactory, config, callback = WTFMove(callback)] (auto&& info) mutable { > if (info.supported) { > callback(WTFMove(info)); >@@ -95,6 +108,11 @@ void MediaEngineConfigurationFactory::createEncodingConfiguration(MediaEncodingC > } > > auto& factory = *nextFactory; >+ if (!factory.createEncodingConfiguration) { >+ callback({ }); >+ return; >+ } >+ > factory.createEncodingConfiguration(config, [factoryCallback, nextFactory, config, callback = WTFMove(callback)] (auto&& info) mutable { > if (info.supported) { > callback(WTFMove(info)); >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 2528b4b68d75b4388d94275863a008e3929676be..da18f6a21a759be2afd32aae82e0cea03c2eb77d 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -74,6 +74,7 @@ > #include "FrameView.h" > #include "GCObservation.h" > #include "GridPosition.h" >+#include "HEVCUtilities.h" > #include "HTMLAnchorElement.h" > #include "HTMLCanvasElement.h" > #include "HTMLIFrameElement.h" >@@ -4737,4 +4738,9 @@ bool Internals::supportsVCPEncoder() > #endif > } > >+std::optional<HEVCParameterSet> Internals::parseHEVCCodecParameters(const String& codecString) >+{ >+ return WebCore::parseHEVCCodecParameters(codecString); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 57bd24559fac15f6d6fc7f9573965fb2129dd015..68b79c77f0f68ce9a72a840b7fef7407b5e3c2ae 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -29,6 +29,7 @@ > #include "CSSComputedStyleDeclaration.h" > #include "ContextDestructionObserver.h" > #include "ExceptionOr.h" >+#include "HEVCUtilities.h" > #include "JSDOMPromiseDeferred.h" > #include "OrientationNotifier.h" > #include "PageConsoleClient.h" >@@ -738,6 +739,9 @@ public: > > bool supportsVCPEncoder(); > >+ using HEVCParameterSet = WebCore::HEVCParameterSet; >+ std::optional<HEVCParameterSet> parseHEVCCodecParameters(const String& codecString); >+ > private: > explicit Internals(Document&); > Document* contextDocument() const; >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index eb456cd826710877c7956b8ce5987d067112542c..a7e375543b6c9b76c68520ec7d66cdab1f1cd990 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -122,6 +122,19 @@ enum CompositingPolicy { > double right; > }; > >+[ >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ JSGenerateToJSObject, >+] dictionary HEVCParameterSet { >+ DOMString codecName; >+ unsigned short generalProfileSpace; >+ unsigned short generalProfileIDC; >+ unsigned long generalProfileCompatibilityFlags; >+ boolean generalTierFlag; >+ unsigned short generalLevelIDC; >+ sequence<unsigned short> constraintFlags; >+}; >+ > [ > ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, > NoInterfaceObject, >@@ -672,4 +685,6 @@ enum CompositingPolicy { > unsigned long primaryScreenDisplayID(); > > boolean supportsVCPEncoder(); >+ >+ HEVCParameterSet? parseHEVCCodecParameters(DOMString codecParameters); > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 7dd3b8aafeadbaca7bd230d7d60778b69ddf5f9c..aa694ffc80a277e3d654eaf03a49f5d78eadec5d 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2018-09-12 Jer Noble <jer.noble@apple.com> >+ >+ Add support for HEVC codec types in Media Capabilities >+ https://bugs.webkit.org/show_bug.cgi?id=189565 >+ >+ Reviewed by Eric Carlson. >+ >+ * media/hevc-codec-parameters-expected.txt: Added. >+ * media/hevc-codec-parameters.html: Added. >+ > 2018-09-17 Basuke Suzuki <Basuke.Suzuki@sony.com> > > [Curl] Respond with requested authentication scheme for authentication challenge. >diff --git a/LayoutTests/media/hevc-codec-parameters-expected.txt b/LayoutTests/media/hevc-codec-parameters-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f6def5859a9e4f8fc7d4c8727fb317936ffd1eae >--- /dev/null >+++ b/LayoutTests/media/hevc-codec-parameters-expected.txt >@@ -0,0 +1,9 @@ >+EXPECTED (internals.parseHEVCCodecParameters("bad-parameter") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hvc1") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.1.6.L93") === '{ 0, 1, 6, false, 93 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.A4.41.H120") === '{ 1, 4, 65, true, 120 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.B1.4.L63") === '{ 2, 1, 4, false, 63 }') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.D1.4.L63") == 'null') OK >+EXPECTED (internals.parseHEVCCodecParameters("hev1.B1.4.L68000") == 'null') OK >+END OF TEST >+ >diff --git a/LayoutTests/media/hevc-codec-parameters.html b/LayoutTests/media/hevc-codec-parameters.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1ddcd9cf9c711017969ee02070ac08b64772c7e6 >--- /dev/null >+++ b/LayoutTests/media/hevc-codec-parameters.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="video-test.js"></script> >+ <script> >+ function HEVCParameterSetToString(set) { >+ return `{ ${set.generalProfileSpace }, ${set.generalProfileIDC }, ${set.generalProfileCompatibilityFlags }, ${set.generalTierFlag }, ${set.generalLevelIDC } }`; >+ } >+ function isEqualHEVCParameterSet(setA, setB) { >+ return setA.generalProfileSpace === setB.generalProfileSpace >+ && setA.generalProfileIDC === setB.generalProfileIDC >+ && setA.generalProfileCompatibilityFlags === setB.generalProfileCompatibilityFlags >+ && setA.generalTierFlag === setB.generalTierFlag >+ && setA.generalLevelIDC === setB.generalLevelIDC >+ } >+ function makeHEVCParameterSet(generalProfileSpace, generalProfileIDC, generalProfileCompatibilityFlags, generalTierFlag, generalLevelIDC) >+ { >+ return { >+ generalProfileSpace: generalProfileSpace, >+ generalProfileIDC: generalProfileIDC, >+ generalProfileCompatibilityFlags: generalProfileCompatibilityFlags, >+ generalTierFlag: generalTierFlag, >+ generalLevelIDC: generalLevelIDC, >+ }; >+ } >+ function testExpectedHEVCParameterSet(testFuncString, expected) >+ { >+ let observed = eval(testFuncString); >+ let success = isEqualHEVCParameterSet(observed, expected); >+ reportExpected(success, testFuncString, '===', HEVCParameterSetToString(expected), HEVCParameterSetToString(observed)); >+ } >+ window.addEventListener('load', event => { >+ testExpected('internals.parseHEVCCodecParameters("bad-parameter")', null); >+ testExpected('internals.parseHEVCCodecParameters("hvc1")', null); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.1.6.L93")', makeHEVCParameterSet(0, 1, 6, false, 93)); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.A4.41.H120")', makeHEVCParameterSet(1, 4, 65, true, 120)); >+ testExpectedHEVCParameterSet('internals.parseHEVCCodecParameters("hev1.B1.4.L63")', makeHEVCParameterSet(2, 1, 4, false, 63)); >+ testExpected('internals.parseHEVCCodecParameters("hev1.D1.4.L63")', null); >+ testExpected('internals.parseHEVCCodecParameters("hev1.B1.4.L68000")', null); >+ endTest(); >+ }, { once: true }); >+ </script> >+</head> >+<body> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189565
:
349595
|
349596
|
349610
|
349616
|
349908
|
349910
|
349912
|
349921
|
349922