Title: [277776] trunk/Source/WebCore
Revision
277776
Author
[email protected]
Date
2021-05-19 23:46:43 -0700 (Wed, 19 May 2021)

Log Message

VP9 powerEfficient detection is broken in STP124
https://bugs.webkit.org/show_bug.cgi?id=225910
rdar://78144486

Reviewed by Darin Adler.

Change r273564 made an assumption that the first point of entry in the
media stack is when a PlatformMediaSessionManager is created and move
the initialization of some video codecs there.
However, this isn't always the case. Media Capabilities JS API can cause
queries to be made to the media engine without creating a media element.
We are unfortunately unable to properly write a test that would prevent
this regression to happen again as this is hardware dependent.

* platform/audio/cocoa/MediaSessionManagerCocoa.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
(WebCore::MediaSessionManagerCocoa::EnsureCodecsRegistered): Add method, use C++17 static
initializer which avoids any ambiguity in regards to thread-safety.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277775 => 277776)


--- trunk/Source/WebCore/ChangeLog	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/ChangeLog	2021-05-20 06:46:43 UTC (rev 277776)
@@ -1,3 +1,28 @@
+2021-05-19  Jean-Yves Avenard  <[email protected]>
+
+        VP9 powerEfficient detection is broken in STP124
+        https://bugs.webkit.org/show_bug.cgi?id=225910
+        rdar://78144486
+
+        Reviewed by Darin Adler.
+
+        Change r273564 made an assumption that the first point of entry in the
+        media stack is when a PlatformMediaSessionManager is created and move
+        the initialization of some video codecs there.
+        However, this isn't always the case. Media Capabilities JS API can cause
+        queries to be made to the media engine without creating a media element.
+        We are unfortunately unable to properly write a test that would prevent
+        this regression to happen again as this is hardware dependent.
+
+        * platform/audio/cocoa/MediaSessionManagerCocoa.h:
+        * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+        (WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
+        (WebCore::MediaSessionManagerCocoa::EnsureCodecsRegistered): Add method, use C++17 static
+        initializer which avoids any ambiguity in regards to thread-safety.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+
 2021-05-19  Tomoki Imai  <[email protected]>
 
         Scrolling must be done after the layout when doing full page zoom

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


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h	2021-05-20 06:46:43 UTC (rev 277776)
@@ -63,6 +63,8 @@
 
     static WEBCORE_EXPORT void updateMediaUsage(PlatformMediaSession&);
 
+    static void ensureCodecsRegistered();
+
 protected:
     void scheduleSessionStatusUpdate() final;
     void updateNowPlayingInfo();

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


--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm	2021-05-20 06:46:43 UTC (rev 277776)
@@ -59,14 +59,23 @@
 MediaSessionManagerCocoa::MediaSessionManagerCocoa()
     : m_nowPlayingManager(platformStrategies()->mediaStrategy().createNowPlayingManager())
 {
+    ensureCodecsRegistered();
+}
+
+void MediaSessionManagerCocoa::ensureCodecsRegistered()
+{
+    static bool sInitDone = []() {
 #if ENABLE(VP9)
-    if (shouldEnableVP9Decoder())
-        registerSupplementalVP9Decoder();
-    if (shouldEnableVP8Decoder())
-        registerWebKitVP8Decoder();
-    if (shouldEnableVP9SWDecoder())
-        registerWebKitVP9Decoder();
+        if (shouldEnableVP9Decoder())
+            registerSupplementalVP9Decoder();
+        if (shouldEnableVP8Decoder())
+            registerWebKitVP8Decoder();
+        if (shouldEnableVP9SWDecoder())
+            registerWebKitVP9Decoder();
 #endif
+        return true;
+    }();
+    UNUSED_VARIABLE(sInitDone);
 }
 
 void MediaSessionManagerCocoa::updateSessionState()

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (277775 => 277776)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-05-20 06:46:43 UTC (rev 277776)
@@ -49,6 +49,7 @@
 #import "MediaPlaybackTargetCocoa.h"
 #import "MediaPlaybackTargetMock.h"
 #import "MediaSelectionGroupAVFObjC.h"
+#import "MediaSessionManagerCocoa.h"
 #import "OutOfBandTextTrackPrivateAVF.h"
 #import "PixelBufferConformerCV.h"
 #import "PlatformTimeRanges.h"
@@ -275,6 +276,12 @@
 }
 
 class MediaPlayerPrivateAVFoundationObjC::Factory final : public MediaPlayerFactory {
+public:
+    Factory()
+    {
+        MediaSessionManagerCocoa::ensureCodecsRegistered();
+    }
+
 private:
     MediaPlayerEnums::MediaEngineIdentifier identifier() const final { return MediaPlayerEnums::MediaEngineIdentifier::AVFoundation; };
 

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2021-05-20 06:46:43 UTC (rev 277776)
@@ -34,6 +34,7 @@
 #import "CDMSessionAVStreamSession.h"
 #import "GraphicsContext.h"
 #import "Logging.h"
+#import "MediaSessionManagerCocoa.h"
 #import "MediaSourcePrivateAVFObjC.h"
 #import "MediaSourcePrivateClient.h"
 #import "PixelBufferConformerCV.h"
@@ -199,6 +200,12 @@
 #pragma mark MediaPlayer Factory Methods
 
 class MediaPlayerFactoryMediaSourceAVFObjC final : public MediaPlayerFactory {
+public:
+    MediaPlayerFactoryMediaSourceAVFObjC()
+    {
+        MediaSessionManagerCocoa::ensureCodecsRegistered();
+    }
+
 private:
     MediaPlayerEnums::MediaEngineIdentifier identifier() const final { return MediaPlayerEnums::MediaEngineIdentifier::AVFoundationMSE; };
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (277775 => 277776)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2021-05-20 05:05:40 UTC (rev 277775)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2021-05-20 06:46:43 UTC (rev 277776)
@@ -32,6 +32,7 @@
 #import "GraphicsContextCG.h"
 #import "Logging.h"
 #import "LocalSampleBufferDisplayLayer.h"
+#import "MediaSessionManagerCocoa.h"
 #import "MediaStreamPrivate.h"
 #import "PixelBufferConformerCV.h"
 #import "VideoLayerManagerObjC.h"
@@ -174,6 +175,12 @@
 #pragma mark MediaPlayer Factory Methods
 
 class MediaPlayerFactoryMediaStreamAVFObjC final : public MediaPlayerFactory {
+public:
+    MediaPlayerFactoryMediaStreamAVFObjC()
+    {
+        MediaSessionManagerCocoa::ensureCodecsRegistered();
+    }
+
 private:
     MediaPlayerEnums::MediaEngineIdentifier identifier() const final { return MediaPlayerEnums::MediaEngineIdentifier::AVFoundationMediaStream; };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to