Title: [228818] trunk
Revision
228818
Author
ph...@webkit.org
Date
2018-02-20 06:16:00 -0800 (Tue, 20 Feb 2018)

Log Message

[GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=173655

Reviewed by Xabier Rodriguez-Calvar.

The FIXME in GStreamerUtilities.cpp asks to pass the command line
parameters to the GStreamer initialization function.

Based on initial patch by: Vanessa Chipirrás Navalón  <vchipir...@igalia.com>

Source/WebCore:

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Removes the call to the method
that GStreamer initializes. It is no longer necessary.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
* platform/graphics/gstreamer/GStreamerUtilities.cpp:
(WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
* platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
GStreamer options as the input parameter of the initializeGStreamer() method.

Source/WebKit:

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h: Define the vector which contains the GStreamer options.
* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess): Read from cmdline file
the GStreamer options written by console.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Call initializeGStreamer() method passing
the vector which contains the options.

Tools:

* MiniBrowser/gtk/main.c:
(main): Add the group containing the Gstreamer options that the console displays.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228817 => 228818)


--- trunk/Source/WebCore/ChangeLog	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/ChangeLog	2018-02-20 14:16:00 UTC (rev 228818)
@@ -1,3 +1,27 @@
+2018-02-20  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=173655
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The FIXME in GStreamerUtilities.cpp asks to pass the command line
+        parameters to the GStreamer initialization function.
+
+        Based on initial patch by: Vanessa Chipirrás Navalón  <vchipir...@igalia.com>
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::constructCommon): Removes the call to the method
+        that GStreamer initializes. It is no longer necessary.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
+        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
+        (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
+        * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
+        GStreamer options as the input parameter of the initializeGStreamer() method.
+
 2018-02-20  Miguel Gomez  <mago...@igalia.com>
 
         [GTK] whatsapp web blurry in some parts, sharp on others

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (228817 => 228818)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -162,10 +162,6 @@
     // Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method.
     setPendingActivity(this);
 
-#if USE(GSTREAMER)
-    initializeGStreamer();
-#endif
-
     FFTFrame::initialize();
     
     m_listener = AudioListener::create();

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (228817 => 228818)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -236,16 +236,22 @@
     fastFree(mapInfo);
 }
 
-bool initializeGStreamer()
+bool initializeGStreamer(Vector<String>& parameters)
 {
-    if (gst_is_initialized())
-        return true;
-
     GUniqueOutPtr<GError> error;
-    // FIXME: We should probably pass the arguments from the command line.
-    bool gstInitialized = gst_init_check(nullptr, nullptr, &error.outPtr());
-    ASSERT_WITH_MESSAGE(gstInitialized, "GStreamer initialization failed: %s", error ? error->message : "unknown error occurred");
+    bool isGStreamerInitialized = false;
 
+#if ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
+    char** argv = g_new0(char*, parameters.size() + 2);
+    argv[0] = g_strdup("WebProcess");
+    for (unsigned i = 1; i < parameters.size(); i++)
+        argv[i] = g_strdup(parameters[i].utf8().data());
+
+    int size = g_strv_length(argv);
+    isGStreamerInitialized = gst_init_check(&size, &argv, &error.outPtr());
+    g_strfreev(argv);
+    ASSERT_WITH_MESSAGE(isGStreamerInitialized, "GStreamer initialization failed: %s", error ? error->message : "unknown error occurred");
+
     if (isFastMallocEnabled()) {
         const char* disableFastMalloc = getenv("WEBKIT_GST_DISABLE_FAST_MALLOC");
         if (!disableFastMalloc || !strcmp(disableFastMalloc, "0"))
@@ -253,11 +259,12 @@
     }
 
 #if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
-    if (gstInitialized)
+    if (isGStreamerInitialized)
         gst_mpegts_initialize();
 #endif
+#endif
 
-    return gstInitialized;
+    return isGStreamerInitialized;
 }
 
 unsigned getGstPlayFlag(const char* nick)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h (228817 => 228818)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h	2018-02-20 14:16:00 UTC (rev 228818)
@@ -69,7 +69,7 @@
 bool areEncryptedCaps(const GstCaps*);
 void mapGstBuffer(GstBuffer*, uint32_t);
 void unmapGstBuffer(GstBuffer*);
-bool initializeGStreamer();
+bool initializeGStreamer(Vector<String>& parameters);
 unsigned getGstPlayFlag(const char* nick);
 uint64_t toGstUnsigned64Time(const MediaTime&);
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (228817 => 228818)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -138,9 +138,6 @@
 
 bool MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements()
 {
-    if (!initializeGStreamer())
-        return false;
-
     registerWebKitGStreamerElements();
 
     GRefPtr<GstElementFactory> srcFactory = adoptGRef(gst_element_factory_find("webkitwebsrc"));

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (228817 => 228818)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -86,9 +86,6 @@
 
 bool initializeGStreamerAndRegisterWebKitMSEElement()
 {
-    if (UNLIKELY(!initializeGStreamer()))
-        return false;
-
     registerWebKitGStreamerElements();
 
     GST_DEBUG_CATEGORY_INIT(webkit_mse_debug, "webkitmse", 0, "WebKit MSE media player");

Modified: trunk/Source/WebKit/ChangeLog (228817 => 228818)


--- trunk/Source/WebKit/ChangeLog	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebKit/ChangeLog	2018-02-20 14:16:00 UTC (rev 228818)
@@ -1,3 +1,26 @@
+2018-02-20  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=173655
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The FIXME in GStreamerUtilities.cpp asks to pass the command line
+        parameters to the GStreamer initialization function.
+
+        Based on initial patch by: Vanessa Chipirrás Navalón  <vchipir...@igalia.com>
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h: Define the vector which contains the GStreamer options.
+        * UIProcess/gtk/WebProcessPoolGtk.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): Read from cmdline file
+        the GStreamer options written by console.
+        * WebProcess/soup/WebProcessSoup.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess): Call initializeGStreamer() method passing
+        the vector which contains the options.
+
 2018-02-20  Yousuke Kimoto  <yousuke.kim...@sony.com>
 
         [Win] Fix MSVC's treating __attribute__((warn_unused_result))

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (228817 => 228818)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -94,6 +94,9 @@
     encoder << fontWhitelist;
     encoder << terminationTimeout;
     encoder << languages;
