Diff
Modified: trunk/Source/WTF/ChangeLog (290620 => 290621)
--- trunk/Source/WTF/ChangeLog 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WTF/ChangeLog 2022-03-01 00:59:21 UTC (rev 290621)
@@ -1,3 +1,13 @@
+2022-02-28 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -streamDataParser:didProvideContentKeySpecifier:forTrackID: delegate callback
+ https://bugs.webkit.org/show_bug.cgi?id=236109
+ <rdar://problem/88785844>
+
+ Reviewed by Eric Carlson.
+
+ * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
2022-02-28 Tim Nguyen <[email protected]>
Enable inert attribute feature flag
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (290620 => 290621)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2022-03-01 00:59:21 UTC (rev 290621)
@@ -1233,6 +1233,19 @@
WebCore:
default: true
+SampleBufferContentKeySessionSupportEnabled:
+ type: bool
+ humanReadableName: "ContentKeySession support for SampleBuffer Renderers"
+ humanReadableDescription: "ContentKeySession support for SampleBuffer Renderers Enabled"
+ condition: HAVE(AVCONTENTKEYSPECIFIER)
+ defaultValue:
+ WebKitLegacy:
+ default: false
+ WebKit:
+ default: false
+ WebCore:
+ default: false
+
# FIXME: Is this implemented for WebKitLegacy? If not, this should be excluded from WebKitLegacy entirely.
# FIXME: This should have it's own ENABLE.
ScreenCaptureEnabled:
Modified: trunk/Source/WebCore/ChangeLog (290620 => 290621)
--- trunk/Source/WebCore/ChangeLog 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/ChangeLog 2022-03-01 00:59:21 UTC (rev 290621)
@@ -1,3 +1,38 @@
+2022-02-28 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -streamDataParser:didProvideContentKeySpecifier:forTrackID: delegate callback
+ https://bugs.webkit.org/show_bug.cgi?id=236109
+ <rdar://problem/88785844>
+
+ Reviewed by Eric Carlson.
+
+ Re-land support after a rollout in r290311, this time with an off-by-default Experimental Feature
+ flag.
+
+ In addition to checking whether the renderer classes support AVContentKeySession, also check whether
+ the RuntimeSetting has been enabled. This requires passing that setting through to the
+ MediaSessionManagerCocoa singleton, so it can be accessed from platform/.
+
+ If the renderer support check succeeds and the setting is enabled, only then should the delegate for
+ AVStreamDataParser include support for the new -didProvideContentKeySpecifier callback. Subclass the
+ WebAVStreamDataParserListener into a new WebAVStreamDataParserWithKeySpecifierListener object, and
+ instantiate one or the other according to the support checks above.
+
+ * page/RuntimeEnabledFeatures.cpp:
+ (WebCore::RuntimeEnabledFeatures::setSampleBufferContentKeySessionSupportEnabled):
+ * page/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::sampleBufferContentKeySessionSupportEnabled const):
+ * platform/audio/cocoa/MediaSessionManagerCocoa.h:
+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+ (WebCore::MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled):
+ (WebCore::MediaSessionManagerCocoa::sampleBufferContentKeySessionSupportEnabled):
+ * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm:
+ (-[WebAVStreamDataParserWithKeySpecifierListener streamDataParser:didProvideContentKeySpecifier:forTrackID:]):
+ (WebCore::SourceBufferParserAVFObjC::SourceBufferParserAVFObjC):
+ (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeySpecifier:forTrackID:]): Deleted.
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+ (WebCore::sampleBufferRenderersSupportKeySession):
+
2022-02-28 Per Arne Vollan <[email protected]>
[iOS] Weak link AVPictureInPictureController
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp (290620 => 290621)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp 2022-03-01 00:59:21 UTC (rev 290621)
@@ -38,7 +38,7 @@
#include <_javascript_Core/Options.h>
#include <wtf/NeverDestroyed.h>
-#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+#if PLATFORM(COCOA)
#include "MediaSessionManagerCocoa.h"
#endif
@@ -91,4 +91,12 @@
}
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+void RuntimeEnabledFeatures::setSampleBufferContentKeySessionSupportEnabled(bool enabled)
+{
+ m_sampleBufferContentKeySessionSupportEnabled = enabled;
+ MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled(enabled);
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (290620 => 290621)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2022-03-01 00:59:21 UTC (rev 290621)
@@ -244,6 +244,11 @@
bool mediaSourceInlinePaintingEnabled() const { return m_mediaSourceInlinePaintingEnabled; }
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ WEBCORE_EXPORT void setSampleBufferContentKeySessionSupportEnabled(bool);
+ bool sampleBufferContentKeySessionSupportEnabled() const { return m_sampleBufferContentKeySessionSupportEnabled; }
+#endif
+
#if ENABLE(BUILT_IN_NOTIFICATIONS)
void setBuiltInNotificationsEnabled(bool isEnabled) { m_builtInNotificationsEnabled = isEnabled; }
bool builtInNotificationsEnabled() const { return m_builtInNotificationsEnabled; }
@@ -391,6 +396,10 @@
bool m_mediaSourceInlinePaintingEnabled { false };
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ bool m_sampleBufferContentKeySessionSupportEnabled { false };
+#endif
+
#if ENABLE(BUILT_IN_NOTIFICATIONS)
bool m_builtInNotificationsEnabled { false };
#endif
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (290620 => 290621)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2022-03-01 00:59:21 UTC (rev 290621)
@@ -71,6 +71,11 @@
static WEBCORE_EXPORT bool mediaSourceInlinePaintingEnabled();
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ static WEBCORE_EXPORT void setSampleBufferContentKeySessionSupportEnabled(bool);
+ static WEBCORE_EXPORT bool sampleBufferContentKeySessionSupportEnabled();
+#endif
+
protected:
void scheduleSessionStatusUpdate() final;
void updateNowPlayingInfo();
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (290620 => 290621)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2022-03-01 00:59:21 UTC (rev 290621)
@@ -92,6 +92,20 @@
}
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+static bool s_sampleBufferContentKeySessionSupportEnabled = false;
+void MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled(bool enabled)
+{
+ s_sampleBufferContentKeySessionSupportEnabled = enabled;
+}
+
+bool MediaSessionManagerCocoa::sampleBufferContentKeySessionSupportEnabled()
+{
+ return s_sampleBufferContentKeySessionSupportEnabled;
+}
+#endif
+
+
void MediaSessionManagerCocoa::updateSessionState()
{
constexpr auto delayBeforeSettingCategoryNone = 2_s;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm (290620 => 290621)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm 2022-03-01 00:59:21 UTC (rev 290621)
@@ -140,7 +140,13 @@
_parent->didProvideContentKeyRequestInitializationDataForTrackID(initData, trackID);
}
+@end
+
#if HAVE(AVCONTENTKEYSPECIFIER)
+@interface WebAVStreamDataParserWithKeySpecifierListener : WebAVStreamDataParserListener
+@end
+
+@implementation WebAVStreamDataParserWithKeySpecifierListener
- (void)streamDataParser:(AVStreamDataParser *)streamDataParser didProvideContentKeySpecifier:(AVContentKeySpecifier *)keySpecifier forTrackID:(CMPersistentTrackID)trackID
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
@@ -147,10 +153,9 @@
if ([keySpecifier respondsToSelector:@selector(initializationData)])
_parent->didProvideContentKeyRequestSpecifierForTrackID(keySpecifier.initializationData, trackID);
}
+@end
#endif
-@end
-
namespace WebCore {
#pragma mark -
@@ -216,8 +221,13 @@
SourceBufferParserAVFObjC::SourceBufferParserAVFObjC()
: m_parser(adoptNS([PAL::allocAVStreamDataParserInstance() init]))
- , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:this]))
{
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ if (MediaSessionManagerCocoa::sampleBufferContentKeySessionSupportEnabled())
+ m_delegate = adoptNS([[WebAVStreamDataParserWithKeySpecifierListener alloc] initWithParser:m_parser.get() parent:this]);
+ else
+#endif
+ m_delegate = adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:this]);
}
SourceBufferParserAVFObjC::~SourceBufferParserAVFObjC()
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (290620 => 290621)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2022-03-01 00:59:21 UTC (rev 290621)
@@ -41,6 +41,7 @@
#import "MediaPlayerPrivateMediaSourceAVFObjC.h"
#import "MediaSample.h"
#import "MediaSampleAVFObjC.h"
+#import "MediaSessionManagerCocoa.h"
#import "MediaSourcePrivateAVFObjC.h"
#import "SharedBuffer.h"
#import "SourceBufferParserAVFObjC.h"
@@ -284,6 +285,15 @@
static bool sampleBufferRenderersSupportKeySession()
{
static bool supports = false;
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ supports =
+ [PAL::getAVSampleBufferAudioRendererClass() conformsToProtocol:@protocol(AVContentKeyRecipient)]
+ && [PAL::getAVSampleBufferDisplayLayerClass() conformsToProtocol:@protocol(AVContentKeyRecipient)]
+ && MediaSessionManagerCocoa::sampleBufferContentKeySessionSupportEnabled();
+ });
+#endif
return supports;
}
Modified: trunk/Source/WebKit/ChangeLog (290620 => 290621)
--- trunk/Source/WebKit/ChangeLog 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/ChangeLog 2022-03-01 00:59:21 UTC (rev 290621)
@@ -1,3 +1,25 @@
+2022-02-28 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -streamDataParser:didProvideContentKeySpecifier:forTrackID: delegate callback
+ https://bugs.webkit.org/show_bug.cgi?id=236109
+ <rdar://problem/88785844>
+
+ Reviewed by Eric Carlson.
+
+ Pass the new RuntimeEnabledFeature through to the GPU process.
+
+ * GPUProcess/GPUProcess.cpp:
+ (WebKit::GPUProcess::setSampleBufferContentKeySessionSupportEnabled):
+ * GPUProcess/GPUProcess.h:
+ * GPUProcess/GPUProcess.messages.in:
+ * GPUProcess/GPUProcessCreationParameters.cpp:
+ (WebKit::GPUProcessCreationParameters::encode const):
+ (WebKit::GPUProcessCreationParameters::decode):
+ * GPUProcess/GPUProcessCreationParameters.h:
+ * UIProcess/GPU/GPUProcessProxy.cpp:
+ (WebKit::GPUProcessProxy::updatePreferences):
+ * UIProcess/GPU/GPUProcessProxy.h:
+
2022-02-28 Chris Dumez <[email protected]>
Adopt the modern Hasher more widely
Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (290620 => 290621)
--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp 2022-03-01 00:59:21 UTC (rev 290621)
@@ -531,6 +531,16 @@
}
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+void GPUProcess::setSampleBufferContentKeySessionSupportEnabled(bool enabled)
+{
+ if (m_sampleBufferContentKeySessionSupportEnabled == enabled)
+ return;
+ m_sampleBufferContentKeySessionSupportEnabled = enabled;
+ MediaSessionManagerCocoa::setSampleBufferContentKeySessionSupportEnabled(enabled);
+}
+#endif
+
void GPUProcess::webProcessConnectionCountForTesting(CompletionHandler<void(uint64_t)>&& completionHandler)
{
completionHandler(GPUConnectionToWebProcess::objectCountForTesting());
Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (290620 => 290621)
--- trunk/Source/WebKit/GPUProcess/GPUProcess.h 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h 2022-03-01 00:59:21 UTC (rev 290621)
@@ -192,6 +192,10 @@
void setUseScreenCaptureKit(bool);
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ void setSampleBufferContentKeySessionSupportEnabled(bool);
+#endif
+
#if ENABLE(CFPREFS_DIRECT_MODE)
void notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue);
void dispatchSimulatedNotificationsForPreferenceChange(const String& key) final;
@@ -257,6 +261,10 @@
#if HAVE(SCREEN_CAPTURE_KIT)
bool m_useScreenCaptureKit { false };
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ bool m_sampleBufferContentKeySessionSupportEnabled { false };
+#endif
+
};
} // namespace WebKit
Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in (290620 => 290621)
--- trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in 2022-03-01 00:59:21 UTC (rev 290621)
@@ -81,6 +81,10 @@
SetUseScreenCaptureKit(bool use);
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ SetSampleBufferContentKeySessionSupportEnabled(bool enabled);
+#endif
+
RequestBitmapImageForCurrentTime(WebCore::ProcessIdentifier processIdentifier, WebCore::MediaPlayerIdentifier playerIdentifier) -> (WebKit::ShareableBitmap::Handle handle) Async
#if ENABLE(CFPREFS_DIRECT_MODE)
Modified: trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp (290620 => 290621)
--- trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.cpp 2022-03-01 00:59:21 UTC (rev 290621)
@@ -48,6 +48,9 @@
encoder << microphoneSandboxExtensionHandle;
#endif
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ encoder << sampleBufferContentKeySessionSupportEnabled;
+#endif
encoder << parentPID;
#if USE(SANDBOX_EXTENSIONS_FOR_CACHE_AND_TEMP_DIRECTORY_ACCESS)
@@ -75,6 +78,11 @@
return false;
#endif
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ if (!decoder.decode(result.sampleBufferContentKeySessionSupportEnabled))
+ return false;
+#endif
+
if (!decoder.decode(result.parentPID))
return false;
Modified: trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.h (290620 => 290621)
--- trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.h 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/GPUProcess/GPUProcessCreationParameters.h 2022-03-01 00:59:21 UTC (rev 290621)
@@ -48,6 +48,9 @@
SandboxExtension::Handle microphoneSandboxExtensionHandle;
#endif
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ bool sampleBufferContentKeySessionSupportEnabled { false };
+#endif
ProcessID parentPID;
#if USE(SANDBOX_EXTENSIONS_FOR_CACHE_AND_TEMP_DIRECTORY_ACCESS)
Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (290620 => 290621)
--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp 2022-03-01 00:59:21 UTC (rev 290621)
@@ -679,6 +679,12 @@
}
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ if (!m_hasEnabledSampleBufferContentKeySessionSupport && preferences.sampleBufferContentKeySessionSupportEnabled()) {
+ m_hasEnabledSampleBufferContentKeySessionSupport = true;
+ send(Messages::GPUProcess::SetSampleBufferContentKeySessionSupportEnabled(m_hasEnabledSampleBufferContentKeySessionSupport), 0);
+ }
+#endif
}
}
Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (290620 => 290621)
--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-01 00:14:24 UTC (rev 290620)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2022-03-01 00:59:21 UTC (rev 290621)
@@ -183,6 +183,10 @@
bool m_hasEnabledMediaSourceInlinePainting { false };
#endif
+#if HAVE(AVCONTENTKEYSPECIFIER)
+ bool m_hasEnabledSampleBufferContentKeySessionSupport { false };
+#endif
+
#if HAVE(SCREEN_CAPTURE_KIT)
bool m_hasEnabledScreenCaptureKit { false };
#endif