WebKit Bugzilla
Attachment 349214 Details for
Bug 189438
: [MediaCapabilities] Implement MediaEngineConfigurationFactory registration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
0001-MediaCapabilities-Implement-MediaEngineConfiguration.patch (text/plain), 81.87 KB, created by
Jer Noble
on 2018-09-07 16:14:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-09-07 16:14:44 PDT
Size:
81.87 KB
patch
obsolete
>From 22c6282d44a8e7de69618055d22b00166d6e3c76 Mon Sep 17 00:00:00 2001 >From: Jer Noble <jer.noble@apple.com> >Date: Fri, 7 Sep 2018 16:14:01 -0700 >Subject: [MediaCapabilities] Implement MediaEngineConfigurationFactory > registration https://bugs.webkit.org/show_bug.cgi?id=189438 > >Reviewed by NOBODY (OOPS!). > >Implement a mechanism to register platform-specific MediaEngineConfigurationFactory methods, and a mechanism to iterate >over those registered factories when createDecodingConfiguration() and createEncodingConfiguration() are called. > >The Factory has been radically simplified; the concept of MediaEngineDecodingConfiguration >and MediaEngineEncodingConfiguration and its subclasess have been removed. Since the primary >objects representing video and audio configurations are IDLDictionaries, the native objects >are just structs full of POD types (and Strings). Since these have no dependencies on >higher-level HTML concepts, they can be moved into platform/ and accessed from there. This >patch also converts MediaCapabilitiesInfo to an Interface, so its implementation also can >become a struct and live in platform/. The MediaEngineDecodingConfigurationMock and >MediaEngineEncodingConfigurationMock have been consolidated in a single class which simply >parses MediaDecodingConfiguration and MediaEncodingConifguration objects (now that they live >in Platform) and return a MediaCapabilitiesInfo object (now that it does too). > >* Modules/mediacapabilities/MediaCapabilities.cpp: >(WebCore::isValidVideoConfiguration): >(WebCore::MediaCapabilities::decodingInfo): >(WebCore::MediaCapabilities::encodingInfo): >* Modules/mediacapabilities/MediaCapabilitiesInfo.h: Removed. >* Modules/mediacapabilities/MediaCapabilitiesInfo.idl: >* Modules/mediacapabilities/VideoConfiguration.idl: >* Sources.txt: >* WebCore.xcodeproj/project.pbxproj: >* platform/MediaCapabilitiesInfo.h: Copied from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h. >* platform/mediacapabilities/AudioConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h. >* platform/mediacapabilities/MediaConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaConfiguration.h. >* platform/mediacapabilities/MediaDecodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingConfiguration.h. >* platform/mediacapabilities/MediaDecodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h. >* platform/mediacapabilities/MediaEncodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingConfiguration.h. >* platform/mediacapabilities/MediaEncodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingType.h. >* platform/mediacapabilities/MediaEngineConfiguration.cpp: Removed. >* platform/mediacapabilities/MediaEngineConfiguration.h: Removed. >* platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: >(WebCore::factories): >(WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration): >(WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration): >* platform/mediacapabilities/MediaEngineConfigurationFactory.h: >* platform/mediacapabilities/MediaEngineEncodingConfiguration.h: Removed. >* platform/mediacapabilities/VideoConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h. >* platform/mediastream/mac/DisplayCaptureSourceCocoa.h: >* platform/mock/MediaEngineConfigurationFactoryMock.cpp: Added. >(WebCore::canDecodeMedia): >(WebCore::canSmoothlyDecodeMedia): >(WebCore::canPowerEfficientlyDecodeMedia): >(WebCore::canEncodeMedia): >(WebCore::canSmoothlyEncodeMedia): >(WebCore::canPowerEfficientlyEncodeMedia): >(WebCore::MediaEngineConfigurationFactoryMock::createDecodingConfiguration): >(WebCore::MediaEngineConfigurationFactoryMock::createEncodingConfiguration): >* platform/mock/MediaEngineConfigurationFactoryMock.h: Renamed from Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h. >* platform/mock/MediaEngineDecodingConfigurationMock.cpp: Removed. >* platform/mock/MediaEngineDecodingConfigurationMock.h: Removed. >* platform/mock/MediaEngineEncodingConfigurationMock.cpp: Removed. >* platform/mock/MediaEngineEncodingConfigurationMock.h: Removed. >--- > Source/WebCore/ChangeLog | 62 ++++++++ > .../mediacapabilities/MediaCapabilities.cpp | 116 ++++---------- > .../mediacapabilities/MediaCapabilitiesInfo.h | 59 ------- > .../MediaCapabilitiesInfo.idl | 10 +- > .../mediacapabilities/VideoConfiguration.idl | 2 +- > Source/WebCore/Sources.txt | 4 +- > .../WebCore/WebCore.xcodeproj/project.pbxproj | 52 +++---- > .../WebCore/platform/MediaCapabilitiesInfo.h | 36 +++++ > .../mediacapabilities/AudioConfiguration.h | 4 +- > .../mediacapabilities/MediaConfiguration.h | 0 > .../MediaDecodingConfiguration.h | 0 > .../mediacapabilities/MediaDecodingType.h | 0 > .../MediaEncodingConfiguration.h | 0 > .../mediacapabilities/MediaEncodingType.h | 0 > .../MediaEngineConfiguration.cpp | 87 ----------- > .../MediaEngineConfiguration.h | 109 ------------- > .../MediaEngineConfigurationFactory.cpp | 70 +++++++-- > .../MediaEngineConfigurationFactory.h | 18 +-- > .../MediaEngineEncodingConfiguration.h | 57 ------- > .../mediacapabilities/VideoConfiguration.h | 2 +- > .../mac/DisplayCaptureSourceCocoa.h | 3 + > .../MediaEngineConfigurationFactoryMock.cpp | 146 ++++++++++++++++++ > .../MediaEngineConfigurationFactoryMock.h} | 31 ++-- > .../MediaEngineDecodingConfigurationMock.cpp | 88 ----------- > .../MediaEngineDecodingConfigurationMock.h | 58 ------- > .../MediaEngineEncodingConfigurationMock.cpp | 86 ----------- > .../MediaEngineEncodingConfigurationMock.h | 58 ------- > 27 files changed, 387 insertions(+), 771 deletions(-) > delete mode 100644 Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.h > create mode 100644 Source/WebCore/platform/MediaCapabilitiesInfo.h > rename Source/WebCore/{Modules => platform}/mediacapabilities/AudioConfiguration.h (95%) > rename Source/WebCore/{Modules => platform}/mediacapabilities/MediaConfiguration.h (100%) > rename Source/WebCore/{Modules => platform}/mediacapabilities/MediaDecodingConfiguration.h (100%) > rename Source/WebCore/{Modules => platform}/mediacapabilities/MediaDecodingType.h (100%) > rename Source/WebCore/{Modules => platform}/mediacapabilities/MediaEncodingConfiguration.h (100%) > rename Source/WebCore/{Modules => platform}/mediacapabilities/MediaEncodingType.h (100%) > delete mode 100644 Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp > delete mode 100644 Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.h > delete mode 100644 Source/WebCore/platform/mediacapabilities/MediaEngineEncodingConfiguration.h > rename Source/WebCore/{Modules => platform}/mediacapabilities/VideoConfiguration.h (98%) > create mode 100644 Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp > rename Source/WebCore/platform/{mediacapabilities/MediaEngineDecodingConfiguration.h => mock/MediaEngineConfigurationFactoryMock.h} (64%) > delete mode 100644 Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp > delete mode 100644 Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.h > delete mode 100644 Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp > delete mode 100644 Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.h > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6297f4daf92..2c1129ce50d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,65 @@ >+2018-09-07 Jer Noble <jer.noble@apple.com> >+ >+ [MediaCapabilities] Implement MediaEngineConfigurationFactory registration >+ https://bugs.webkit.org/show_bug.cgi?id=189438 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implement a mechanism to register platform-specific MediaEngineConfigurationFactory methods, and a mechanism to iterate >+ over those registered factories when createDecodingConfiguration() and createEncodingConfiguration() are called. >+ >+ The Factory has been radically simplified; the concept of MediaEngineDecodingConfiguration >+ and MediaEngineEncodingConfiguration and its subclasess have been removed. Since the primary >+ objects representing video and audio configurations are IDLDictionaries, the native objects >+ are just structs full of POD types (and Strings). Since these have no dependencies on >+ higher-level HTML concepts, they can be moved into platform/ and accessed from there. This >+ patch also converts MediaCapabilitiesInfo to an Interface, so its implementation also can >+ become a struct and live in platform/. The MediaEngineDecodingConfigurationMock and >+ MediaEngineEncodingConfigurationMock have been consolidated in a single class which simply >+ parses MediaDecodingConfiguration and MediaEncodingConifguration objects (now that they live >+ in Platform) and return a MediaCapabilitiesInfo object (now that it does too). >+ >+ * Modules/mediacapabilities/MediaCapabilities.cpp: >+ (WebCore::isValidVideoConfiguration): >+ (WebCore::MediaCapabilities::decodingInfo): >+ (WebCore::MediaCapabilities::encodingInfo): >+ * Modules/mediacapabilities/MediaCapabilitiesInfo.h: Removed. >+ * Modules/mediacapabilities/MediaCapabilitiesInfo.idl: >+ * Modules/mediacapabilities/VideoConfiguration.idl: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * platform/MediaCapabilitiesInfo.h: Copied from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h. >+ * platform/mediacapabilities/AudioConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h. >+ * platform/mediacapabilities/MediaConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaConfiguration.h. >+ * platform/mediacapabilities/MediaDecodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingConfiguration.h. >+ * platform/mediacapabilities/MediaDecodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h. >+ * platform/mediacapabilities/MediaEncodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingConfiguration.h. >+ * platform/mediacapabilities/MediaEncodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingType.h. >+ * platform/mediacapabilities/MediaEngineConfiguration.cpp: Removed. >+ * platform/mediacapabilities/MediaEngineConfiguration.h: Removed. >+ * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: >+ (WebCore::factories): >+ (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration): >+ (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration): >+ * platform/mediacapabilities/MediaEngineConfigurationFactory.h: >+ * platform/mediacapabilities/MediaEngineEncodingConfiguration.h: Removed. >+ * platform/mediacapabilities/VideoConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h. >+ * platform/mediastream/mac/DisplayCaptureSourceCocoa.h: >+ * platform/mock/MediaEngineConfigurationFactoryMock.cpp: Added. >+ (WebCore::canDecodeMedia): >+ (WebCore::canSmoothlyDecodeMedia): >+ (WebCore::canPowerEfficientlyDecodeMedia): >+ (WebCore::canEncodeMedia): >+ (WebCore::canSmoothlyEncodeMedia): >+ (WebCore::canPowerEfficientlyEncodeMedia): >+ (WebCore::MediaEngineConfigurationFactoryMock::createDecodingConfiguration): >+ (WebCore::MediaEngineConfigurationFactoryMock::createEncodingConfiguration): >+ * platform/mock/MediaEngineConfigurationFactoryMock.h: Renamed from Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h. >+ * platform/mock/MediaEngineDecodingConfigurationMock.cpp: Removed. >+ * platform/mock/MediaEngineDecodingConfigurationMock.h: Removed. >+ * platform/mock/MediaEngineEncodingConfigurationMock.cpp: Removed. >+ * platform/mock/MediaEngineEncodingConfigurationMock.h: Removed. >+ > 2018-09-05 Jer Noble <jer.noble@apple.com> > > Don't pause playback when locking screen if video is being displayed on second screen. >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp b/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp >index 51bf37dc3a6..b6da1232b22 100644 >--- a/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp >+++ b/Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp >@@ -117,35 +117,7 @@ static bool isValidVideoConfiguration(const VideoConfiguration& configuration) > if (!isValidVideoMIMEType(ContentType(configuration.contentType))) > return false; > >- // 2. If none of the following is true, return false and abort these steps: >- // o. Applying the rules for parsing floating-point number values to configurationâs framerate >- // results in a number that is finite and greater than 0. >- bool ok = false; >- double framerate = configuration.framerate.toDouble(&ok); >- if (ok && std::isfinite(framerate) && framerate > 0) >- return true; >- >- // o. Configurationâs framerate contains one occurence of U+002F SLASH character (/) and the substrings >- // before and after this character, when applying the rules for parsing floating-point number values >- // results in a number that is finite and greater than 0. >- auto frameratePieces = configuration.framerate.split('/'); >- if (frameratePieces.size() != 2) >- return false; >- >- double numerator = frameratePieces[0].toDouble(&ok); >- if (!ok) >- return false; >- >- double denominator = frameratePieces[1].toDouble(&ok); >- if (!ok) >- return false; >- >- if (!std::isfinite(numerator) || !std::isfinite(denominator)) >- return false; >- >- framerate = numerator / denominator; >- if (!std::isfinite(framerate) || framerate <= 0) >- return false; >+ // NOTE: We are purposefully eliding the section which parses a DOMString to a double. > > // 3. Return true. > return true; >@@ -199,34 +171,22 @@ void MediaCapabilities::decodingInfo(MediaDecodingConfiguration&& configuration, > m_taskQueue.enqueueTask([configuration = WTFMove(configuration), promise = WTFMove(promise)] () mutable { > > // 2.2.3 If configuration is of type MediaDecodingConfiguration, run the following substeps: >- MediaEngineConfigurationFactory::DecodingConfigurationCallback callback = [promise = WTFMove(promise)] (auto engineConfiguration) mutable { >- auto info = MediaCapabilitiesInfo::create(); >- >- if (engineConfiguration) { >- // 2.2.3.1. If the user agent is able to decode the media represented by >- // configuration, set supported to true. Otherwise set it to false. >- info->setSupported(engineConfiguration->canDecodeMedia()); >- >- if (info->supported()) { >- // 2.2.3.2. If the user agent is able to decode the media represented by >- // configuration at a pace that allows a smooth playback, set smooth to >- // true. Otherwise set it to false. >- info->setSmooth(engineConfiguration->canSmoothlyDecodeMedia()); >- >- // 2.2.3.3. If the user agent is able to decode the media represented by >- // configuration in a power efficient manner, set powerEfficient to >- // true. Otherwise set it to false. The user agent SHOULD NOT take into >- // consideration the current power source in order to determine the >- // decoding power efficiency unless the deviceâs power source has side >- // effects such as enabling different decoding modules. >- info->setPowerEfficient(engineConfiguration->canPowerEfficientlyDecodeMedia()); >- } >- } >- >- promise->resolveWithNewlyCreated<IDLInterface<MediaCapabilitiesInfo>>(WTFMove(info)); >+ MediaEngineConfigurationFactory::DecodingConfigurationCallback callback = [promise = WTFMove(promise)] (auto info) mutable { >+ // 2.2.3.1. If the user agent is able to decode the media represented by >+ // configuration, set supported to true. Otherwise set it to false. >+ // 2.2.3.2. If the user agent is able to decode the media represented by >+ // configuration at a pace that allows a smooth playback, set smooth to >+ // true. Otherwise set it to false. >+ // 2.2.3.3. If the user agent is able to decode the media represented by >+ // configuration in a power efficient manner, set powerEfficient to >+ // true. Otherwise set it to false. The user agent SHOULD NOT take into >+ // consideration the current power source in order to determine the >+ // decoding power efficiency unless the deviceâs power source has side >+ // effects such as enabling different decoding modules. >+ promise->resolve<IDLDictionary<MediaCapabilitiesInfo>>(WTFMove(info)); > }; > >- MediaEngineConfigurationFactory::createDecodingConfiguration(configuration, callback); >+ MediaEngineConfigurationFactory::createDecodingConfiguration(WTFMove(configuration), WTFMove(callback)); > }); > } > >@@ -249,37 +209,25 @@ void MediaCapabilities::encodingInfo(MediaEncodingConfiguration&& configuration, > m_taskQueue.enqueueTask([configuration = WTFMove(configuration), promise = WTFMove(promise)] () mutable { > > // 2.2.4. If configuration is of type MediaEncodingConfiguration, run the following substeps: >- MediaEngineConfigurationFactory::EncodingConfigurationCallback callback = [promise = WTFMove(promise)] (auto engineConfiguration) mutable { >- auto info = MediaCapabilitiesInfo::create(); >- >- if (engineConfiguration) { >- // 2.2.4.1. If the user agent is able to encode the media >- // represented by configuration, set supported to true. Otherwise >- // set it to false. >- info->setSupported(engineConfiguration->canEncodeMedia()); >- >- if (info->supported()) { >- // 2.2.4.2. If the user agent is able to encode the media >- // represented by configuration at a pace that allows encoding >- // frames at the same pace as they are sent to the encoder, set >- // smooth to true. Otherwise set it to false. >- info->setSmooth(engineConfiguration->canSmoothlyEncodeMedia()); >- >- // 2.2.4.3. If the user agent is able to encode the media >- // represented by configuration in a power efficient manner, set >- // powerEfficient to true. Otherwise set it to false. The user agent >- // SHOULD NOT take into consideration the current power source in >- // order to determine the encoding power efficiency unless the >- // deviceâs power source has side effects such as enabling different >- // encoding modules. >- info->setPowerEfficient(engineConfiguration->canPowerEfficientlyEncodeMedia()); >- } >- } >- >- promise->resolveWithNewlyCreated<IDLInterface<MediaCapabilitiesInfo>>(WTFMove(info)); >+ MediaEngineConfigurationFactory::EncodingConfigurationCallback callback = [promise = WTFMove(promise)] (auto info) mutable { >+ // 2.2.4.1. If the user agent is able to encode the media >+ // represented by configuration, set supported to true. Otherwise >+ // set it to false. >+ // 2.2.4.2. If the user agent is able to encode the media >+ // represented by configuration at a pace that allows encoding >+ // frames at the same pace as they are sent to the encoder, set >+ // smooth to true. Otherwise set it to false. >+ // 2.2.4.3. If the user agent is able to encode the media >+ // represented by configuration in a power efficient manner, set >+ // powerEfficient to true. Otherwise set it to false. The user agent >+ // SHOULD NOT take into consideration the current power source in >+ // order to determine the encoding power efficiency unless the >+ // deviceâs power source has side effects such as enabling different >+ // encoding modules. >+ promise->resolve<IDLDictionary<MediaCapabilitiesInfo>>(WTFMove(info)); > }; > >- MediaEngineConfigurationFactory::createEncodingConfiguration(configuration, callback); >+ MediaEngineConfigurationFactory::createEncodingConfiguration(WTFMove(configuration), WTFMove(callback)); > > }); > } >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.h b/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.h >deleted file mode 100644 >index af7adb8fc87..00000000000 >--- a/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.h >+++ /dev/null >@@ -1,59 +0,0 @@ >-/* >- * Copyright (C) 2017 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/RefCounted.h> >- >-namespace WebCore { >- >-class MediaCapabilitiesInfo : public RefCounted<MediaCapabilitiesInfo> { >-public: >- >- static Ref<MediaCapabilitiesInfo> create() >- { >- return adoptRef(*new MediaCapabilitiesInfo()); >- } >- >- ~MediaCapabilitiesInfo() = default; >- >- bool supported() const { return m_supported; } >- void setSupported(bool supported) { m_supported = supported; } >- >- bool smooth() const { return m_smooth; } >- void setSmooth(bool smooth) { m_smooth = smooth; } >- >- bool powerEfficient() const { return m_powerEfficient; } >- void setPowerEfficient(bool powerEfficient) { m_powerEfficient = powerEfficient; } >- >-private: >- MediaCapabilitiesInfo() = default; >- >- bool m_supported { false }; >- bool m_smooth { false }; >- bool m_powerEfficient { false }; >-}; >- >-} >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.idl b/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.idl >index b2525e576cb..7ad0aba8fcf 100644 >--- a/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.idl >+++ b/Source/WebCore/Modules/mediacapabilities/MediaCapabilitiesInfo.idl >@@ -25,10 +25,10 @@ > > [ > EnabledBySetting=MediaCapabilities, >- ImplementationLacksVTable >+ JSGenerateToJSObject, > ] >-interface MediaCapabilitiesInfo { >- readonly attribute boolean supported; >- readonly attribute boolean smooth; >- readonly attribute boolean powerEfficient; >+dictionary MediaCapabilitiesInfo { >+ required boolean supported; >+ required boolean smooth; >+ required boolean powerEfficient; > }; >diff --git a/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl b/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl >index 627e6c9fb7f..01f244dbb4a 100644 >--- a/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl >+++ b/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.idl >@@ -28,5 +28,5 @@ dictionary VideoConfiguration { > required unsigned long width; > required unsigned long height; > required unsigned long long bitrate; >- required DOMString framerate; >+ required double framerate; > }; >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 5915736c516..8d2f9984228 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1727,7 +1727,6 @@ platform/graphics/transforms/TransformState.cpp > platform/graphics/transforms/TransformationMatrix.cpp > platform/graphics/transforms/TranslateTransformOperation.cpp > >-platform/mediacapabilities/MediaEngineConfiguration.cpp > platform/mediacapabilities/MediaEngineConfigurationFactory.cpp > > platform/mediastream/CaptureDeviceManager.cpp >@@ -1751,8 +1750,7 @@ platform/mediastream/libwebrtc/LibWebRTCProvider.cpp > > platform/mock/DeviceOrientationClientMock.cpp > platform/mock/GeolocationClientMock.cpp >-platform/mock/MediaEngineDecodingConfigurationMock.cpp >-platform/mock/MediaEngineEncodingConfigurationMock.cpp >+platform/mock/MediaEngineConfigurationFactoryMock.cpp > platform/mock/MockRealtimeAudioSource.cpp > platform/mock/MockRealtimeMediaSourceCenter.cpp > platform/mock/MockRealtimeVideoSource.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 2876759b3dd..37ff0b0a9ec 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -10739,16 +10739,10 @@ > 9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = "<group>"; }; > 9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = "<group>"; }; > 9AB1F37F18E2489A00534743 /* CSSToLengthConversionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToLengthConversionData.cpp; sourceTree = "<group>"; }; >- 9AC6F02121148F5000CBDA06 /* MediaEngineConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaEngineConfiguration.cpp; path = mediacapabilities/MediaEngineConfiguration.cpp; sourceTree = "<group>"; }; > 9AC6F02221148F5100CBDA06 /* MediaEngineConfigurationFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaEngineConfigurationFactory.cpp; path = mediacapabilities/MediaEngineConfigurationFactory.cpp; sourceTree = "<group>"; }; >- 9AC6F02321148F5200CBDA06 /* MediaEngineConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEngineConfiguration.h; path = mediacapabilities/MediaEngineConfiguration.h; sourceTree = "<group>"; }; >- 9AC6F02421148F5300CBDA06 /* MediaEngineDecodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEngineDecodingConfiguration.h; path = mediacapabilities/MediaEngineDecodingConfiguration.h; sourceTree = "<group>"; }; > 9AC6F02521148F5400CBDA06 /* MediaEngineConfigurationFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEngineConfigurationFactory.h; path = mediacapabilities/MediaEngineConfigurationFactory.h; sourceTree = "<group>"; }; >- 9AC6F02621148F5500CBDA06 /* MediaEngineEncodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEngineEncodingConfiguration.h; path = mediacapabilities/MediaEngineEncodingConfiguration.h; sourceTree = "<group>"; }; >- 9AC6F02D21148F9F00CBDA06 /* MediaEngineDecodingConfigurationMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEngineDecodingConfigurationMock.cpp; sourceTree = "<group>"; }; >- 9AC6F02E21148FA100CBDA06 /* MediaEngineEncodingConfigurationMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEngineEncodingConfigurationMock.cpp; sourceTree = "<group>"; }; >- 9AC6F02F21148FA200CBDA06 /* MediaEngineDecodingConfigurationMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEngineDecodingConfigurationMock.h; sourceTree = "<group>"; }; >- 9AC6F03021148FA400CBDA06 /* MediaEngineEncodingConfigurationMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEngineEncodingConfigurationMock.h; sourceTree = "<group>"; }; >+ 9AC6F02D21148F9F00CBDA06 /* MediaEngineConfigurationFactoryMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEngineConfigurationFactoryMock.cpp; sourceTree = "<group>"; }; >+ 9AC6F02F21148FA200CBDA06 /* MediaEngineConfigurationFactoryMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEngineConfigurationFactoryMock.h; sourceTree = "<group>"; }; > 9B03D8061BB3110D00B73F64 /* ReadableByteStreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableByteStreamInternalsBuiltins.h; sourceTree = "<group>"; }; > 9B03D8061BB3110D00B764C9 /* StreamInternalsBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamInternalsBuiltins.h; sourceTree = "<group>"; }; > 9B03D8061BB3110D00B764D8 /* ReadableStreamBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamBuiltins.h; sourceTree = "<group>"; }; >@@ -13113,6 +13107,7 @@ > CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; }; > CD063F801E23FA8900812BE3 /* InitDataRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitDataRegistry.cpp; sourceTree = "<group>"; }; > CD063F811E23FA8900812BE3 /* InitDataRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitDataRegistry.h; sourceTree = "<group>"; }; >+ CD0C8B582141C8CA0062F59D /* MediaCapabilitiesInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaCapabilitiesInfo.h; sourceTree = "<group>"; }; > CD0EEE0A14743E34003EAFA2 /* AudioDestinationIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDestinationIOS.h; sourceTree = "<group>"; }; > CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioDestinationIOS.cpp; sourceTree = "<group>"; }; > CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; }; >@@ -13292,7 +13287,7 @@ > CDBD3D281FE85CB80012C545 /* VideoConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VideoConfiguration.idl; sourceTree = "<group>"; }; > CDBD3D291FE85CB90012C545 /* MediaConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaConfiguration.idl; sourceTree = "<group>"; }; > CDBD3D2A1FE85CBA0012C545 /* MediaEncodingConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaEncodingConfiguration.idl; sourceTree = "<group>"; }; >- CDBD3D2B1FE85CBB0012C545 /* AudioConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioConfiguration.h; sourceTree = "<group>"; }; >+ CDBD3D2B1FE85CBB0012C545 /* AudioConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioConfiguration.h; path = mediacapabilities/AudioConfiguration.h; sourceTree = "<group>"; }; > CDBD3D2C1FE85CBB0012C545 /* ScreenLuminance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenLuminance.h; sourceTree = "<group>"; }; > CDBD3D2D1FE85CBC0012C545 /* MediaEncodingType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaEncodingType.idl; sourceTree = "<group>"; }; > CDBD3D2E1FE85CBC0012C545 /* MediaDecodingType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaDecodingType.idl; sourceTree = "<group>"; }; >@@ -13301,17 +13296,16 @@ > CDBD3D311FE85CBE0012C545 /* NavigatorMediaCapabilities.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorMediaCapabilities.idl; sourceTree = "<group>"; }; > CDBD3D321FE85CBE0012C545 /* MediaCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCapabilities.h; sourceTree = "<group>"; }; > CDBD3D331FE85CBE0012C545 /* MediaCapabilitiesInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaCapabilitiesInfo.idl; sourceTree = "<group>"; }; >- CDBD3D341FE85CBF0012C545 /* VideoConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoConfiguration.h; sourceTree = "<group>"; }; >- CDBD3D351FE85CBF0012C545 /* MediaConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaConfiguration.h; sourceTree = "<group>"; }; >- CDBD3D361FE85CC00012C545 /* MediaDecodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDecodingConfiguration.h; sourceTree = "<group>"; }; >- CDBD3D371FE85CC00012C545 /* MediaEncodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEncodingConfiguration.h; sourceTree = "<group>"; }; >- CDBD3D381FE85CC00012C545 /* MediaDecodingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDecodingType.h; sourceTree = "<group>"; }; >+ CDBD3D341FE85CBF0012C545 /* VideoConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoConfiguration.h; path = mediacapabilities/VideoConfiguration.h; sourceTree = "<group>"; }; >+ CDBD3D351FE85CBF0012C545 /* MediaConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaConfiguration.h; path = mediacapabilities/MediaConfiguration.h; sourceTree = "<group>"; }; >+ CDBD3D361FE85CC00012C545 /* MediaDecodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaDecodingConfiguration.h; path = mediacapabilities/MediaDecodingConfiguration.h; sourceTree = "<group>"; }; >+ CDBD3D371FE85CC00012C545 /* MediaEncodingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEncodingConfiguration.h; path = mediacapabilities/MediaEncodingConfiguration.h; sourceTree = "<group>"; }; >+ CDBD3D381FE85CC00012C545 /* MediaDecodingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaDecodingType.h; path = mediacapabilities/MediaDecodingType.h; sourceTree = "<group>"; }; > CDBD3D391FE85CC10012C545 /* NavigatorMediaCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorMediaCapabilities.h; sourceTree = "<group>"; }; > CDBD3D3A1FE85CC10012C545 /* ScreenColorGamut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenColorGamut.h; sourceTree = "<group>"; }; > CDBD3D3B1FE85CC20012C545 /* MediaDecodingConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaDecodingConfiguration.idl; sourceTree = "<group>"; }; > CDBD3D3C1FE85CC20012C545 /* AudioConfiguration.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AudioConfiguration.idl; sourceTree = "<group>"; }; >- CDBD3D3D1FE85CC30012C545 /* MediaCapabilitiesInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCapabilitiesInfo.h; sourceTree = "<group>"; }; >- CDBD3D3E1FE85CC30012C545 /* MediaEncodingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEncodingType.h; sourceTree = "<group>"; }; >+ CDBD3D3E1FE85CC30012C545 /* MediaEncodingType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaEncodingType.h; path = mediacapabilities/MediaEncodingType.h; sourceTree = "<group>"; }; > CDBD3D3F1FE85CC30012C545 /* ScreenColorGamut.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScreenColorGamut.idl; sourceTree = "<group>"; }; > CDBEAEAA19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSelectionGroupAVFObjC.mm; sourceTree = "<group>"; }; > CDBEAEAB19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSelectionGroupAVFObjC.h; sourceTree = "<group>"; }; >@@ -18741,10 +18735,8 @@ > CDF2B005182053DF00F2B424 /* mediasource */, > 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */, > 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */, >- 9AC6F02D21148F9F00CBDA06 /* MediaEngineDecodingConfigurationMock.cpp */, >- 9AC6F02F21148FA200CBDA06 /* MediaEngineDecodingConfigurationMock.h */, >- 9AC6F02E21148FA100CBDA06 /* MediaEngineEncodingConfigurationMock.cpp */, >- 9AC6F03021148FA400CBDA06 /* MediaEngineEncodingConfigurationMock.h */, >+ 9AC6F02D21148F9F00CBDA06 /* MediaEngineConfigurationFactoryMock.cpp */, >+ 9AC6F02F21148FA200CBDA06 /* MediaEngineConfigurationFactoryMock.h */, > 077B64141B95F703003E9AD5 /* MediaPlaybackTargetMock.cpp */, > 077B64151B95F703003E9AD5 /* MediaPlaybackTargetMock.h */, > 077B64101B94F12E003E9AD5 /* MediaPlaybackTargetPickerMock.cpp */, >@@ -21157,12 +21149,16 @@ > 9AC6F02021148F1E00CBDA06 /* mediacapabilities */ = { > isa = PBXGroup; > children = ( >- 9AC6F02121148F5000CBDA06 /* MediaEngineConfiguration.cpp */, >- 9AC6F02321148F5200CBDA06 /* MediaEngineConfiguration.h */, >+ CDBD3D2B1FE85CBB0012C545 /* AudioConfiguration.h */, >+ CDBD3D351FE85CBF0012C545 /* MediaConfiguration.h */, >+ CDBD3D381FE85CC00012C545 /* MediaDecodingType.h */, >+ CDBD3D341FE85CBF0012C545 /* VideoConfiguration.h */, >+ CDBD3D361FE85CC00012C545 /* MediaDecodingConfiguration.h */, >+ CDBD3D371FE85CC00012C545 /* MediaEncodingConfiguration.h */, >+ CDBD3D3E1FE85CC30012C545 /* MediaEncodingType.h */, > 9AC6F02221148F5100CBDA06 /* MediaEngineConfigurationFactory.cpp */, > 9AC6F02521148F5400CBDA06 /* MediaEngineConfigurationFactory.h */, >- 9AC6F02421148F5300CBDA06 /* MediaEngineDecodingConfiguration.h */, >- 9AC6F02621148F5500CBDA06 /* MediaEngineEncodingConfiguration.h */, >+ CD0C8B582141C8CA0062F59D /* MediaCapabilitiesInfo.h */, > ); > name = mediacapabilities; > sourceTree = "<group>"; >@@ -24739,22 +24735,15 @@ > CDBD3D271FE85C920012C545 /* mediacapabilities */ = { > isa = PBXGroup; > children = ( >- CDBD3D2B1FE85CBB0012C545 /* AudioConfiguration.h */, > CDBD3D3C1FE85CC20012C545 /* AudioConfiguration.idl */, > CDA130BD1FEB332D00F53254 /* MediaCapabilities.cpp */, > CDBD3D321FE85CBE0012C545 /* MediaCapabilities.h */, > CDBD3D2F1FE85CBC0012C545 /* MediaCapabilities.idl */, >- CDBD3D3D1FE85CC30012C545 /* MediaCapabilitiesInfo.h */, > CDBD3D331FE85CBE0012C545 /* MediaCapabilitiesInfo.idl */, >- CDBD3D351FE85CBF0012C545 /* MediaConfiguration.h */, > CDBD3D291FE85CB90012C545 /* MediaConfiguration.idl */, >- CDBD3D361FE85CC00012C545 /* MediaDecodingConfiguration.h */, > CDBD3D3B1FE85CC20012C545 /* MediaDecodingConfiguration.idl */, >- CDBD3D381FE85CC00012C545 /* MediaDecodingType.h */, > CDBD3D2E1FE85CBC0012C545 /* MediaDecodingType.idl */, >- CDBD3D371FE85CC00012C545 /* MediaEncodingConfiguration.h */, > CDBD3D2A1FE85CBA0012C545 /* MediaEncodingConfiguration.idl */, >- CDBD3D3E1FE85CC30012C545 /* MediaEncodingType.h */, > CDBD3D2D1FE85CBC0012C545 /* MediaEncodingType.idl */, > CDA130BB1FEB332C00F53254 /* NavigatorMediaCapabilities.cpp */, > CDBD3D391FE85CC10012C545 /* NavigatorMediaCapabilities.h */, >@@ -24763,7 +24752,6 @@ > CDBD3D3F1FE85CC30012C545 /* ScreenColorGamut.idl */, > CDBD3D2C1FE85CBB0012C545 /* ScreenLuminance.h */, > CDBD3D301FE85CBD0012C545 /* ScreenLuminance.idl */, >- CDBD3D341FE85CBF0012C545 /* VideoConfiguration.h */, > CDBD3D281FE85CB80012C545 /* VideoConfiguration.idl */, > ); > path = mediacapabilities; >diff --git a/Source/WebCore/platform/MediaCapabilitiesInfo.h b/Source/WebCore/platform/MediaCapabilitiesInfo.h >new file mode 100644 >index 00000000000..2dde787d7b8 >--- /dev/null >+++ b/Source/WebCore/platform/MediaCapabilitiesInfo.h >@@ -0,0 +1,36 @@ >+/* >+ * 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 WebCore { >+ >+struct MediaCapabilitiesInfo { >+ bool supported { false }; >+ bool smooth { false }; >+ bool powerEfficient { false }; >+}; >+ >+} >diff --git a/Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h b/Source/WebCore/platform/mediacapabilities/AudioConfiguration.h >similarity index 95% >rename from Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h >rename to Source/WebCore/platform/mediacapabilities/AudioConfiguration.h >index 5eff359b499..b760af378a5 100644 >--- a/Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h >+++ b/Source/WebCore/platform/mediacapabilities/AudioConfiguration.h >@@ -33,8 +33,8 @@ namespace WebCore { > struct AudioConfiguration { > String contentType; > String channels; >- std::optional<uint64_t> bitrate; >- std::optional<uint32_t> samplerate; >+ uint64_t bitrate; >+ uint32_t samplerate; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaConfiguration.h >similarity index 100% >rename from Source/WebCore/Modules/mediacapabilities/MediaConfiguration.h >rename to Source/WebCore/platform/mediacapabilities/MediaConfiguration.h >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaDecodingConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaDecodingConfiguration.h >similarity index 100% >rename from Source/WebCore/Modules/mediacapabilities/MediaDecodingConfiguration.h >rename to Source/WebCore/platform/mediacapabilities/MediaDecodingConfiguration.h >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h b/Source/WebCore/platform/mediacapabilities/MediaDecodingType.h >similarity index 100% >rename from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h >rename to Source/WebCore/platform/mediacapabilities/MediaDecodingType.h >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaEncodingConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaEncodingConfiguration.h >similarity index 100% >rename from Source/WebCore/Modules/mediacapabilities/MediaEncodingConfiguration.h >rename to Source/WebCore/platform/mediacapabilities/MediaEncodingConfiguration.h >diff --git a/Source/WebCore/Modules/mediacapabilities/MediaEncodingType.h b/Source/WebCore/platform/mediacapabilities/MediaEncodingType.h >similarity index 100% >rename from Source/WebCore/Modules/mediacapabilities/MediaEncodingType.h >rename to Source/WebCore/platform/mediacapabilities/MediaEncodingType.h >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp b/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp >deleted file mode 100644 >index 30957ff15a5..00000000000 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp >+++ /dev/null >@@ -1,87 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaEngineConfiguration.h" >- >-namespace WebCore { >- >-MediaEngineVideoConfiguration::MediaEngineVideoConfiguration(VideoConfiguration&& config) >- : m_type(config.contentType) >- , m_width(config.width) >- , m_height(config.height) >- , m_bitrate(config.bitrate) >- , m_frameRateNumerator(0) >- , m_frameRateDenominator(1) >-{ >- bool ok = false; >- m_frameRateNumerator = config.framerate.toDouble(&ok); >- if (ok) >- return; >- >- auto frameratePieces = config.framerate.split('/'); >- if (frameratePieces.size() != 2) >- return; >- >- double numerator = frameratePieces[0].toDouble(&ok); >- if (!ok || !numerator) >- return; >- >- double denominator = frameratePieces[1].toDouble(&ok); >- if (!ok || !denominator) >- return; >- >- if (!std::isfinite(numerator) || !std::isfinite(denominator)) >- return; >- >- m_frameRateNumerator = numerator; >- m_frameRateDenominator = denominator; >-} >- >-MediaEngineAudioConfiguration::MediaEngineAudioConfiguration(AudioConfiguration&& config) >- : m_type(config.contentType) >- , m_channels(config.channels) >- , m_bitrate(0) >- , m_samplerate(0) >-{ >- if (config.bitrate) >- m_bitrate = config.bitrate.value(); >- >- if (config.samplerate) >- m_samplerate = config.samplerate.value(); >-} >- >-MediaEngineConfiguration::MediaEngineConfiguration(MediaConfiguration&& config) >-{ >- if (config.audio) >- m_audioConfiguration = MediaEngineAudioConfiguration::create(config.audio.value()); >- >- if (config.video) >- m_videoConfiguration = MediaEngineVideoConfiguration::create(config.video.value()); >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.h >deleted file mode 100644 >index aa3477e62d8..00000000000 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.h >+++ /dev/null >@@ -1,109 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "AudioConfiguration.h" >-#include "ContentType.h" >-#include "IntSize.h" >-#include "MediaConfiguration.h" >-#include "VideoConfiguration.h" >- >-#include <wtf/Forward.h> >- >-namespace WebCore { >-class MediaEngineConfiguration; >- >-class MediaEngineVideoConfiguration : public RefCounted<MediaEngineVideoConfiguration> { >-public: >- static Ref<MediaEngineVideoConfiguration> create(VideoConfiguration& config) >- { >- return adoptRef(*new MediaEngineVideoConfiguration(WTFMove(config))); >- }; >- >- ContentType contentType() const { return m_type; }; >- IntSize size() const { return IntSize(m_width, m_height); }; >- uint64_t bitrate() const { return m_bitrate; }; >- double framerate() const { return m_frameRateNumerator / m_frameRateDenominator; }; >- >-private: >- MediaEngineVideoConfiguration(VideoConfiguration&&); >- >- ContentType m_type; >- uint32_t m_width; >- uint32_t m_height; >- uint64_t m_bitrate; >- double m_frameRateNumerator; >- double m_frameRateDenominator; >-}; >- >-class MediaEngineAudioConfiguration : public RefCounted<MediaEngineAudioConfiguration> { >-public: >- static Ref<MediaEngineAudioConfiguration> create(AudioConfiguration& config) >- { >- return adoptRef(*new MediaEngineAudioConfiguration(WTFMove(config))); >- }; >- >- ContentType contentType() const { return m_type; }; >- String channels() const { return m_channels; }; >- uint64_t bitrate() const { return m_bitrate; }; >- uint32_t samplerate() const { return m_samplerate; }; >- >-private: >- MediaEngineAudioConfiguration(AudioConfiguration&&); >- >- ContentType m_type; >- String m_channels; >- uint64_t m_bitrate; >- uint32_t m_samplerate; >-}; >- >-class MediaEngineConfiguration : public RefCounted<MediaEngineConfiguration> { >-public: >- MediaEngineConfiguration(MediaConfiguration&&); >- virtual ~MediaEngineConfiguration() = default; >- >- enum class ImplementationType { >- Mock, >- }; >- >- virtual ImplementationType implementationType() const = 0; >- >- RefPtr<MediaEngineAudioConfiguration> audioConfiguration() const { return m_audioConfiguration; }; >- RefPtr<MediaEngineVideoConfiguration> videoConfiguration() const { return m_videoConfiguration; }; >- >-private: >- RefPtr<MediaEngineAudioConfiguration> m_audioConfiguration; >- RefPtr<MediaEngineVideoConfiguration> m_videoConfiguration; >-}; >- >-} // namespace WebCore >- >-#define SPECIALIZE_TYPE_TRAITS_MEDIA_ENGINE_CONFIGURATION(ToValueTypeName, ImplementationTypeName) \ >- SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \ >- static bool isType(const WebCore::MediaEngineConfiguration& config) { return config.implementationType() == ImplementationTypeName; } \ >- SPECIALIZE_TYPE_TRAITS_END() >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >index b15388573d4..8a6d8904dcd 100644 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >+++ b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.cpp >@@ -28,11 +28,13 @@ > #include "config.h" > #include "MediaEngineConfigurationFactory.h" > >-#include "DeprecatedGlobalSettings.h" >-#include "MediaEngineDecodingConfiguration.h" >-#include "MediaEngineDecodingConfigurationMock.h" >-#include "MediaEngineEncodingConfiguration.h" >-#include "MediaEngineEncodingConfigurationMock.h" >+#include "MediaCapabilitiesInfo.h" >+#include "MediaDecodingConfiguration.h" >+#include "MediaEncodingConfiguration.h" >+#include "MediaEngineConfigurationFactoryMock.h" >+#include "MediaPlayerPrivateAVFoundationObjC.h" >+#include <wtf/NeverDestroyed.h> >+#include <wtf/Vector.h> > > namespace WebCore { > >@@ -42,22 +44,68 @@ static bool& mockEnabled() > return enabled; > } > >-void MediaEngineConfigurationFactory::createDecodingConfiguration(MediaDecodingConfiguration& config, MediaEngineConfigurationFactory::DecodingConfigurationCallback& callback) >+struct MediaEngineFactory { >+ void(*createDecodingConfiguration)(MediaDecodingConfiguration&, MediaEngineConfigurationFactory::DecodingConfigurationCallback&&); >+ void(*createEncodingConfiguration)(MediaEncodingConfiguration&, MediaEngineConfigurationFactory::EncodingConfigurationCallback&&); >+}; >+ >+using FactoryVector = Vector<MediaEngineFactory>; >+static const FactoryVector& factories() >+{ >+ static NeverDestroyed<FactoryVector> factories = makeNeverDestroyed(FactoryVector({ })); >+ return factories; >+} >+ >+void MediaEngineConfigurationFactory::createDecodingConfiguration(MediaDecodingConfiguration&& config, MediaEngineConfigurationFactory::DecodingConfigurationCallback&& callback) > { > if (mockEnabled()) { >- MediaEngineDecodingConfigurationMock::create(config, callback); >+ MediaEngineConfigurationFactoryMock::createDecodingConfiguration(config, WTFMove(callback)); > return; > } >- callback(nullptr); >+ >+ auto factoryCallback = [] (auto factoryCallback, auto nextFactory, auto config, auto&& callback) mutable { >+ if (nextFactory == factories().end()) { >+ callback({ }); >+ return; >+ } >+ >+ auto& factory = *nextFactory; >+ factory.createDecodingConfiguration(config, [factoryCallback, nextFactory, config, callback = WTFMove(callback)] (auto&& info) mutable { >+ if (info.supported) { >+ callback(WTFMove(info)); >+ return; >+ } >+ >+ factoryCallback(factoryCallback, ++nextFactory, config, WTFMove(callback)); >+ }); >+ }; >+ factoryCallback(factoryCallback, factories().begin(), config, WTFMove(callback)); > } > >-void MediaEngineConfigurationFactory::createEncodingConfiguration(MediaEncodingConfiguration& config, MediaEngineConfigurationFactory::EncodingConfigurationCallback& callback) >+void MediaEngineConfigurationFactory::createEncodingConfiguration(MediaEncodingConfiguration&& config, MediaEngineConfigurationFactory::EncodingConfigurationCallback&& callback) > { > if (mockEnabled()) { >- MediaEngineEncodingConfigurationMock::create(config, callback); >+ MediaEngineConfigurationFactoryMock::createEncodingConfiguration(config, WTFMove(callback)); > return; > } >- callback(nullptr); >+ >+ auto factoryCallback = [] (auto factoryCallback, auto nextFactory, auto config, auto&& callback) mutable { >+ if (nextFactory == factories().end()) { >+ callback({ }); >+ return; >+ } >+ >+ auto& factory = *nextFactory; >+ factory.createEncodingConfiguration(config, [factoryCallback, nextFactory, config, callback = WTFMove(callback)] (auto&& info) mutable { >+ if (info.supported) { >+ callback(WTFMove(info)); >+ return; >+ } >+ >+ factoryCallback(factoryCallback, ++nextFactory, config, WTFMove(callback)); >+ }); >+ }; >+ factoryCallback(factoryCallback, factories().begin(), config, WTFMove(callback)); > } > > void MediaEngineConfigurationFactory::enableMock() >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.h b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.h >index 7eecb6365c5..4b51e95bdd9 100644 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.h >+++ b/Source/WebCore/platform/mediacapabilities/MediaEngineConfigurationFactory.h >@@ -27,21 +27,21 @@ > > #pragma once > >-#include "MediaCapabilities.h" >-#include "MediaDecodingConfiguration.h" >-#include "MediaEngineDecodingConfiguration.h" >-#include "MediaEngineEncodingConfiguration.h" >-#include <wtf/Forward.h> >+#include <wtf/Function.h> > > namespace WebCore { > >+struct MediaCapabilitiesInfo; >+struct MediaDecodingConfiguration; >+struct MediaEncodingConfiguration; >+ > class MediaEngineConfigurationFactory { > public: >- using DecodingConfigurationCallback = WTF::Function<void(RefPtr<MediaEngineDecodingConfiguration>)>; >- using EncodingConfigurationCallback = WTF::Function<void(RefPtr<MediaEngineEncodingConfiguration>)>; >+ using DecodingConfigurationCallback = WTF::Function<void(MediaCapabilitiesInfo&&)>; >+ using EncodingConfigurationCallback = WTF::Function<void(MediaCapabilitiesInfo&&)>; > >- static void createDecodingConfiguration(MediaDecodingConfiguration&, DecodingConfigurationCallback&); >- static void createEncodingConfiguration(MediaEncodingConfiguration&, EncodingConfigurationCallback&); >+ static void createDecodingConfiguration(MediaDecodingConfiguration&&, DecodingConfigurationCallback&&); >+ static void createEncodingConfiguration(MediaEncodingConfiguration&&, EncodingConfigurationCallback&&); > > WEBCORE_EXPORT static void enableMock(); > WEBCORE_EXPORT static void disableMock(); >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineEncodingConfiguration.h b/Source/WebCore/platform/mediacapabilities/MediaEngineEncodingConfiguration.h >deleted file mode 100644 >index 2f763aa75f1..00000000000 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineEncodingConfiguration.h >+++ /dev/null >@@ -1,57 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaEncodingConfiguration.h" >-#include "MediaEngineConfiguration.h" >- >-#include <wtf/Forward.h> >- >-namespace WebCore { >- >-class MediaEngineEncodingConfiguration : public MediaEngineConfiguration { >-public: >- MediaEngineEncodingConfiguration(MediaEncodingConfiguration&& config) >- : MediaEngineConfiguration(reinterpret_cast<MediaConfiguration&&>(config)) >- , m_encodingType(config.type) >- { >- } >- >- virtual ~MediaEngineEncodingConfiguration() = default; >- >- virtual bool canEncodeMedia() { return false; }; >- virtual bool canSmoothlyEncodeMedia() { return false; }; >- virtual bool canPowerEfficientlyEncodeMedia() { return false; }; >- >- MediaEncodingType encodingType() const { return m_encodingType; }; >- >-private: >- MediaEncodingType m_encodingType; >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h b/Source/WebCore/platform/mediacapabilities/VideoConfiguration.h >similarity index 98% >rename from Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h >rename to Source/WebCore/platform/mediacapabilities/VideoConfiguration.h >index e2428b2d823..a378fd309f6 100644 >--- a/Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h >+++ b/Source/WebCore/platform/mediacapabilities/VideoConfiguration.h >@@ -34,7 +34,7 @@ struct VideoConfiguration { > uint32_t width; > uint32_t height; > uint64_t bitrate; >- String framerate; >+ double framerate; > }; > > } >diff --git a/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h b/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >index 7877e0bac49..4ba1b8febfb 100644 >--- a/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >+++ b/Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.h >@@ -34,6 +34,9 @@ > #include <wtf/RunLoop.h> > #include <wtf/text/WTFString.h> > >+typedef struct __CVBuffer *CVPixelBufferRef; >+typedef struct __IOSurface *IOSurfaceRef; >+ > namespace WTF { > class MediaTime; > } >diff --git a/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp b/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp >new file mode 100644 >index 00000000000..3ca1e4e3938 >--- /dev/null >+++ b/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp >@@ -0,0 +1,146 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >+ * HOLDER OR 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 "MediaEngineConfigurationFactoryMock.h" >+ >+#include "ContentType.h" >+#include "MediaCapabilitiesInfo.h" >+#include "MediaDecodingConfiguration.h" >+#include "MediaEncodingConfiguration.h" >+ >+namespace WebCore { >+ >+static bool canDecodeMedia(const MediaDecodingConfiguration& configuration) >+{ >+ // The mock implementation supports only local file playback. >+ if (configuration.type == MediaDecodingType::MediaSource) >+ return false; >+ >+ // Maxing out video decoding support at 720P. >+ auto videoConfig = configuration.video; >+ if (videoConfig && videoConfig->width > 1280 && videoConfig->height > 720) >+ return false; >+ >+ // Audio decoding support limited to audio/mp4. >+ auto audioConfig = configuration.audio; >+ if (audioConfig) >+ return ContentType(audioConfig->contentType).containerType() == "audio/mp4"; >+ >+ return true; >+} >+ >+static bool canSmoothlyDecodeMedia(const MediaDecodingConfiguration& configuration) >+{ >+ auto videoConfig = configuration.video; >+ if (videoConfig && videoConfig->framerate > 30) >+ return false; >+ >+ auto audioConfig = configuration.audio; >+ if (audioConfig) >+ return audioConfig->channels == "2"; >+ >+ return true; >+} >+ >+static bool canPowerEfficientlyDecodeMedia(const MediaDecodingConfiguration& configuration) >+{ >+ auto videoConfig = configuration.video; >+ if (videoConfig && ContentType(videoConfig->contentType).containerType() != "video/mp4") >+ return false; >+ >+ auto audioConfig = configuration.audio; >+ if (audioConfig) >+ return audioConfig->bitrate <= 1000; >+ >+ return true; >+} >+ >+static bool canEncodeMedia(const MediaEncodingConfiguration& configuration) >+{ >+ // The mock implementation supports only local file playback. >+ if (configuration.type == MediaEncodingType::Record) >+ return false; >+ >+ // Maxing out video encoding support at 720P. >+ auto videoConfig = configuration.video; >+ if (videoConfig && videoConfig->width > 1280 && videoConfig->height > 720) >+ return false; >+ >+ // Audio encoding support limited to audio/mp4. >+ auto audioConfig = configuration.audio; >+ if (audioConfig && ContentType(audioConfig->contentType).containerType() != "audio/mp4") >+ return false; >+ >+ return true; >+} >+ >+static bool canSmoothlyEncodeMedia(const MediaEncodingConfiguration& configuration) >+{ >+ auto videoConfig = configuration.video; >+ if (videoConfig && videoConfig->framerate > 30) >+ return false; >+ >+ auto audioConfig = configuration.audio; >+ if (audioConfig && audioConfig->channels != "2") >+ return false; >+ >+ return true; >+} >+ >+static bool canPowerEfficientlyEncodeMedia(const MediaEncodingConfiguration& configuration) >+{ >+ auto videoConfig = configuration.video; >+ if (videoConfig && ContentType(videoConfig->contentType).containerType() != "video/mp4") >+ return false; >+ >+ auto audioConfig = configuration.audio; >+ if (audioConfig && audioConfig->bitrate > 1000) >+ return false; >+ >+ return true; >+} >+ >+void MediaEngineConfigurationFactoryMock::createDecodingConfiguration(MediaDecodingConfiguration& configuration, DecodingConfigurationCallback&& callback) >+{ >+ if (!canDecodeMedia(configuration)) { >+ callback({ }); >+ return; >+ } >+ callback({ true, canSmoothlyDecodeMedia(configuration), canPowerEfficientlyDecodeMedia(configuration) }); >+} >+ >+void MediaEngineConfigurationFactoryMock::createEncodingConfiguration(MediaEncodingConfiguration& configuration, EncodingConfigurationCallback&& callback) >+{ >+ if (!canEncodeMedia(configuration)) { >+ callback({ }); >+ return; >+ } >+ callback({ true, canSmoothlyEncodeMedia(configuration), canPowerEfficientlyEncodeMedia(configuration) }); >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h b/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.h >similarity index 64% >rename from Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h >rename to Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.h >index cdac105401a..64951006c7c 100644 >--- a/Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h >+++ b/Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.h >@@ -27,31 +27,20 @@ > > #pragma once > >-#include "MediaDecodingConfiguration.h" >-#include "MediaEngineConfiguration.h" >- >-#include <wtf/Forward.h> >+#include <wtf/Function.h> > > namespace WebCore { > >-class MediaEngineDecodingConfiguration : public MediaEngineConfiguration { >-public: >- MediaEngineDecodingConfiguration(MediaDecodingConfiguration&& config) >- : MediaEngineConfiguration(reinterpret_cast<MediaConfiguration&&>(config)) >- , m_decodingType(config.type) >- { >- } >- >- virtual ~MediaEngineDecodingConfiguration() = default; >- >- virtual bool canDecodeMedia() { return false; }; >- virtual bool canSmoothlyDecodeMedia() { return false; }; >- virtual bool canPowerEfficientlyDecodeMedia() { return false; }; >+struct MediaCapabilitiesInfo; >+struct MediaDecodingConfiguration; >+struct MediaEncodingConfiguration; > >- MediaDecodingType decodingType() const { return m_decodingType; }; >+struct MediaEngineConfigurationFactoryMock { >+ using DecodingConfigurationCallback = WTF::Function<void(MediaCapabilitiesInfo&&)>; >+ using EncodingConfigurationCallback = WTF::Function<void(MediaCapabilitiesInfo&&)>; > >-private: >- MediaDecodingType m_decodingType; >+ static void createDecodingConfiguration(MediaDecodingConfiguration&, DecodingConfigurationCallback&&); >+ static void createEncodingConfiguration(MediaEncodingConfiguration&, EncodingConfigurationCallback&&); > }; > >-} // namespace WebCore >+} >diff --git a/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp b/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp >deleted file mode 100644 >index 301ce19d05b..00000000000 >--- a/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp >+++ /dev/null >@@ -1,88 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaEngineDecodingConfigurationMock.h" >- >-#include "ContentType.h" >-#include "IntSize.h" >- >-namespace WebCore { >- >-bool MediaEngineDecodingConfigurationMock::canDecodeMedia() >-{ >- // The mock implementation supports only local file playback. >- if (decodingType() == MediaDecodingType::MediaSource) >- return false; >- >- // Maxing out video decoding support at 720P. >- auto videoConfig = videoConfiguration(); >- if (videoConfig) { >- IntSize size = videoConfig->size(); >- if (size.width() > 1280 && size.height() > 720) >- return false; >- } >- >- // Audio decoding support limited to audio/mp4. >- auto audioConfig = audioConfiguration(); >- if (audioConfig) >- return audioConfig->contentType().containerType() == "audio/mp4"; >- >- return true; >-} >- >-bool MediaEngineDecodingConfigurationMock::canSmoothlyDecodeMedia() >-{ >- auto videoConfig = videoConfiguration(); >- if (videoConfig) { >- if (videoConfig->framerate() > 30) >- return false; >- } >- >- RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration(); >- if (audioConfig) >- return audioConfig->channels() == "2"; >- >- return true; >-} >- >-bool MediaEngineDecodingConfigurationMock::canPowerEfficientlyDecodeMedia() >-{ >- auto videoConfig = videoConfiguration(); >- if (videoConfig) { >- if (videoConfig->contentType().containerType() != "video/mp4") >- return false; >- } >- >- auto audioConfig = audioConfiguration(); >- if (audioConfig) >- return audioConfig->bitrate() <= 1000; >- >- return true; >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.h b/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.h >deleted file mode 100644 >index 61f38298fc0..00000000000 >--- a/Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.h >+++ /dev/null >@@ -1,58 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaDecodingConfiguration.h" >-#include "MediaEngineConfigurationFactory.h" >-#include "MediaEngineDecodingConfiguration.h" >- >-#include <wtf/Forward.h> >- >-namespace WebCore { >- >-class MediaEngineDecodingConfigurationMock final : public MediaEngineDecodingConfiguration { >-public: >- static void create(MediaDecodingConfiguration& config, MediaEngineConfigurationFactory::DecodingConfigurationCallback& callback) >- { >- auto mockConfig = adoptRef(new MediaEngineDecodingConfigurationMock(WTFMove(config))); >- callback(mockConfig); >- }; >- >- ImplementationType implementationType() const final { return ImplementationType::Mock; } >- bool canDecodeMedia() final; >- bool canSmoothlyDecodeMedia() final; >- bool canPowerEfficientlyDecodeMedia() final; >- >-private: >- explicit MediaEngineDecodingConfigurationMock(MediaDecodingConfiguration&& config) >- : MediaEngineDecodingConfiguration(WTFMove(config)) { }; >-}; >- >-} >- >-SPECIALIZE_TYPE_TRAITS_MEDIA_ENGINE_CONFIGURATION(WebCore::MediaEngineDecodingConfigurationMock, WebCore::MediaEngineDecodingConfiguration::ImplementationType::Mock); >diff --git a/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp b/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp >deleted file mode 100644 >index 680249163bb..00000000000 >--- a/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp >+++ /dev/null >@@ -1,86 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaEngineEncodingConfigurationMock.h" >- >-#include "ContentType.h" >-#include "IntSize.h" >- >-namespace WebCore { >- >-bool MediaEngineEncodingConfigurationMock::canEncodeMedia() >-{ >- // The mock implementation supports only local file playback. >- if (encodingType() == MediaEncodingType::Record) >- return false; >- >- // Maxing out video encoding support at 720P. >- auto videoConfig = videoConfiguration(); >- if (videoConfig) { >- IntSize size = videoConfig->size(); >- if (size.width() > 1280 && size.height() > 720) >- return false; >- } >- >- // Audio encoding support limited to audio/mp4. >- auto audioConfig = audioConfiguration(); >- if (audioConfig && (audioConfig->contentType().containerType() != "audio/mp4")) >- return false; >- >- return true; >-} >- >-bool MediaEngineEncodingConfigurationMock::canSmoothlyEncodeMedia() >-{ >- auto videoConfig = videoConfiguration(); >- if (videoConfig) { >- if (videoConfig->framerate() > 30) >- return false; >- } >- >- auto audioConfig = audioConfiguration(); >- if (audioConfig && audioConfig->channels() != "2") >- return false; >- >- return true; >-} >- >-bool MediaEngineEncodingConfigurationMock::canPowerEfficientlyEncodeMedia() >-{ >- auto videoConfig = videoConfiguration(); >- if (videoConfig && (videoConfig->contentType().containerType() != "video/mp4")) >- return false; >- >- auto audioConfig = audioConfiguration(); >- if (audioConfig && (audioConfig->bitrate() > 1000)) >- return false; >- >- return true; >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.h b/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.h >deleted file mode 100644 >index 8c405aff78d..00000000000 >--- a/Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.h >+++ /dev/null >@@ -1,58 +0,0 @@ >-/* >- * Copyright (C) 2018 Igalia S.L. >- * >- * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT >- * HOLDER OR 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 "MediaEncodingConfiguration.h" >-#include "MediaEngineConfigurationFactory.h" >-#include "MediaEngineEncodingConfiguration.h" >- >-#include <wtf/Forward.h> >- >-namespace WebCore { >- >-class MediaEngineEncodingConfigurationMock final : public MediaEngineEncodingConfiguration { >-public: >- static void create(MediaEncodingConfiguration& config, MediaEngineConfigurationFactory::EncodingConfigurationCallback& callback) >- { >- auto mockConfig = adoptRef(new MediaEngineEncodingConfigurationMock(WTFMove(config))); >- callback(mockConfig); >- }; >- >- ImplementationType implementationType() const final { return ImplementationType::Mock; } >- bool canEncodeMedia() final; >- bool canSmoothlyEncodeMedia() final; >- bool canPowerEfficientlyEncodeMedia() final; >- >-private: >- explicit MediaEngineEncodingConfigurationMock(MediaEncodingConfiguration&& config) >- : MediaEngineEncodingConfiguration(WTFMove(config)) { }; >-}; >- >-} >- >-SPECIALIZE_TYPE_TRAITS_MEDIA_ENGINE_CONFIGURATION(WebCore::MediaEngineEncodingConfigurationMock, WebCore::MediaEngineEncodingConfiguration::ImplementationType::Mock);
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
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189438
:
349214
|
349219
|
349220
|
349225
|
349230
|
349235
|
349315
|
349317