Title: [282752] trunk/Source
Revision
282752
Author
jer.no...@apple.com
Date
2021-09-20 09:52:42 -0700 (Mon, 20 Sep 2021)

Log Message

[Cocoa] Make AVSampleBufferVideoOutput support an Experimental Feature
https://bugs.webkit.org/show_bug.cgi?id=230424

Reviewed by Eric Carlson.

Source/WebCore:

Move AVSampleBufferVideoOutput from a compile-time to a runtime enabled
feature for A/B testing purposes.

* page/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::setMediaSourceInlinePaintingEnabled):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::mediaSourceInlinePaintingEnabled const):
* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::setMediaSourceInlinePaintingEnabled):
(WebCore::MediaSessionManagerCocoa::mediaSourceInlinePaintingEnabled):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):

Source/WebCore/PAL:

Drive-by fix: fix up the declarations in AVFoundationSPI.h.

* pal/spi/cocoa/AVFoundationSPI.h:

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (282751 => 282752)


--- trunk/Source/WTF/ChangeLog	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WTF/ChangeLog	2021-09-20 16:52:42 UTC (rev 282752)
@@ -1,3 +1,13 @@
+2021-09-20  Jer Noble  <jer.no...@apple.com>
+
+        [Cocoa] Make AVSampleBufferVideoOutput support an Experimental Feature
+        https://bugs.webkit.org/show_bug.cgi?id=230424
+
+        Reviewed by Eric Carlson.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+        * wtf/PlatformHave.h:
+
 2021-09-18  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [iOS Family] Delete letterpress support

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (282751 => 282752)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-09-20 16:52:42 UTC (rev 282752)
@@ -801,6 +801,19 @@
     WebCore:
       default: false
 
+MediaSourceInlinePaintingEnabled:
+  type: bool
+  humanReadableName: "Experimental MediaSource Inline Painting"
+  humanReadableDescription: "Experimental MediaSource Inline Painting"
+  condition: ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+  defaultValue:
+    WebKitLegacy:
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 ModelElementEnabled:
   type: bool
   humanReadableName: "HTML <model> element"

Modified: trunk/Source/WTF/wtf/PlatformHave.h (282751 => 282752)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-09-20 16:52:42 UTC (rev 282752)
@@ -1124,3 +1124,7 @@
 #define HAVE_CG_COLOR_SPACE_USES_EXTENDED_RANGE 1
 #endif
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
+#define HAVE_AVSAMPLEBUFFERVIDEOOUTPUT 1
+#endif

Modified: trunk/Source/WebCore/ChangeLog (282751 => 282752)


--- trunk/Source/WebCore/ChangeLog	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/ChangeLog	2021-09-20 16:52:42 UTC (rev 282752)
@@ -1,3 +1,25 @@
+2021-09-20  Jer Noble  <jer.no...@apple.com>
+
+        [Cocoa] Make AVSampleBufferVideoOutput support an Experimental Feature
+        https://bugs.webkit.org/show_bug.cgi?id=230424
+
+        Reviewed by Eric Carlson.
+
+        Move AVSampleBufferVideoOutput from a compile-time to a runtime enabled
+        feature for A/B testing purposes.
+
+        * page/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::setMediaSourceInlinePaintingEnabled):
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::mediaSourceInlinePaintingEnabled const):
+        * platform/audio/cocoa/MediaSessionManagerCocoa.h:
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (WebCore::MediaSessionManagerCocoa::setMediaSourceInlinePaintingEnabled):
+        (WebCore::MediaSessionManagerCocoa::mediaSourceInlinePaintingEnabled):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
+
 2021-09-20  Antoine Quint  <grao...@webkit.org>
 
         TimingFunction::transformTime() is poorly-named

Modified: trunk/Source/WebCore/PAL/ChangeLog (282751 => 282752)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-09-20 16:52:42 UTC (rev 282752)
@@ -1,3 +1,14 @@
+2021-09-20  Jer Noble  <jer.no...@apple.com>
+
+        [Cocoa] Make AVSampleBufferVideoOutput support an Experimental Feature
+        https://bugs.webkit.org/show_bug.cgi?id=230424
+
+        Reviewed by Eric Carlson.
+
+        Drive-by fix: fix up the declarations in AVFoundationSPI.h.
+
+        * pal/spi/cocoa/AVFoundationSPI.h:
+
 2021-09-17  Per Arne Vollan  <pvol...@apple.com>
 
         [Mac Catalyst] Fix build issue

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h (282751 => 282752)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h	2021-09-20 16:52:42 UTC (rev 282752)
@@ -432,11 +432,5 @@
 @property (nonatomic, nullable) AVSampleBufferVideoOutput *output;
 @end
 
