WebKit Bugzilla
Attachment 348638 Details for
Bug 189192
: [GStreamer] elements registration clean-ups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189192-20180831152205.patch (text/plain), 8.27 KB, created by
Philippe Normand
on 2018-08-31 07:22:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Philippe Normand
Created:
2018-08-31 07:22:06 PDT
Size:
8.27 KB
patch
obsolete
>Subversion Revision: 235548 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 649b9f7dc6b5f33269787d7634b844c92e3107fd..f76896c00bf4d5fec6212cc4542e306d5d73e4f6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-08-31 Philippe Normand <pnormand@igalia.com> >+ >+ [GStreamer] elements registration clean-ups >+ https://bugs.webkit.org/show_bug.cgi?id=189192 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Register all our elements from the base player class. This >+ simplifies the MSE player by removing duplicated code. >+ >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): >+ (WebCore::registerWebKitGStreamerElements): Deleted. >+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine): >+ (WebCore::MediaPlayerPrivateGStreamerMSE::load): >+ (WebCore::mimeTypeCache): >+ (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Deleted. >+ (WebCore::MediaPlayerPrivateGStreamerMSE::isAvailable): Deleted. >+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: >+ > 2018-08-31 Philippe Normand <pnormand@igalia.com> > > Unreviewed, GTK Ubuntu LTS build fix after r235543. >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >index 0db6181c4a8a09f7dc2940939c96439bf193422f..d55fa22da8ac52096d26c01748ac11d66ac27365 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h >@@ -66,6 +66,8 @@ public: > virtual ~MediaPlayerPrivateGStreamer(); > > static void registerMediaEngine(MediaEngineRegistrar); >+ static bool isAvailable(); >+ > void handleMessage(GstMessage*); > void handlePluginInstallerResult(GstInstallPluginsReturn); > >@@ -137,7 +139,6 @@ private: > static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&); > static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&); > >- static bool isAvailable(); > > GstElement* createAudioSink() override; > >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >index bd6f29d0b28b45ed15dd05fecf337cbe114284f2..6fa43fc5996903acd8de8e973908f8fc6f08fd38 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >@@ -54,6 +54,10 @@ > #include "WebKitClearKeyDecryptorGStreamer.h" > #endif > >+#if ENABLE(MEDIA_SOURCE) >+#include "WebKitMediaSourceGStreamer.h" >+#endif >+ > #if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1, 10, 0) > #include "GStreamerMediaStreamSource.h" > #endif >@@ -138,34 +142,30 @@ GST_DEBUG_CATEGORY(webkit_media_player_debug); > namespace WebCore { > using namespace std; > >-void registerWebKitGStreamerElements() >-{ >-#if ENABLE(ENCRYPTED_MEDIA) >- if (!webkitGstCheckVersion(1, 6, 1)) >- return; >- >- GRefPtr<GstElementFactory> clearKeyDecryptorFactory = adoptGRef(gst_element_factory_find("webkitclearkey")); >- if (!clearKeyDecryptorFactory) >- gst_element_register(nullptr, "webkitclearkey", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_CK_DECRYPT); >-#endif >-#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1,10,0) >- gst_element_register(nullptr, "mediastreamsrc", GST_RANK_PRIMARY, WEBKIT_TYPE_MEDIA_STREAM_SRC); >-#endif >-} >- > bool MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements() > { > if (!initializeGStreamer()) > return false; > >- registerWebKitGStreamerElements(); >- >- GRefPtr<GstElementFactory> srcFactory = adoptGRef(gst_element_factory_find("webkitwebsrc")); >- if (!srcFactory) { >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { > GST_DEBUG_CATEGORY_INIT(webkit_media_player_debug, "webkitmediaplayer", 0, "WebKit media player"); >- gst_element_register(0, "webkitwebsrc", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_WEB_SRC); >- } >+#if ENABLE(ENCRYPTED_MEDIA) >+ if (webkitGstCheckVersion(1, 6, 1)) >+ gst_element_register(nullptr, "webkitclearkey", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_CK_DECRYPT); >+#endif > >+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1, 10, 0) >+ if (webkitGstCheckVersion(1, 10, 0)) >+ gst_element_register(nullptr, "mediastreamsrc", GST_RANK_PRIMARY, WEBKIT_TYPE_MEDIA_STREAM_SRC); >+#endif >+ >+#if ENABLE(MEDIA_SOURCE) >+ gst_element_register(nullptr, "webkitmediasrc", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_SRC); >+#endif >+ >+ gst_element_register(0, "webkitwebsrc", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_WEB_SRC); >+ }); > return true; > } > >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >index dd22fb2cc1ede7047d19b03d4b28d50c6ce232c2..4f1f8ab038b7833beae2890a2cae45598dfb2a76 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp >@@ -79,33 +79,13 @@ namespace WebCore { > > void MediaPlayerPrivateGStreamerMSE::registerMediaEngine(MediaEngineRegistrar registrar) > { >+ GST_DEBUG_CATEGORY_INIT(webkit_mse_debug, "webkitmse", 0, "WebKit MSE media player"); > if (isAvailable()) { > registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateGStreamerMSE>(player); }, > getSupportedTypes, supportsType, nullptr, nullptr, nullptr, supportsKeySystem); > } > } > >-bool initializeGStreamerAndRegisterWebKitMSEElement() >-{ >- registerWebKitGStreamerElements(); >- >- GST_DEBUG_CATEGORY_INIT(webkit_mse_debug, "webkitmse", 0, "WebKit MSE media player"); >- >- GRefPtr<GstElementFactory> WebKitMediaSrcFactory = adoptGRef(gst_element_factory_find("webkitmediasrc")); >- if (UNLIKELY(!WebKitMediaSrcFactory)) >- gst_element_register(nullptr, "webkitmediasrc", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_MEDIA_SRC); >- return true; >-} >- >-bool MediaPlayerPrivateGStreamerMSE::isAvailable() >-{ >- if (UNLIKELY(!initializeGStreamerAndRegisterWebKitMSEElement())) >- return false; >- >- GRefPtr<GstElementFactory> factory = adoptGRef(gst_element_factory_find("playbin")); >- return factory; >-} >- > MediaPlayerPrivateGStreamerMSE::MediaPlayerPrivateGStreamerMSE(MediaPlayer* player) > : MediaPlayerPrivateGStreamer(player) > { >@@ -137,7 +117,8 @@ void MediaPlayerPrivateGStreamerMSE::load(const String& urlString) > return; > } > >- if (UNLIKELY(!initializeGStreamerAndRegisterWebKitMSEElement())) >+ >+ if (UNLIKELY(!MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements())) > return; > > if (!m_playbackPipeline) >@@ -708,7 +689,7 @@ static HashSet<String, ASCIICaseInsensitiveHash>& mimeTypeCache() > { > static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> cache = []() > { >- initializeGStreamerAndRegisterWebKitMSEElement(); >+ MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements(); > HashSet<String, ASCIICaseInsensitiveHash> set; > const char* mimeTypes[] = { > "video/mp4", >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h >index f3c7fbdd141a6c7bb4d5416b34914f2a11d493f6..2257e9e6830acb18c6f08f7186bf7758b72735d7 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h >@@ -93,8 +93,6 @@ private: > static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&); > static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&); > >- static bool isAvailable(); >- > // FIXME: Reduce code duplication. > void updateStates() override; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
calvaris
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189192
: 348638