- Revision
- 273564
- Author
- [email protected]
- Date
- 2021-02-26 10:24:35 -0800 (Fri, 26 Feb 2021)
Log Message
[Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created
https://bugs.webkit.org/show_bug.cgi?id=222473
<rdar://problem/74790242>
Reviewed by Eric Carlson.
Source/WebCore:
Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered
when PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will
then not be made unconditionally when creating a Web page, but delayed until required.
No new tests, covered by existing tests.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::setShouldEnableVP9Decoder):
(WebCore::PlatformMediaSessionManager::shouldEnableVP9Decoder):
(WebCore::PlatformMediaSessionManager::setShouldEnableVP8Decoder):
(WebCore::PlatformMediaSessionManager::shouldEnableVP8Decoder):
(WebCore::PlatformMediaSessionManager::setShouldEnableVP9SWDecoder):
(WebCore::PlatformMediaSessionManager::shouldEnableVP9SWDecoder):
* platform/audio/PlatformMediaSessionManager.h:
* platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
Source/WebKit:
Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered when
PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will then not
be made unconditionally when creating a Web page, but delayed until required.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_lastNavigationWasAppBound):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::enableVP9Decoder): Deleted.
(WebKit::WebProcess::enableVP8SWDecoder): Deleted.
(WebKit::WebProcess::enableVP9SWDecoder): Deleted.
* WebProcess/WebProcess.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (273563 => 273564)
--- trunk/Source/WebCore/ChangeLog 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebCore/ChangeLog 2021-02-26 18:24:35 UTC (rev 273564)
@@ -1,3 +1,28 @@
+2021-02-26 Per Arne <[email protected]>
+
+ [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created
+ https://bugs.webkit.org/show_bug.cgi?id=222473
+ <rdar://problem/74790242>
+
+ Reviewed by Eric Carlson.
+
+ Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered
+ when PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will
+ then not be made unconditionally when creating a Web page, but delayed until required.
+
+ No new tests, covered by existing tests.
+
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::setShouldEnableVP9Decoder):
+ (WebCore::PlatformMediaSessionManager::shouldEnableVP9Decoder):
+ (WebCore::PlatformMediaSessionManager::setShouldEnableVP8Decoder):
+ (WebCore::PlatformMediaSessionManager::shouldEnableVP8Decoder):
+ (WebCore::PlatformMediaSessionManager::setShouldEnableVP9SWDecoder):
+ (WebCore::PlatformMediaSessionManager::shouldEnableVP9SWDecoder):
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
+ (WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa):
+
2021-02-26 Devin Rousso <[email protected]>
[Payment Request] log if `updateWith` is not called synchronously
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (273563 => 273564)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2021-02-26 18:24:35 UTC (rev 273564)
@@ -47,6 +47,12 @@
bool PlatformMediaSessionManager::m_opusDecoderEnabled;
#endif
+#if ENABLE(VP9)
+bool PlatformMediaSessionManager::m_vp9DecoderEnabled;
+bool PlatformMediaSessionManager::m_vp8DecoderEnabled;
+bool PlatformMediaSessionManager::m_vp9SWDecoderEnabled;
+#endif
+
static std::unique_ptr<PlatformMediaSessionManager>& sharedPlatformMediaSessionManager()
{
static NeverDestroyed<std::unique_ptr<PlatformMediaSessionManager>> platformMediaSessionManager;
@@ -677,6 +683,38 @@
#endif
}
+#if ENABLE(VP9)
+void PlatformMediaSessionManager::setShouldEnableVP9Decoder(bool vp9DecoderEnabled)
+{
+ m_vp9DecoderEnabled = vp9DecoderEnabled;
+}
+
+bool PlatformMediaSessionManager::shouldEnableVP9Decoder()
+{
+ return m_vp9DecoderEnabled;
+}
+
+void PlatformMediaSessionManager::setShouldEnableVP8Decoder(bool vp8DecoderEnabled)
+{
+ m_vp8DecoderEnabled = vp8DecoderEnabled;
+}
+
+bool PlatformMediaSessionManager::shouldEnableVP8Decoder()
+{
+ return m_vp8DecoderEnabled;
+}
+
+void PlatformMediaSessionManager::setShouldEnableVP9SWDecoder(bool vp9SWDecoderEnabled)
+{
+ m_vp9SWDecoderEnabled = vp9SWDecoderEnabled;
+}
+
+bool PlatformMediaSessionManager::shouldEnableVP9SWDecoder()
+{
+ return m_vp9SWDecoderEnabled;
+}
+#endif // ENABLE(VP9)
+
#else // ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
void PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary()
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (273563 => 273564)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2021-02-26 18:24:35 UTC (rev 273564)
@@ -64,6 +64,15 @@
WEBCORE_EXPORT static void setOpusDecoderEnabled(bool);
WEBCORE_EXPORT static bool opusDecoderEnabled();
+#if ENABLE(VP9)
+ WEBCORE_EXPORT static void setShouldEnableVP9Decoder(bool);
+ WEBCORE_EXPORT static bool shouldEnableVP9Decoder();
+ WEBCORE_EXPORT static void setShouldEnableVP8Decoder(bool);
+ WEBCORE_EXPORT static bool shouldEnableVP8Decoder();
+ WEBCORE_EXPORT static void setShouldEnableVP9SWDecoder(bool);
+ WEBCORE_EXPORT static bool shouldEnableVP9SWDecoder();
+#endif
+
virtual ~PlatformMediaSessionManager() = default;
virtual void scheduleSessionStatusUpdate() { }
@@ -221,6 +230,12 @@
static bool m_opusDecoderEnabled;
#endif
+#if ENABLE(VP9)
+ static bool m_vp9DecoderEnabled;
+ static bool m_vp8DecoderEnabled;
+ static bool m_vp9SWDecoderEnabled;
+#endif
+
#if !RELEASE_LOG_DISABLED
Ref<AggregateLogger> m_logger;
#endif
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (273563 => 273564)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2021-02-26 18:24:35 UTC (rev 273564)
@@ -38,6 +38,7 @@
#import "NowPlayingInfo.h"
#import "PlatformMediaSession.h"
#import "PlatformStrategies.h"
+#import "VP9UtilitiesCocoa.h"
#import <wtf/BlockObjCExceptions.h>
#import <wtf/Function.h>
@@ -56,6 +57,14 @@
MediaSessionManagerCocoa::MediaSessionManagerCocoa()
{
+#if ENABLE(VP9)
+ if (shouldEnableVP9Decoder())
+ registerSupplementalVP9Decoder();
+ if (shouldEnableVP8Decoder())
+ registerWebKitVP8Decoder();
+ if (shouldEnableVP9SWDecoder())
+ registerWebKitVP9Decoder();
+#endif
}
void MediaSessionManagerCocoa::updateSessionState()
Modified: trunk/Source/WebKit/ChangeLog (273563 => 273564)
--- trunk/Source/WebKit/ChangeLog 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebKit/ChangeLog 2021-02-26 18:24:35 UTC (rev 273564)
@@ -1,3 +1,23 @@
+2021-02-26 Per Arne <[email protected]>
+
+ [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created
+ https://bugs.webkit.org/show_bug.cgi?id=222473
+ <rdar://problem/74790242>
+
+ Reviewed by Eric Carlson.
+
+ Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered when
+ PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will then not
+ be made unconditionally when creating a Web page, but delayed until required.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_lastNavigationWasAppBound):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::enableVP9Decoder): Deleted.
+ (WebKit::WebProcess::enableVP8SWDecoder): Deleted.
+ (WebKit::WebProcess::enableVP9SWDecoder): Deleted.
+ * WebProcess/WebProcess.h:
+
2021-02-26 Kate Cheney <[email protected]>
Convert WKMediaPlaybackState NS_ENUM back to NSUInteger type
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (273563 => 273564)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-02-26 18:24:35 UTC (rev 273564)
@@ -861,14 +861,9 @@
#endif
#if ENABLE(VP9)
- if (parameters.shouldEnableVP9Decoder)
- WebProcess::singleton().enableVP9Decoder();
-
- if (parameters.shouldEnableVP8Decoder)
- WebProcess::singleton().enableVP8SWDecoder();
-
- if (parameters.shouldEnableVP9SWDecoder)
- WebProcess::singleton().enableVP9SWDecoder();
+ PlatformMediaSessionManager::setShouldEnableVP9Decoder(parameters.shouldEnableVP9Decoder);
+ PlatformMediaSessionManager::setShouldEnableVP8Decoder(parameters.shouldEnableVP8Decoder);
+ PlatformMediaSessionManager::setShouldEnableVP9SWDecoder(parameters.shouldEnableVP9SWDecoder);
#endif
m_page->setCanUseCredentialStorage(parameters.canUseCredentialStorage);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (273563 => 273564)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2021-02-26 18:24:35 UTC (rev 273564)
@@ -2026,42 +2026,6 @@
#endif
-#if ENABLE(VP9)
-void WebProcess::enableVP9Decoder()
-{
- if (m_vp9DecoderEnabled)
- return;
-
- m_vp9DecoderEnabled = true;
-
-#if PLATFORM(COCOA)
- WebCore::registerSupplementalVP9Decoder();
-#endif
-}
-
-void WebProcess::enableVP8SWDecoder()
-{
- if (m_vp9SWDecoderEnabled)
- return;
-
- m_vp8SWDecoderEnabled = true;
-#if PLATFORM(COCOA)
- WebCore::registerWebKitVP8Decoder();
-#endif
-}
-
-void WebProcess::enableVP9SWDecoder()
-{
- if (m_vp9SWDecoderEnabled)
- return;
-
- m_vp9SWDecoderEnabled = true;
-#if PLATFORM(COCOA)
- WebCore::registerWebKitVP9Decoder();
-#endif
-}
-#endif
-
#if ENABLE(MEDIA_STREAM)
SpeechRecognitionRealtimeMediaSourceManager& WebProcess::ensureSpeechRecognitionRealtimeMediaSourceManager()
{
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (273563 => 273564)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-02-26 18:24:34 UTC (rev 273563)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-02-26 18:24:35 UTC (rev 273564)
@@ -359,12 +359,6 @@
#endif
#endif
-#if ENABLE(VP9)
- void enableVP9Decoder();
- void enableVP8SWDecoder();
- void enableVP9SWDecoder();
-#endif
-
#if PLATFORM(COCOA)
void willWriteToPasteboardAsynchronously(const String& pasteboardName);
void waitForPendingPasteboardWritesToFinish(const String& pasteboardName);
@@ -725,12 +719,6 @@
#endif
#endif
-#if ENABLE(VP9)
- bool m_vp9DecoderEnabled { false };
- bool m_vp8SWDecoderEnabled { false };
- bool m_vp9SWDecoderEnabled { false };
-#endif
-
#if ENABLE(MEDIA_STREAM)
std::unique_ptr<SpeechRecognitionRealtimeMediaSourceManager> m_speechRecognitionRealtimeMediaSourceManager;
#endif