-#if HAVE(AVFOUNDATION_INTERSTITIAL_EVENTS)
-@interface AVPlayerItem (AVPlayerInterstitialSupport)
-@property (nonatomic) BOOL automaticallyHandlesInterstitialEvents;
-@end
-#endif
-
 #endif // USE(APPLE_INTERNAL_SDK)
 #endif // HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp (282751 => 282752)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2021-09-20 16:52:42 UTC (rev 282752)
@@ -38,6 +38,10 @@
 #include <_javascript_Core/Options.h>
 #include <wtf/NeverDestroyed.h>
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+#include "MediaSessionManagerCocoa.h"
+#endif
+
 namespace WebCore {
 
 RuntimeEnabledFeatures::RuntimeEnabledFeatures()
@@ -77,4 +81,12 @@
 }
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+void RuntimeEnabledFeatures::setMediaSourceInlinePaintingEnabled(bool isEnabled)
+{
+    m_mediaSourceInlinePaintingEnabled = isEnabled;
+    MediaSessionManagerCocoa::setMediaSourceInlinePaintingEnabled(isEnabled);
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (282751 => 282752)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2021-09-20 16:52:42 UTC (rev 282752)
@@ -255,6 +255,11 @@
     bool webAuthenticationModernEnabled() const { return m_areWebAuthenticationModernEnabled; }
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    void setMediaSourceInlinePaintingEnabled(bool);
+    bool mediaSourceInlinePaintingEnabled() const { return m_mediaSourceInlinePaintingEnabled; }
+#endif
+
 private:
     // Never instantiate.
     RuntimeEnabledFeatures();
@@ -390,6 +395,10 @@
     bool m_areWebAuthenticationModernEnabled { false };
 #endif
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    bool m_mediaSourceInlinePaintingEnabled { false };
+#endif
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (282751 => 282752)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2021-09-20 16:52:42 UTC (rev 282752)
@@ -64,6 +64,11 @@
 
     static void ensureCodecsRegistered();
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+    static WEBCORE_EXPORT void setMediaSourceInlinePaintingEnabled(bool);
+    static WEBCORE_EXPORT bool mediaSourceInlinePaintingEnabled();
+#endif
+
 protected:
     void scheduleSessionStatusUpdate() final;
     void updateNowPlayingInfo();

Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (282751 => 282752)


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-09-20 16:52:42 UTC (rev 282752)
@@ -78,6 +78,19 @@
 #endif
 }
 
+#if ENABLE(MEDIA_SOURCE) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
+static bool s_mediaSourceInlinePaintingEnabled = false;
+void MediaSessionManagerCocoa::setMediaSourceInlinePaintingEnabled(bool enabled)
+{
+    s_mediaSourceInlinePaintingEnabled = enabled;
+}
+
+bool MediaSessionManagerCocoa::mediaSourceInlinePaintingEnabled()
+{
+    return s_mediaSourceInlinePaintingEnabled;
+}
+#endif
+
 void MediaSessionManagerCocoa::updateSessionState()
 {
     int videoCount = 0;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (282751 => 282752)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2021-09-20 16:26:27 UTC (rev 282751)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2021-09-20 16:52:42 UTC (rev 282752)
@@ -658,7 +658,7 @@
 #if HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
     if (m_videoOutput) {
         CMTime outputTime;
-        if (auto pixelBuffer = adoptCF([m_videoOutput copyPixelBufferForSourceTime:toCMTime(currentMediaTime()) sourceTimeForDisplay:&outputTime])) {
+        if (auto pixelBuffer = adoptCF([m_videoOutput copyPixelBufferForSourceTime:PAL::toCMTime(currentMediaTime()) sourceTimeForDisplay:&outputTime])) {
             INFO_LOG(LOGIDENTIFIER, "new pixelbuffer found for time ", PAL::toMediaTime(outputTime));
             m_lastPixelBuffer = WTFMove(pixelBuffer);
             return true;
@@ -917,7 +917,7 @@
 bool MediaPlayerPrivateMediaSourceAVFObjC::isVideoOutputAvailable() const
 {
 #if HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)
-    return PAL::getAVSampleBufferVideoOutputClass;
+    return MediaSessionManagerCocoa::mediaSourceInlinePaintingEnabled() && PAL::getAVSampleBufferVideoOutputClass();
 #else
     return false;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to