Diff
Modified: trunk/LayoutTests/ChangeLog (243108 => 243109)
--- trunk/LayoutTests/ChangeLog 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/LayoutTests/ChangeLog 2019-03-18 22:29:55 UTC (rev 243109)
@@ -1,3 +1,13 @@
+2019-03-18 Jer Noble <jer.no...@apple.com>
+
+ Add experimental "alphaChannel" property to VideoConfiguration
+ https://bugs.webkit.org/show_bug.cgi?id=195853
+
+ Reviewed by Eric Carlson.
+
+ * media/mediacapabilities/mock-decodingInfo-alphaChannel-expected.txt: Added.
+ * media/mediacapabilities/mock-decodingInfo-alphaChannel.html: Added.
+
2019-03-18 Myles C. Maxfield <mmaxfi...@apple.com>
[WHLSL] Hook up the compiler to our WebGPU implementation
Added: trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel-expected.txt (0 => 243109)
--- trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel-expected.txt (rev 0)
+++ trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel-expected.txt 2019-03-18 22:29:55 UTC (rev 243109)
@@ -0,0 +1,24 @@
+RUN(internals.enableMockMediaCapabilities())
+RUN(internals.settings.setMediaCapabilitiesExtensionsEnabled(true))
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs="mock-with-alpha"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5 }});)
+Promise resolved OK
+EXPECTED (info.supported == 'true') OK
+EXPECTED (info.supportedConfiguration.video.alphaChannel == 'null') OK
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs="mock-with-alpha"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: false }});)
+Promise resolved OK
+EXPECTED (info.supported == 'true') OK
+EXPECTED (info.supportedConfiguration.video.alphaChannel == 'false') OK
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs="mock-with-alpha"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: true }});)
+Promise resolved OK
+EXPECTED (info.supported == 'true'), OBSERVED 'false' FAIL
+EXPECTED (info.supportedConfiguration.video.alphaChannel == 'true') OK
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs="mock-without-alpha"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: false }});)
+Promise resolved OK
+EXPECTED (info.supported == 'true') OK
+EXPECTED (info.supportedConfiguration.video.alphaChannel == 'false') OK
+RUN(promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs="mock-without-alpha"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: true }});)
+Promise resolved OK
+EXPECTED (info.supported == 'false') OK
+EXPECTED (info.supportedConfiguration.video.alphaChannel == 'true') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel.html (0 => 243109)
--- trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel.html (rev 0)
+++ trunk/LayoutTests/media/mediacapabilities/mock-decodingInfo-alphaChannel.html 2019-03-18 22:29:55 UTC (rev 243109)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script type="text/_javascript_">
+ var promise;
+ var info;
+
+ async function doTest()
+ {
+ if (!window.internals) {
+ failTest("Internals is required for this test.")
+ return;
+ }
+
+ run('internals.enableMockMediaCapabilities()');
+ run('internals.settings.setMediaCapabilitiesExtensionsEnabled(true)');
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs=\"mock-with-alpha\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5 }});");
+ info = await shouldResolve(promise);
+ testExpected('info.supported', true);
+ testExpected('info.supportedConfiguration.video.alphaChannel', null);
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs=\"mock-with-alpha\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: false }});");
+ info = await shouldResolve(promise);
+ testExpected('info.supported', true);
+ testExpected('info.supportedConfiguration.video.alphaChannel', false);
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs=\"mock-with-alpha\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: true }});");
+ info = await shouldResolve(promise);
+ testExpected('info.supported', true);
+ testExpected('info.supportedConfiguration.video.alphaChannel', true);
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs=\"mock-without-alpha\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: false }});");
+ info = await shouldResolve(promise);
+ testExpected('info.supported', true);
+ testExpected('info.supportedConfiguration.video.alphaChannel', false);
+
+ run("promise = navigator.mediaCapabilities.decodingInfo({ type: 'file', video: { contentType: 'video/mp4; codecs=\"mock-without-alpha\"', height: 720, bitrate: 1000, width: 1280, framerate: 24.5, alphaChannel: true }});");
+ info = await shouldResolve(promise);
+ testExpected('info.supported', false);
+ testExpected('info.supportedConfiguration.video.alphaChannel', true);
+
+
+ endTest();
+ }
+ </script>
+</head>
+<body _onload_="doTest()" />
+</html>
Modified: trunk/Source/WebCore/ChangeLog (243108 => 243109)
--- trunk/Source/WebCore/ChangeLog 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/ChangeLog 2019-03-18 22:29:55 UTC (rev 243109)
@@ -1,3 +1,34 @@
+2019-03-18 Jer Noble <jer.no...@apple.com>
+
+ Add experimental "alphaChannel" property to VideoConfiguration
+ https://bugs.webkit.org/show_bug.cgi?id=195853
+
+ Reviewed by Eric Carlson.
+
+ Test: media/mediacapabilities/mock-decodingInfo-alphaChannel.html
+
+ Add a new, experimental addition to Media Capabilities to allow pages to query for
+ alpha channel support.
+
+ * Modules/mediacapabilities/MediaCapabilities.cpp:
+ (WebCore::MediaCapabilities::decodingInfo):
+ * Modules/mediacapabilities/MediaCapabilities.h:
+ * Modules/mediacapabilities/MediaCapabilities.idl:
+ * Modules/mediacapabilities/VideoConfiguration.idl:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/cocoa/VideoToolboxSoftLink.cpp:
+ * platform/cocoa/VideoToolboxSoftLink.h:
+ * platform/graphics/cocoa/HEVCUtilitiesCocoa.h:
+ * platform/graphics/cocoa/HEVCUtilitiesCocoa.mm: Renamed from Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp.
+ (WebCore::validateHEVCParameters):
+ * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp:
+ (WebCore::createMediaPlayerDecodingConfigurationCocoa):
+ * platform/mediacapabilities/VideoConfiguration.h:
+ * platform/mock/MediaEngineConfigurationFactoryMock.cpp:
+ (WebCore::canDecodeMedia):
+ (WebCore::canEncodeMedia):
+
2019-03-18 Ryosuke Niwa <rn...@webkit.org>
Remove unused webkitEditableContentChanged event
Modified: trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp (243108 => 243109)
--- trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp 2019-03-18 22:29:55 UTC (rev 243109)
@@ -27,6 +27,7 @@
#include "MediaCapabilities.h"
#include "ContentType.h"
+#include "Document.h"
#include "JSMediaCapabilitiesDecodingInfo.h"
#include "JSMediaCapabilitiesEncodingInfo.h"
#include "MediaCapabilitiesDecodingInfo.h"
@@ -34,6 +35,7 @@
#include "MediaDecodingConfiguration.h"
#include "MediaEncodingConfiguration.h"
#include "MediaEngineConfigurationFactory.h"
+#include "Settings.h"
#include <wtf/HashSet.h>
namespace WebCore {
@@ -159,7 +161,7 @@
return true;
}
-void MediaCapabilities::decodingInfo(MediaDecodingConfiguration&& configuration, Ref<DeferredPromise>&& promise)
+void MediaCapabilities::decodingInfo(Document& document, MediaDecodingConfiguration&& configuration, Ref<DeferredPromise>&& promise)
{
// 2.4 Media Capabilities Interface
// https://wicg.github.io/media-capabilities/#media-capabilities-interface
@@ -172,6 +174,9 @@
return;
}
+ if (!document.settings().mediaCapabilitiesExtensionsEnabled() && configuration.video)
+ configuration.video.value().alphaChannel.reset();
+
// 4. Let p be a new promise.
// 5. In parallel, run the create a MediaCapabilitiesInfo algorithm with configuration and resolve p with its result.
// 6. Return p.
Modified: trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.h (243108 => 243109)
--- trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.h 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.h 2019-03-18 22:29:55 UTC (rev 243109)
@@ -31,12 +31,13 @@
namespace WebCore {
+class Document;
struct MediaDecodingConfiguration;
struct MediaEncodingConfiguration;
class MediaCapabilities : public RefCounted<MediaCapabilities> {
public:
- void decodingInfo(MediaDecodingConfiguration&&, Ref<DeferredPromise>&&);
+ void decodingInfo(Document&, MediaDecodingConfiguration&&, Ref<DeferredPromise>&&);
void encodingInfo(MediaEncodingConfiguration&&, Ref<DeferredPromise>&&);
private:
Modified: trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.idl (243108 => 243109)
--- trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.idl 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.idl 2019-03-18 22:29:55 UTC (rev 243109)
@@ -28,6 +28,6 @@
ImplementationLacksVTable
]
interface MediaCapabilities {
- Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration);
+ [CallWith=Document] Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration);
Promise<MediaCapabilitiesEncodingInfo> encodingInfo(MediaEncodingConfiguration configuration);
};
Modified: trunk/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl (243108 => 243109)
--- trunk/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl 2019-03-18 22:29:55 UTC (rev 243109)
@@ -33,4 +33,5 @@
required unsigned long height;
required unsigned long long bitrate;
required double framerate;
+ [EnabledBySetting=MediaCapabilitiesExtensions] boolean alphaChannel;
};
Modified: trunk/Source/WebCore/SourcesCocoa.txt (243108 => 243109)
--- trunk/Source/WebCore/SourcesCocoa.txt 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2019-03-18 22:29:55 UTC (rev 243109)
@@ -300,7 +300,7 @@
platform/graphics/cocoa/FontDescriptionCocoa.cpp
platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp
platform/graphics/cocoa/FontPlatformDataCocoa.mm
-platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp
+platform/graphics/cocoa/HEVCUtilitiesCocoa.mm
platform/graphics/cocoa/IOSurface.mm
platform/graphics/cocoa/IOSurfacePoolCocoa.mm
platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243108 => 243109)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-18 22:29:55 UTC (rev 243109)
@@ -13778,7 +13778,7 @@
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>"; };
+ CDA595972146DF7800A84185 /* HEVCUtilitiesCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HEVCUtilitiesCocoa.mm; 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>"; };
@@ -25039,8 +25039,8 @@
B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */,
49FFBF1C11C8550E006A7118 /* GraphicsContext3DCocoa.mm */,
B277B4030B22F37C0004BEC6 /* GraphicsContextCocoa.mm */,
- CDA595972146DF7800A84185 /* HEVCUtilitiesCocoa.cpp */,
CDA595962146DF7800A84185 /* HEVCUtilitiesCocoa.h */,
+ CDA595972146DF7800A84185 /* HEVCUtilitiesCocoa.mm */,
2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */,
2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
AD9FF6E01908391D003B61E0 /* IOSurfacePoolCocoa.mm */,
@@ -30863,6 +30863,8 @@
49E911C70EF86D47009D0CAF /* MatrixTransformOperation.h in Headers */,
5CBC8DAD1AAA302200E1C803 /* MediaAccessibilitySoftLink.h in Headers */,
931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */,
+ CDCC9BCF22387E9A00FFB51C /* MediaCapabilitiesDecodingInfo.h in Headers */,
+ CDCC9BD122387EAA00FFB51C /* MediaCapabilitiesEncodingInfo.h in Headers */,
078E093A17D16E1C00420AA1 /* MediaConstraints.h in Headers */,
417253AB1354BBBC00360F2A /* MediaControlElements.h in Headers */,
DEBCCDD416646EAF00A452E1 /* MediaControlElementTypes.h in Headers */,
@@ -32166,7 +32168,6 @@
C65046A9167BFB5500CC2A4D /* TemplateContentDocumentFragment.h in Headers */,
26E944DD1AC4B4EA007B85B5 /* Term.h in Headers */,
6550B6A6099DF0270090D781 /* Text.h in Headers */,
- CDCC9BD122387EAA00FFB51C /* MediaCapabilitiesEncodingInfo.h in Headers */,
93309E17099E64920056E581 /* TextAffinity.h in Headers */,
CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */,
0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */,
@@ -32260,7 +32261,6 @@
49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */,
FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */,
49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */,
- CDCC9BCF22387E9A00FFB51C /* MediaCapabilitiesDecodingInfo.h in Headers */,
49E911D00EF86D47009D0CAF /* TransformOperations.h in Headers */,
5DB1BC6A10715A6400EFAA49 /* TransformSource.h in Headers */,
4945BFD413CF809000CC3B38 /* TransformState.h in Headers */,
Modified: trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp (243108 => 243109)
--- trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.cpp 2019-03-18 22:29:55 UTC (rev 243109)
@@ -30,6 +30,7 @@
#include <VideoToolbox/VideoToolbox.h>
#include <wtf/SoftLinking.h>
+typedef struct OpaqueVTVideoDecoder VTVideoDecoderRef;
typedef struct OpaqueVTImageRotationSession* VTImageRotationSessionRef;
typedef struct OpaqueVTPixelBufferConformer* VTPixelBufferConformerRef;
typedef struct OpaqueVTPixelTransferSession* VTPixelTransferSessionRef;
@@ -50,6 +51,7 @@
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_FUNCTION_FOR_SOURCE(WebCore, VideoToolbox, VTSelectAndCreateVideoDecoderInstance, OSStatus, (CMVideoCodecType codecType, CFAllocatorRef allocator, CFDictionaryRef videoDecoderSpecification, VTVideoDecoderRef *decoderInstanceOut), (codecType, allocator, videoDecoderSpecification, decoderInstanceOut))
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)
Modified: trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h (243108 => 243109)
--- trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/cocoa/VideoToolboxSoftLink.h 2019-03-18 22:29:55 UTC (rev 243109)
@@ -30,6 +30,7 @@
#include <VideoToolbox/VideoToolbox.h>
#include <wtf/SoftLinking.h>
+typedef struct OpaqueVTVideoDecoder VTVideoDecoderRef;
typedef struct OpaqueVTImageRotationSession* VTImageRotationSessionRef;
typedef struct OpaqueVTPixelBufferConformer* VTPixelBufferConformerRef;
typedef struct OpaqueVTPixelTransferSession* VTPixelTransferSessionRef;
@@ -64,6 +65,8 @@
#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_FUNCTION_FOR_HEADER(WebCore, VideoToolbox, VTSelectAndCreateVideoDecoderInstance, OSStatus, (CMVideoCodecType codecType, CFAllocatorRef allocator, CFDictionaryRef videoDecoderSpecification, VTVideoDecoderRef *decoderInstanceOut), (codecType, allocator, videoDecoderSpecification, decoderInstanceOut))
+#define VTSelectAndCreateVideoDecoderInstance softLink_VideoToolbox_VTSelectAndCreateVideoDecoderInstance
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)
Deleted: trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp (243108 => 243109)
--- trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp 2019-03-18 22:29:55 UTC (rev 243109)
@@ -1,101 +0,0 @@
-/*
- * 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)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h (243108 => 243109)
--- trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h 2019-03-18 22:29:55 UTC (rev 243109)
@@ -33,7 +33,7 @@
struct MediaCapabilitiesInfo;
-extern bool validateHEVCParameters(HEVCParameterSet&, MediaCapabilitiesInfo&);
+extern bool validateHEVCParameters(HEVCParameterSet&, MediaCapabilitiesInfo&, bool hasAlphaChannel);
}
Copied: trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm (from rev 243106, trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp) (0 => 243109)
--- trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm 2019-03-18 22:29:55 UTC (rev 243109)
@@ -0,0 +1,120 @@
+/*
+ * 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 "FourCC.h"
+#include "HEVCUtilities.h"
+#include "MediaCapabilitiesInfo.h"
+
+#include "VideoToolboxSoftLink.h"
+
+SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVVideoCodecTypeHEVCWithAlpha, NSString *)
+
+namespace WebCore {
+
+bool validateHEVCParameters(HEVCParameterSet& parameters, MediaCapabilitiesInfo& info, bool hasAlphaChannel)
+{
+ CMVideoCodecType codec = kCMVideoCodecType_HEVC;
+ if (hasAlphaChannel) {
+ if (!AVFoundationLibrary() || !canLoadAVVideoCodecTypeHEVCWithAlpha())
+ return false;
+
+ auto codecCode = FourCC::fromString(getAVVideoCodecTypeHEVCWithAlpha());
+ if (!codecCode)
+ return false;
+
+ codec = codecCode.value().value;
+ }
+ OSStatus status = VTSelectAndCreateVideoDecoderInstance(codec, kCFAllocatorDefault, nullptr, nullptr);
+ if (status != noErr)
+ return false;
+
+ 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)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp (243108 => 243109)
--- trunk/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp 2019-03-18 22:29:55 UTC (rev 243109)
@@ -76,15 +76,24 @@
return;
}
+ bool alphaChannel = videoConfiguration.alphaChannel && videoConfiguration.alphaChannel.value();
+
if (videoCodecType == kCMVideoCodecType_HEVC) {
auto parameters = parseHEVCCodecParameters(codec);
- if (!parameters || !validateHEVCParameters(parameters.value(), info)) {
+ if (!parameters || !validateHEVCParameters(parameters.value(), info, alphaChannel)) {
callback({{ }, WTFMove(configuration)});
return;
}
- } else if (canLoad_VideoToolbox_VTIsHardwareDecodeSupported()) {
- info.powerEfficient = VTIsHardwareDecodeSupported(videoCodecType);
- info.smooth = true;
+ } else {
+ if (alphaChannel) {
+ callback({{ }, WTFMove(configuration)});
+ return;
+ }
+
+ if (canLoad_VideoToolbox_VTIsHardwareDecodeSupported()) {
+ info.powerEfficient = VTIsHardwareDecodeSupported(videoCodecType);
+ info.smooth = true;
+ }
}
}
Modified: trunk/Source/WebCore/platform/mediacapabilities/VideoConfiguration.h (243108 => 243109)
--- trunk/Source/WebCore/platform/mediacapabilities/VideoConfiguration.h 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/mediacapabilities/VideoConfiguration.h 2019-03-18 22:29:55 UTC (rev 243109)
@@ -25,6 +25,7 @@
#pragma once
+#include <wtf/Optional.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -35,6 +36,7 @@
uint32_t height;
uint64_t bitrate;
double framerate;
+ Optional<bool> alphaChannel;
};
}
Modified: trunk/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp (243108 => 243109)
--- trunk/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp 2019-03-18 22:24:32 UTC (rev 243108)
+++ trunk/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp 2019-03-18 22:29:55 UTC (rev 243109)
@@ -47,6 +47,12 @@
if (videoConfig && videoConfig->width > 1280 && videoConfig->height > 720)
return false;
+ // Only the "mock-with-alpha" codec supports alphaChannel
+ if (videoConfig && videoConfig->alphaChannel && videoConfig->alphaChannel.value()) {
+ if (ContentType(videoConfig->contentType).codecsParameter() != "mock-with-alpha")
+ return false;
+ }
+
// Audio decoding support limited to audio/mp4.
auto audioConfig = configuration.audio;
if (audioConfig)
@@ -92,6 +98,12 @@
if (videoConfig && videoConfig->width > 1280 && videoConfig->height > 720)
return false;
+ // Only the "mock-with-alpha" codec supports alphaChannel
+ if (videoConfig && videoConfig->alphaChannel && videoConfig->alphaChannel.value()) {
+ if (ContentType(videoConfig->contentType).codecsParameter() != "mock-with-alpha")
+ return false;
+ }
+
// Audio encoding support limited to audio/mp4.
auto audioConfig = configuration.audio;
if (audioConfig && ContentType(audioConfig->contentType).containerType() != "audio/mp4")