+#if USE(GSTREAMER)
+    encoder << gstreamerOptions;
+#endif
     encoder << textCheckerState;
     encoder << fullKeyboardAccessEnabled;
     encoder << defaultRequestTimeoutInterval;
@@ -296,6 +299,10 @@
         return false;
     if (!decoder.decode(parameters.languages))
         return false;
+#if USE(GSTREAMER)
+    if (!decoder.decode(parameters.gstreamerOptions))
+        return false;
+#endif
     if (!decoder.decode(parameters.textCheckerState))
         return false;
     if (!decoder.decode(parameters.fullKeyboardAccessEnabled))

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (228817 => 228818)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-02-20 14:16:00 UTC (rev 228818)
@@ -111,6 +111,9 @@
 
     Vector<String> fontWhitelist;
     Vector<String> languages;
+#if USE(GSTREAMER)
+    Vector<String> gstreamerOptions;
+#endif
 
     CacheModel cacheModel;
 

Modified: trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp (228817 => 228818)


--- trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -90,6 +90,13 @@
 {
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;
     parameters.proxySettings = m_networkProxySettings;
+
+#if USE(GSTREAMER)
+    GUniqueOutPtr<gchar> contents;
+    gsize length;
+    if (g_file_get_contents("/proc/self/cmdline", &contents.outPtr(), &length, nullptr))
+        parameters.gstreamerOptions.append(String::fromUTF8(contents.get()));
+#endif
 }
 
 void WebProcessPool::platformInvalidateContext()

Modified: trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp (228817 => 228818)


--- trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Source/WebKit/WebProcess/soup/WebProcessSoup.cpp	2018-02-20 14:16:00 UTC (rev 228818)
@@ -28,6 +28,7 @@
 #include "WebProcess.h"
 
 #include "WebProcessCreationParameters.h"
+#include <WebCore/GStreamerUtilities.h>
 #include <WebCore/MemoryCache.h>
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/SoupNetworkSession.h>
@@ -51,6 +52,9 @@
 #if PLATFORM(WAYLAND)
     m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
 #endif
+#if USE(GSTREAMER)
+    WebCore::initializeGStreamer(parameters.gstreamerOptions);
+#endif
 }
 
 void WebProcess::platformTerminate()

Modified: trunk/Tools/ChangeLog (228817 => 228818)


--- trunk/Tools/ChangeLog	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Tools/ChangeLog	2018-02-20 14:16:00 UTC (rev 228818)
@@ -1,3 +1,17 @@
+2018-02-20  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=173655
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The FIXME in GStreamerUtilities.cpp asks to pass the command line
+        parameters to the GStreamer initialization function.
+
+        Based on initial patch by: Vanessa Chipirrás Navalón  <vchipir...@igalia.com>
+
+        * MiniBrowser/gtk/main.c:
+        (main): Add the group containing the Gstreamer options that the console displays.
 2018-02-19  Fujii Hironori  <hironori.fu...@sony.com>
 
         [WTR][GTK] crash log backtrace doesn't show symbol names for DatabaseProcess and NetworkProcess

Modified: trunk/Tools/MiniBrowser/gtk/CMakeLists.txt (228817 => 228818)


--- trunk/Tools/MiniBrowser/gtk/CMakeLists.txt	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Tools/MiniBrowser/gtk/CMakeLists.txt	2018-02-20 14:16:00 UTC (rev 228818)
@@ -32,6 +32,7 @@
     ${GTK3_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
+    ${GSTREAMER_INCLUDE_DIRS}
 )
 
 set(MiniBrowser_LIBRARIES
@@ -40,6 +41,7 @@
     ${GTK3_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${LIBSOUP_LIBRARIES}
+    ${GSTREAMER_LIBRARIES}
 )
 
 add_custom_command(

Modified: trunk/Tools/MiniBrowser/gtk/main.c (228817 => 228818)


--- trunk/Tools/MiniBrowser/gtk/main.c	2018-02-20 14:11:05 UTC (rev 228817)
+++ trunk/Tools/MiniBrowser/gtk/main.c	2018-02-20 14:16:00 UTC (rev 228818)
@@ -30,6 +30,7 @@
 #include "BrowserWindow.h"
 #include <_javascript_Core/_javascript_.h>
 #include <errno.h>
+#include <gst/gst.h>
 #include <gtk/gtk.h>
 #include <string.h>
 #include <webkit2/webkit2.h>
@@ -484,6 +485,7 @@
     GOptionContext *context = g_option_context_new(NULL);
     g_option_context_add_main_entries(context, commandLineOptions, 0);
     g_option_context_add_group(context, gtk_get_option_group(TRUE));
+    g_option_context_add_group(context, gst_init_get_option_group());
 
     WebKitSettings *webkitSettings = webkit_settings_new();
     webkit_settings_set_enable_developer_extras(webkitSettings, TRUE);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to