Changeset 264476 in webkit
- Timestamp:
- Jul 16, 2020 1:49:35 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 29 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264472 r264476 1 2020-07-16 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Add MediaCapabilities support for SW VP9 decoder. 4 https://bugs.webkit.org/show_bug.cgi?id=214316 5 6 Reviewed by Eric Carlson. 7 8 * platform/mac/media/mediacapabilities/vp9-decodingInfo-sw-expected.txt: Added. 9 * platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html: Added. 10 1 11 2020-07-16 Hector Lopez <hector_i_lopez@apple.com> 2 12 -
trunk/LayoutTests/platform/mac/TestExpectations
r264356 r264476 1921 1921 1922 1922 webkit.org/b/214155 imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/blob.https.html [ Pass Failure ] 1923 1924 # This test requires system platform support. 1925 platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r264475 r264476 1 2020-07-16 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Add MediaCapabilities support for SW VP9 decoder. 4 https://bugs.webkit.org/show_bug.cgi?id=214316 5 6 Reviewed by Eric Carlson. 7 8 Test: platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html 9 10 Add some foundational support for SW VP9, which due to policy decisions will need information 11 both on the system battery status and the power adapter status, and these need to be shipped 12 into the WebContent process from the UIProcess. 13 14 Add some Internal override settings to allow the policies to be effectively tested through 15 LayouTests. This includes overrides for system battery and AC state, as well as overrides for 16 screen size and resolution. 17 18 * SourcesCocoa.txt: 19 * WebCore.xcodeproj/project.pbxproj: 20 * platform/PlatformScreen.cpp: 21 (WebCore::getScreenProperties): 22 * platform/PlatformScreen.h: 23 * platform/ScreenProperties.h: 24 (WebCore::ScreenData::encode const): 25 (WebCore::ScreenData::decode): 26 * platform/cocoa/PowerSourceNotifier.h: 27 * platform/cocoa/PowerSourceNotifier.mm: 28 (WebCore::PowerSourceNotifier::PowerSourceNotifier): 29 (WebCore::PowerSourceNotifier::~PowerSourceNotifier): 30 (WebCore::PowerSourceNotifier::notifyPowerSourceChanged): 31 * platform/cocoa/SystemBattery.h: 32 * platform/cocoa/SystemBattery.mm: 33 (WebCore::systemHasBattery): 34 (WebCore::resetSystemHasAC): 35 (WebCore::setSystemHasAC): 36 (WebCore::systemHasAC): 37 (WebCore::setOverrideSystemHasBatteryForTesting): 38 (WebCore::setOverrideSystemHasACForTesting): 39 * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp: 40 (WebCore::videoCodecTypeFromRFC4281Type): 41 (WebCore::createMediaPlayerDecodingConfigurationCocoa): 42 * platform/graphics/cocoa/VP9UtilitiesCocoa.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/IOPSLibSPI.h. 43 * platform/graphics/cocoa/VP9UtilitiesCocoa.mm: Added. 44 (WebCore::setOverrideVP9HardwareDecoderDisabledForTesting): 45 (WebCore::setOverrideVP9ScreenSizeAndScaleForTesting): 46 (WebCore::resetOverrideVP9ScreenSizeAndScaleForTesting): 47 (WebCore::validateVPParameters): 48 * platform/ios/PlatformScreenIOS.mm: 49 (WebCore::collectScreenProperties): 50 * platform/mac/PlatformScreenMac.mm: 51 (WebCore::collectScreenProperties): 52 * testing/Internals.cpp: 53 (WebCore::Internals::Internals): 54 (WebCore::Internals::setSystemHasBattery): 55 (WebCore::Internals::setSystemHasAC): 56 (WebCore::Internals::setHardwareVP9DecoderDisabledForTesting): 57 (WebCore::Internals::setVP9ScreenSizeAndScale): 58 * testing/Internals.h: 59 * testing/Internals.idl: 60 1 61 2020-07-16 Brady Eidson <beidson@apple.com> 2 62 -
trunk/Source/WebCore/PAL/ChangeLog
r264474 r264476 1 2020-07-16 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Add MediaCapabilities support for SW VP9 decoder. 4 https://bugs.webkit.org/show_bug.cgi?id=214316 5 6 Reviewed by Eric Carlson. 7 8 * pal/spi/cocoa/IOPSLibSPI.h: 9 1 10 2020-07-16 Jonathan Bedard <jbedard@apple.com> 2 11 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/IOPSLibSPI.h
r220506 r264476 37 37 #define kIOPSTypeKey "Type" 38 38 #define kIOPSInternalBatteryType "InternalBattery" 39 #define kIOPSPowerSourceStateKey "Power Source State" 40 #define kIOPSACPowerValue "AC Power" 41 #define kIOPSNotifyPowerSource "com.apple.system.powersources.source" 39 42 40 43 #endif -
trunk/Source/WebCore/SourcesCocoa.txt
r264207 r264476 242 242 platform/cocoa/PlatformPasteboardCocoa.mm 243 243 platform/cocoa/PlaybackSessionModelMediaElement.mm 244 platform/cocoa/PowerSourceNotifier.mm 244 245 platform/cocoa/RuntimeApplicationChecksCocoa.mm 245 246 platform/cocoa/ScrollController.mm … … 350 351 platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp 351 352 platform/graphics/cocoa/TextTrackRepresentationCocoa.mm 353 platform/graphics/cocoa/VP9UtilitiesCocoa.mm 352 354 platform/graphics/cocoa/WebActionDisablingCALayerDelegate.mm 353 355 platform/graphics/cocoa/WebCoreCALayerExtras.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r264367 r264476 4201 4201 CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4202 4202 CDC734151977896D0046BFC5 /* CARingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC734131977896C0046BFC5 /* CARingBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4203 CDC7470424BE2FC700C1868B /* PowerSourceNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC7470024BE267900C1868B /* PowerSourceNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4203 4204 CDC8B5A2180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC8B5A0180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.mm */; }; 4204 4205 CDC8B5A3180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5A1180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.h */; }; … … 14108 14109 CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivate.h; sourceTree = "<group>"; }; 14109 14110 CD641EC7181ED60100EE4C41 /* MediaSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSample.h; sourceTree = "<group>"; }; 14111 CD6FE5B724BCE645009FCDA4 /* VP9UtilitiesCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VP9UtilitiesCocoa.h; sourceTree = "<group>"; }; 14112 CD6FE5B824BCE645009FCDA4 /* VP9UtilitiesCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = VP9UtilitiesCocoa.mm; sourceTree = "<group>"; }; 14110 14113 CD6FE5BA24BCE7B6009FCDA4 /* VP9Utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VP9Utilities.h; sourceTree = "<group>"; }; 14111 14114 CD6FE5BB24BCE7B6009FCDA4 /* VP9Utilities.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VP9Utilities.cpp; sourceTree = "<group>"; }; … … 14284 14287 CDC734121977896C0046BFC5 /* CARingBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CARingBuffer.cpp; sourceTree = "<group>"; }; 14285 14288 CDC734131977896C0046BFC5 /* CARingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CARingBuffer.h; sourceTree = "<group>"; }; 14289 CDC7470024BE267900C1868B /* PowerSourceNotifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PowerSourceNotifier.h; sourceTree = "<group>"; }; 14290 CDC7470124BE267900C1868B /* PowerSourceNotifier.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PowerSourceNotifier.mm; sourceTree = "<group>"; }; 14286 14291 CDC8B5A0180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPlayerPrivateMediaSourceAVFObjC.mm; sourceTree = "<group>"; }; 14287 14292 CDC8B5A1180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerPrivateMediaSourceAVFObjC.h; sourceTree = "<group>"; }; … … 23631 23636 CDA29A0D1CBD9CFE00901CCF /* PlaybackSessionModelMediaElement.h */, 23632 23637 CDA29A0C1CBD9CFE00901CCF /* PlaybackSessionModelMediaElement.mm */, 23638 CDC7470024BE267900C1868B /* PowerSourceNotifier.h */, 23639 CDC7470124BE267900C1868B /* PowerSourceNotifier.mm */, 23633 23640 465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */, 23634 23641 1AA84F03143BA7BD0051D153 /* ScrollController.h */, … … 25745 25752 BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */, 25746 25753 E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */, 25747 CD6FE5BA24BCE7B6009FCDA4 /* VP9Utilities.h */,25748 CD6FE5BB24BCE7B6009FCDA4 /* VP9Utilities.cpp */,25749 25754 0F5A57CA229B18AE0025EDA9 /* VelocityData.cpp */, 25750 25755 0F1A0C36229A481800D37ADB /* VelocityData.h */, 25751 25756 BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */, 25757 CD6FE5BB24BCE7B6009FCDA4 /* VP9Utilities.cpp */, 25758 CD6FE5BA24BCE7B6009FCDA4 /* VP9Utilities.h */, 25752 25759 1411DCB0164C39A800D49BC1 /* WidthCache.h */, 25753 25760 939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */, … … 25887 25894 526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */, 25888 25895 526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */, 25896 CD6FE5B724BCE645009FCDA4 /* VP9UtilitiesCocoa.h */, 25897 CD6FE5B824BCE645009FCDA4 /* VP9UtilitiesCocoa.mm */, 25889 25898 2D3EF4441917915C00034184 /* WebActionDisablingCALayerDelegate.h */, 25890 25899 2D3EF4451917915C00034184 /* WebActionDisablingCALayerDelegate.mm */, … … 32641 32650 BC5C762B1497FE1400BC4775 /* PlatformEvent.h in Headers */, 32642 32651 26601EBF14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h in Headers */, 32652 CDC7470424BE2FC700C1868B /* PowerSourceNotifier.h in Headers */, 32643 32653 BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */, 32644 32654 A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */, -
trunk/Source/WebCore/platform/PlatformScreen.cpp
r261546 r264476 39 39 } 40 40 41 const ScreenProperties& getScreenProperties() 42 { 43 return screenProperties(); 44 } 45 41 46 PlatformDisplayID primaryScreenDisplayID() 42 47 { -
trunk/Source/WebCore/platform/PlatformScreen.h
r261546 r264476 95 95 WEBCORE_EXPORT ScreenProperties collectScreenProperties(); 96 96 WEBCORE_EXPORT void setScreenProperties(const ScreenProperties&); 97 const ScreenProperties& getScreenProperties(); 97 98 const ScreenData* screenData(PlatformDisplayID screendisplayID); 98 99 WEBCORE_EXPORT PlatformDisplayID primaryScreenDisplayID(); -
trunk/Source/WebCore/platform/ScreenProperties.h
r263090 r264476 52 52 #endif 53 53 54 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY) 55 float scaleFactor { 1 }; 56 #endif 57 54 58 enum class ColorSpaceType : uint8_t { None, Name, Data }; 55 59 template<class Encoder> void encode(Encoder&) const; … … 97 101 #if PLATFORM(MAC) 98 102 encoder << screenIsMonochrome << displayMask << gpuID; 103 #endif 104 105 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY) 106 encoder << scaleFactor; 99 107 #endif 100 108 … … 174 182 decoder >> gpuID; 175 183 if (!gpuID) 184 return WTF::nullopt; 185 #endif 186 187 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY) 188 Optional<float> scaleFactor; 189 decoder >> scaleFactor; 190 if (!scaleFactor) 176 191 return WTF::nullopt; 177 192 #endif … … 220 235 WTFMove(*screenIsMonochrome), 221 236 WTFMove(*displayMask), 222 WTFMove(*gpuID) 237 WTFMove(*gpuID), 238 #endif 239 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY) 240 WTFMove(*scaleFactor), 223 241 #endif 224 242 } }; -
trunk/Source/WebCore/platform/cocoa/PowerSourceNotifier.h
r264475 r264476 26 26 #pragma once 27 27 28 #include <wtf/text/StringView.h> 29 #include <wtf/text/WTFString.h> 28 #include <wtf/Function.h> 30 29 31 30 namespace WebCore { 32 31 33 struct VPCodecConfigurationRecord { 34 String codecName; 35 uint8_t profile { 0 }; 36 uint8_t level { 0 }; 37 uint8_t bitDepth { 0 }; 38 uint8_t chromaSubsampling { 1 }; 39 uint8_t videoFullRangeFlag { 0 }; 40 uint8_t colorPrimaries { 1 }; 41 uint8_t transferCharacteristics { 1 }; 42 uint8_t matrixCoefficients { 1 }; 32 class PowerSourceNotifier { 33 WTF_MAKE_FAST_ALLOCATED; 34 public: 35 using PowerSourceNotifierCallback = WTF::Function<void(bool hasAC)>; 36 WEBCORE_EXPORT explicit PowerSourceNotifier(PowerSourceNotifierCallback&&); 37 WEBCORE_EXPORT ~PowerSourceNotifier(); 38 39 WEBCORE_EXPORT bool isLowPowerModeEnabled() const; 40 41 private: 42 void notifyPowerSourceChanged(); 43 44 Optional<int> m_tokenID; 45 PowerSourceNotifierCallback m_callback; 43 46 }; 44 47 45 WEBCORE_EXPORT Optional<VPCodecConfigurationRecord> parseVPCodecParameters(StringView codecString);46 47 48 } -
trunk/Source/WebCore/platform/cocoa/PowerSourceNotifier.mm
r264475 r264476 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "PowerSourceNotifier.h" 27 28 28 #include <wtf/text/StringView.h> 29 #include <wtf/text/WTFString.h> 29 #import "SystemBattery.h" 30 #import <notify.h> 31 #import <pal/spi/cocoa/IOPSLibSPI.h> 30 32 31 33 namespace WebCore { 32 34 33 struct VPCodecConfigurationRecord { 34 String codecName; 35 uint8_t profile { 0 }; 36 uint8_t level { 0 }; 37 uint8_t bitDepth { 0 }; 38 uint8_t chromaSubsampling { 1 }; 39 uint8_t videoFullRangeFlag { 0 }; 40 uint8_t colorPrimaries { 1 }; 41 uint8_t transferCharacteristics { 1 }; 42 uint8_t matrixCoefficients { 1 }; 43 }; 35 PowerSourceNotifier::PowerSourceNotifier(PowerSourceNotifierCallback&& callback) 36 : m_callback(WTFMove(callback)) 37 { 38 int token = 0; 39 auto status = notify_register_dispatch(kIOPSNotifyPowerSource, &token, dispatch_get_main_queue(), ^(int) { 40 notifyPowerSourceChanged(); 41 }); 42 if (status == NOTIFY_STATUS_OK) 43 m_tokenID = token; 44 } 44 45 45 WEBCORE_EXPORT Optional<VPCodecConfigurationRecord> parseVPCodecParameters(StringView codecString); 46 PowerSourceNotifier::~PowerSourceNotifier() 47 { 48 if (m_tokenID) 49 notify_cancel(*m_tokenID); 50 } 51 52 void PowerSourceNotifier::notifyPowerSourceChanged() 53 { 54 resetSystemHasAC(); 55 if (m_callback) 56 m_callback(systemHasAC()); 57 } 46 58 47 59 } -
trunk/Source/WebCore/platform/cocoa/SystemBattery.h
r254995 r264476 31 31 WEBCORE_EXPORT bool systemHasBattery(); 32 32 33 WEBCORE_EXPORT void resetSystemHasAC(); 34 WEBCORE_EXPORT void setSystemHasAC(bool); 35 WEBCORE_EXPORT bool systemHasAC(); 36 37 WEBCORE_EXPORT void setOverrideSystemHasBatteryForTesting(Optional<bool>&&); 38 WEBCORE_EXPORT void setOverrideSystemHasACForTesting(Optional<bool>&&); 39 33 40 } -
trunk/Source/WebCore/platform/cocoa/SystemBattery.mm
r260960 r264476 27 27 #import "SystemBattery.h" 28 28 29 #import <notify.h> 29 30 #import <pal/spi/cocoa/IOPSLibSPI.h> 30 31 … … 32 33 33 34 static Optional<bool> hasBattery; 35 static Optional<bool> hasAC; 36 static Optional<bool> hasBatteryOverrideForTesting; 37 static Optional<bool> hasACOverrideForTesting; 34 38 35 39 void setSystemHasBattery(bool battery) … … 40 44 bool systemHasBattery() 41 45 { 46 if (hasBatteryOverrideForTesting) 47 return *hasBatteryOverrideForTesting; 48 42 49 if (!hasBattery.hasValue()) { 43 50 hasBattery = [] { … … 68 75 } 69 76 77 void resetSystemHasAC() 78 { 79 hasAC.reset(); 70 80 } 81 82 void setSystemHasAC(bool ac) 83 { 84 hasAC = ac; 85 } 86 87 bool systemHasAC() 88 { 89 if (hasACOverrideForTesting) 90 return *hasACOverrideForTesting; 91 92 if (!hasAC.hasValue()) { 93 hasAC = [] { 94 #if PLATFORM(APPLETV) 95 return true; 96 #else 97 RetainPtr<CFTypeRef> powerSourcesInfo = adoptCF(IOPSCopyPowerSourcesInfo()); 98 if (!powerSourcesInfo) 99 return false; 100 RetainPtr<CFArrayRef> powerSourcesList = adoptCF(IOPSCopyPowerSourcesList(powerSourcesInfo.get())); 101 if (!powerSourcesList) 102 return false; 103 for (CFIndex i = 0, count = CFArrayGetCount(powerSourcesList.get()); i < count; ++i) { 104 CFDictionaryRef description = IOPSGetPowerSourceDescription(powerSourcesInfo.get(), CFArrayGetValueAtIndex(powerSourcesList.get(), i)); 105 if (!description) 106 continue; 107 CFTypeRef value = CFDictionaryGetValue(description, CFSTR(kIOPSPowerSourceStateKey)); 108 if (value && CFEqual(value, CFSTR(kIOPSACPowerValue))) 109 return true; 110 } 111 return false; 112 #endif 113 }(); 114 } 115 116 return *hasAC; 117 } 118 119 void setOverrideSystemHasBatteryForTesting(Optional<bool>&& hasBattery) 120 { 121 hasBatteryOverrideForTesting = WTFMove(hasBattery); 122 } 123 124 void setOverrideSystemHasACForTesting(Optional<bool>&& hasAC) 125 { 126 hasACOverrideForTesting = WTFMove(hasAC); 127 } 128 129 } -
trunk/Source/WebCore/platform/graphics/VP9Utilities.cpp
r264367 r264476 35 35 { 36 36 constexpr uint8_t validLevels[] = { 37 10,38 11,39 20,40 21,41 30,42 31,43 40,44 41,45 50,46 51,47 52,48 60,49 61,50 62,37 VPConfigurationLevel::Level_1, 38 VPConfigurationLevel::Level_1_1, 39 VPConfigurationLevel::Level_2, 40 VPConfigurationLevel::Level_2_1, 41 VPConfigurationLevel::Level_3, 42 VPConfigurationLevel::Level_3_1, 43 VPConfigurationLevel::Level_4, 44 VPConfigurationLevel::Level_4_1, 45 VPConfigurationLevel::Level_5, 46 VPConfigurationLevel::Level_5_1, 47 VPConfigurationLevel::Level_5_2, 48 VPConfigurationLevel::Level_6, 49 VPConfigurationLevel::Level_6_1, 50 VPConfigurationLevel::Level_6_2, 51 51 }; 52 52 … … 131 131 // Fourth element: chromaSubsampling. Legal values are 0-3. 132 132 auto chromaSubsampling = toIntegralType<uint8_t>(*nextElement); 133 if (!chromaSubsampling || *chromaSubsampling > 3)133 if (!chromaSubsampling || *chromaSubsampling > VPConfigurationChromaSubsampling::Subsampling_444) 134 134 return WTF::nullopt; 135 135 configuration.chromaSubsampling = *chromaSubsampling; -
trunk/Source/WebCore/platform/graphics/VP9Utilities.h
r264367 r264476 31 31 namespace WebCore { 32 32 33 namespace VPConfigurationLevel { 34 constexpr uint8_t Level_1 = 10; 35 constexpr uint8_t Level_1_1 = 11; 36 constexpr uint8_t Level_2 = 20; 37 constexpr uint8_t Level_2_1 = 21; 38 constexpr uint8_t Level_3 = 30; 39 constexpr uint8_t Level_3_1 = 31; 40 constexpr uint8_t Level_4 = 40; 41 constexpr uint8_t Level_4_1 = 41; 42 constexpr uint8_t Level_5 = 50; 43 constexpr uint8_t Level_5_1 = 51; 44 constexpr uint8_t Level_5_2 = 52; 45 constexpr uint8_t Level_6 = 60; 46 constexpr uint8_t Level_6_1 = 61; 47 constexpr uint8_t Level_6_2 = 62; 48 } 49 50 namespace VPConfigurationChromaSubsampling { 51 constexpr uint8_t Subsampling_420_Vertical = 0; 52 constexpr uint8_t Subsampling_420_Colocated = 1; 53 constexpr uint8_t Subsampling_422 = 2; 54 constexpr uint8_t Subsampling_444 = 3; 55 } 56 57 namespace VPConfigurationRange { 58 constexpr uint8_t VideoRange = 0; 59 constexpr uint8_t FullRange = 1; 60 } 61 33 62 struct VPCodecConfigurationRecord { 34 63 String codecName; 35 64 uint8_t profile { 0 }; 36 uint8_t level { 0};37 uint8_t bitDepth { 0};38 uint8_t chromaSubsampling { 1};39 uint8_t videoFullRangeFlag { 0};65 uint8_t level { VPConfigurationLevel::Level_1 }; 66 uint8_t bitDepth { 8 }; 67 uint8_t chromaSubsampling { VPConfigurationChromaSubsampling::Subsampling_420_Colocated }; 68 uint8_t videoFullRangeFlag { VPConfigurationRange::VideoRange }; 40 69 uint8_t colorPrimaries { 1 }; 41 70 uint8_t transferCharacteristics { 1 }; -
trunk/Source/WebCore/platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp
r253397 r264476 33 33 #include "MediaDecodingConfiguration.h" 34 34 #include "MediaPlayer.h" 35 #include "VP9UtilitiesCocoa.h" 35 36 36 37 #include "VideoToolboxSoftLink.h" 37 38 38 39 namespace WebCore { 40 41 // FIXME: Remove this once kCMVideoCodecType_VP9 is added to CMFormatDescription.h 42 constexpr CMVideoCodecType kCMVideoCodecType_VP9 { 'vp09' }; 39 43 40 44 static CMVideoCodecType videoCodecTypeFromRFC4281Type(String type) … … 46 50 if (type.startsWith("hvc1") || type.startsWith("hev1")) 47 51 return kCMVideoCodecType_HEVC; 52 if (type.startsWith("vp09")) 53 return kCMVideoCodecType_VP9; 48 54 return 0; 49 55 } … … 92 98 return; 93 99 } 100 } else if (videoCodecType == kCMVideoCodecType_VP9) { 101 auto codecConfiguration = parseVPCodecParameters(codec); 102 if (!codecConfiguration || !validateVPParameters(*codecConfiguration, info, videoConfiguration)) { 103 callback({{ }, WTFMove(configuration)}); 104 return; 105 } 94 106 } else { 95 107 if (alphaChannel || hdrSupported) { -
trunk/Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.h
r264475 r264476 26 26 #pragma once 27 27 28 #include <wtf/text/StringView.h> 29 #include <wtf/text/WTFString.h> 28 #if PLATFORM(COCOA) 29 30 #include "VP9Utilities.h" 30 31 31 32 namespace WebCore { 32 33 33 struct VPCodecConfigurationRecord { 34 String codecName; 35 uint8_t profile { 0 }; 36 uint8_t level { 0 }; 37 uint8_t bitDepth { 0 }; 38 uint8_t chromaSubsampling { 1 }; 39 uint8_t videoFullRangeFlag { 0 }; 40 uint8_t colorPrimaries { 1 }; 41 uint8_t transferCharacteristics { 1 }; 42 uint8_t matrixCoefficients { 1 }; 43 }; 34 struct MediaCapabilitiesInfo; 35 struct VideoConfiguration; 44 36 45 WEBCORE_EXPORT Optional<VPCodecConfigurationRecord> parseVPCodecParameters(StringView codecString); 37 WEBCORE_EXPORT extern void setOverrideVP9HardwareDecoderDisabledForTesting(bool); 38 WEBCORE_EXPORT extern void setOverrideVP9ScreenSizeAndScaleForTesting(float width, float height, float scale); 39 WEBCORE_EXPORT extern void resetOverrideVP9ScreenSizeAndScaleForTesting(); 40 41 extern bool validateVPParameters(VPCodecConfigurationRecord&, MediaCapabilitiesInfo&, const VideoConfiguration&); 46 42 47 43 } 44 45 #endif -
trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm
r263090 r264476 201 201 bool screenSupportsExtendedColor = WebCore::screenSupportsExtendedColor(nullptr); 202 202 bool screenHasInvertedColors = WebCore::screenHasInvertedColors(); 203 204 screenProperties.screenDataMap.set(++displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors }); 203 bool hdr = screenSupportsHighDynamicRange(nullptr); 204 float scaleFactor = WebCore::screenPPIFactor(); 205 206 screenProperties.screenDataMap.set(++displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, hdr, scaleFactor }); 205 207 206 208 if (screen == [PAL::getUIScreenClass() mainScreen]) -
trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm
r263090 r264476 118 118 IORegistryGPUID gpuID = 0; 119 119 bool screenSupportsHighDynamicRange = false; 120 float scaleFactor = screen.backingScaleFactor; 120 121 121 122 #if USE(MEDIATOOLBOX) … … 127 128 gpuID = gpuIDForDisplayMask(displayMask); 128 129 129 screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenSupportsHighDynamicRange, screenIsMonochrome, displayMask, gpuID });130 screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenSupportsHighDynamicRange, screenIsMonochrome, displayMask, gpuID, scaleFactor }); 130 131 131 132 if (!screenProperties.primaryDisplayID) -
trunk/Source/WebCore/testing/Internals.cpp
r264367 r264476 320 320 #endif 321 321 322 #if PLATFORM(MAC) && USE(LIBWEBRTC)323 #include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>324 #endif325 326 322 #if PLATFORM(MAC) 327 323 #include "GraphicsContextGLOpenGLManager.h" … … 332 328 #if PLATFORM(COCOA) 333 329 #include "SystemBattery.h" 330 #include "VP9UtilitiesCocoa.h" 334 331 #include <pal/spi/cocoa/CoreTextSPI.h> 335 332 #include <wtf/spi/darwin/SandboxSPI.h> 333 #endif 334 335 #if PLATFORM(MAC) && USE(LIBWEBRTC) 336 #include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h> 336 337 #endif 337 338 … … 630 631 #if PLATFORM(COCOA) && ENABLE(WEB_AUDIO) 631 632 AudioDestinationCocoa::createOverride = nullptr; 633 #endif 634 635 #if PLATFORM(COCOA) 636 setOverrideSystemHasBatteryForTesting(WTF::nullopt); 637 setOverrideSystemHasACForTesting(WTF::nullopt); 638 setOverrideVP9HardwareDecoderDisabledForTesting(false); 639 resetOverrideVP9ScreenSizeAndScaleForTesting(); 632 640 #endif 633 641 } … … 5819 5827 } 5820 5828 5829 void Internals::setSystemHasBatteryForTesting(bool hasBattery) 5830 { 5831 #if PLATFORM(COCOA) 5832 WebCore::setOverrideSystemHasBatteryForTesting(hasBattery); 5833 #else 5834 UNUSED_PARAM(hasBattery); 5835 #endif 5836 } 5837 5838 void Internals::setSystemHasACForTesting(bool hasAC) 5839 { 5840 #if PLATFORM(COCOA) 5841 WebCore::setOverrideSystemHasACForTesting(hasAC); 5842 #else 5843 UNUSED_PARAM(hasAC); 5844 #endif 5845 } 5846 5847 void Internals::setHardwareVP9DecoderDisabledForTesting(bool disabled) 5848 { 5849 #if PLATFORM(COCOA) 5850 WebCore::setOverrideVP9HardwareDecoderDisabledForTesting(disabled); 5851 #else 5852 UNUSED_PARAM(disabled); 5853 #endif 5854 } 5855 5856 void Internals::setVP9ScreenSizeAndScaleForTesting(double width, double height, double scale) 5857 { 5858 #if PLATFORM(COCOA) 5859 WebCore::setOverrideVP9ScreenSizeAndScaleForTesting(width, height, scale); 5860 #else 5861 UNUSED_PARAM(width); 5862 UNUSED_PARAM(height); 5863 UNUSED_PARAM(scale); 5864 #endif 5865 } 5866 5821 5867 int Internals::readPreferenceInteger(const String& domain, const String& key) 5822 5868 { -
trunk/Source/WebCore/testing/Internals.h
r264367 r264476 1019 1019 bool systemHasBattery() const; 1020 1020 1021 void setSystemHasBatteryForTesting(bool); 1022 void setSystemHasACForTesting(bool); 1023 1024 void setHardwareVP9DecoderDisabledForTesting(bool); 1025 void setVP9ScreenSizeAndScaleForTesting(double, double, double); 1026 1021 1027 int readPreferenceInteger(const String& domain, const String& key); 1022 1028 String encodedPreferenceValue(const String& domain, const String& key); -
trunk/Source/WebCore/testing/Internals.idl
r264367 r264476 933 933 boolean systemHasBattery(); 934 934 935 void setSystemHasBatteryForTesting(boolean hasBattery); 936 void setSystemHasACForTesting(boolean hasAC); 937 938 void setHardwareVP9DecoderDisabledForTesting(boolean disabled); 939 void setVP9ScreenSizeAndScaleForTesting(double width, double height, double scale); 940 935 941 long readPreferenceInteger(DOMString domain, DOMString key); 936 942 DOMString encodedPreferenceValue(DOMString domain, DOMString key); -
trunk/Source/WebKit/ChangeLog
r264457 r264476 1 2020-07-16 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Add MediaCapabilities support for SW VP9 decoder. 4 https://bugs.webkit.org/show_bug.cgi?id=214316 5 6 Reviewed by Eric Carlson. 7 8 Pass the system AC state to the WebContent process at creation time, and also create 9 a power state listener so the WebProcess can be updated dynamically. 10 11 * Shared/WebProcessCreationParameters.cpp: 12 (WebKit::WebProcessCreationParameters::encode const): 13 (WebKit::WebProcessCreationParameters::decode): 14 * Shared/WebProcessCreationParameters.h: 15 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 16 (WebKit::WebProcessPool::platformInitializeWebProcess): 17 (WebKit::WebProcessPool::registerNotificationObservers): 18 * UIProcess/WebProcessPool.cpp: 19 * UIProcess/WebProcessPool.h: 20 * WebProcess/WebProcess.h: 21 * WebProcess/WebProcess.messages.in: 22 * WebProcess/cocoa/WebProcessCocoa.mm: 23 (WebKit::WebProcess::platformInitializeWebProcess): 24 (WebKit::WebProcess::powerSourceDidChange): 25 1 26 2020-07-16 Per Arne Vollan <pvollan@apple.com> 2 27 -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp
r263320 r264476 171 171 encoder << mapDBExtensionHandle; 172 172 encoder << systemHasBattery; 173 encoder << systemHasAC; 173 174 #endif 174 175 … … 460 461 return false; 461 462 parameters.systemHasBattery = WTFMove(*systemHasBattery); 463 464 Optional<bool> systemHasAC; 465 decoder >> systemHasAC; 466 if (!systemHasAC) 467 return false; 468 parameters.systemHasAC = WTFMove(*systemHasAC); 462 469 #endif 463 470 -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.h
r263320 r264476 215 215 Optional<SandboxExtension::Handle> mapDBExtensionHandle; 216 216 bool systemHasBattery { false }; 217 bool systemHasAC { false }; 217 218 #endif 218 219 -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r264178 r264476 56 56 #import <WebCore/PictureInPictureSupport.h> 57 57 #import <WebCore/PlatformPasteboard.h> 58 #import <WebCore/PowerSourceNotifier.h> 58 59 #import <WebCore/RuntimeApplicationChecks.h> 59 60 #import <WebCore/SharedBuffer.h> … … 408 409 #if PLATFORM(COCOA) 409 410 parameters.systemHasBattery = systemHasBattery(); 411 parameters.systemHasAC = systemHasAC(); 410 412 411 413 SandboxExtension::Handle mapDBHandle; … … 698 700 #endif 699 701 #endif 702 703 m_powerSourceNotifier = WTF::makeUnique<WebCore::PowerSourceNotifier>([this] (bool hasAC) { 704 sendToAllProcesses(Messages::WebProcess::PowerSourceDidChange(hasAC)); 705 }); 700 706 } 701 707 … … 727 733 728 734 [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()]; 735 736 m_powerSourceNotifier = nullptr; 729 737 } 730 738 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r264004 r264476 128 128 #if PLATFORM(COCOA) 129 129 #include "VersionChecks.h" 130 #include <WebCore/PowerSourceNotifier.h> 130 131 #endif 131 132 -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r264178 r264476 95 95 enum class EventMakesGamepadsVisible : bool; 96 96 struct MockMediaDevice; 97 #if PLATFORM(COCOA) 98 class PowerSourceNotifier; 99 #endif 97 100 } 98 101 … … 711 714 712 715 #if PLATFORM(COCOA) 716 std::unique_ptr<WebCore::PowerSourceNotifier> m_powerSourceNotifier; 713 717 RetainPtr<NSObject> m_activationObserver; 714 718 RetainPtr<NSObject> m_accessibilityEnabledObserver; -
trunk/Source/WebKit/WebProcess/WebProcess.h
r264178 r264476 308 308 void unblockPreferenceService(SandboxExtension::HandleArray&&); 309 309 #endif 310 void powerSourceDidChange(bool); 310 311 #endif 311 312 -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r264004 r264476 173 173 UnblockPreferenceService(WebKit::SandboxExtension::HandleArray handleArray) 174 174 #endif 175 PowerSourceDidChange(bool hasAC) 175 176 #endif 176 177 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r264199 r264476 313 313 314 314 setSystemHasBattery(parameters.systemHasBattery); 315 setSystemHasAC(parameters.systemHasAC); 315 316 316 317 #if PLATFORM(IOS_FAMILY) … … 1023 1024 } 1024 1025 1026 void WebProcess::powerSourceDidChange(bool hasAC) 1027 { 1028 setSystemHasAC(hasAC); 1029 } 1030 1025 1031 1026 1032 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.