[Webkit-unassigned] [Bug 135972] [GStreamer] unrelated codecs required to play videos

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 17 02:08:45 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=135972

Mario Sanchez Prada <mario at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mario at webkit.org

--- Comment #13 from Mario Sanchez Prada <mario at webkit.org> ---
For the record, I'm pasting below the patch that I just applied downstream yesterday that is serving us well for the time being in our particular and controlled scenario.

Notice that I'm not asking for review over it, as I understand that solution is not valid for upstream, just sharing in case it's useful to someone else. That said, if someone wants to take over on making a real patch, or guiding me on what exactly would be a good enough way to do it, I'm happy to help. 

--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -1690,6 +1690,25 @@ void MediaPlayerPrivateGStreamer::loadin
     m_readyTimerHandler.cancel();
 }

+static bool gstRegistryHasDecoder(const String& decoder)
+{
+    GList *decoder_factories, *gst_decoders;
+    GstCaps *caps;
+    bool retval;
+
+    decoder_factories = gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO, GST_RANK_MARGINAL);
+    caps = gst_caps_new_empty_simple (decoder.utf8().data());
+    gst_decoders = gst_element_factory_list_filter (decoder_factories, caps, GST_PAD_SINK, FALSE);
+    gst_caps_unref (caps);
+
+    retval = gst_decoders != NULL;
+
+    gst_plugin_feature_list_free (gst_decoders);
+    gst_plugin_feature_list_free (decoder_factories);
+
+    return retval;
+}
+
 static HashSet<String> mimeTypeCache()
 {
     initializeGStreamerAndRegisterWebKitElements();
@@ -1768,7 +1787,6 @@ static HashSet<String> mimeTypeCache()
         "video/flv",
         "video/mj2",
         "video/mp2t",
-        "video/mp4",
         "video/mpeg",
         "video/mpegts",
         "video/ogg",
@@ -1795,6 +1813,15 @@ static HashSet<String> mimeTypeCache()
     for (unsigned i = 0; i < (sizeof(mimeTypes) / sizeof(*mimeTypes)); ++i)
         cache.add(String(mimeTypes[i]));

+    if (gstRegistryHasDecoder(String::fromUTF8("video/x-h264")))
+        cache.add(String::fromUTF8("video/mp4"));
+
     typeListInitialized = true;
     return cache;
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151217/f16b1341/attachment.html>


More information about the webkit-unassigned mailing list