Title: [264162] trunk
Revision
264162
Author
[email protected]
Date
2020-07-09 02:24:58 -0700 (Thu, 09 Jul 2020)

Log Message

[GStreamer][MSE] AV1 support
https://bugs.webkit.org/show_bug.cgi?id=207547

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

If only the av1dec decoder is available, consider AV1 decoding
support as disabled, because this plugin performs really badly.
However, if any other AV1 decoder is present, such as the
dav1d-based Rust decoder for instance, consider AV1 support as
enabled.

These checks are now performed by both RegistryScanner instances,
for MSE and non-MSE players.

* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::hasElementForMediaType const):
(WebCore::GStreamerRegistryScanner::initialize):
* platform/graphics/gstreamer/GStreamerRegistryScanner.h:

LayoutTests:

* platform/glib/TestExpectations: Mark media/media-can-play-av1.html as failing until the
Flatpak SDK ships gst-plugins-rs.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264161 => 264162)


--- trunk/LayoutTests/ChangeLog	2020-07-09 08:29:35 UTC (rev 264161)
+++ trunk/LayoutTests/ChangeLog	2020-07-09 09:24:58 UTC (rev 264162)
@@ -1,3 +1,13 @@
+2020-07-09  Philippe Normand  <[email protected]>
+
+        [GStreamer][MSE] AV1 support
+        https://bugs.webkit.org/show_bug.cgi?id=207547
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/glib/TestExpectations: Mark media/media-can-play-av1.html as failing until the
+        Flatpak SDK ships gst-plugins-rs.
+
 2020-07-09  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Add support for HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain

Modified: trunk/LayoutTests/platform/glib/TestExpectations (264161 => 264162)


--- trunk/LayoutTests/platform/glib/TestExpectations	2020-07-09 08:29:35 UTC (rev 264161)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2020-07-09 09:24:58 UTC (rev 264162)
@@ -159,6 +159,8 @@
 
 webkit.org/b/214031 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto.html [ ImageOnlyFailure ]
 
+webkit.org/b/207547 media/media-can-play-av1.html [ Failure ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of GStreamer-related bugs
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/Source/WebCore/ChangeLog (264161 => 264162)


--- trunk/Source/WebCore/ChangeLog	2020-07-09 08:29:35 UTC (rev 264161)
+++ trunk/Source/WebCore/ChangeLog	2020-07-09 09:24:58 UTC (rev 264162)
@@ -1,3 +1,24 @@
+2020-07-09  Philippe Normand  <[email protected]>
+
+        [GStreamer][MSE] AV1 support
+        https://bugs.webkit.org/show_bug.cgi?id=207547
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        If only the av1dec decoder is available, consider AV1 decoding
+        support as disabled, because this plugin performs really badly.
+        However, if any other AV1 decoder is present, such as the
+        dav1d-based Rust decoder for instance, consider AV1 support as
+        enabled.
+
+        These checks are now performed by both RegistryScanner instances,
+        for MSE and non-MSE players.
+
+        * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
+        (WebCore::GStreamerRegistryScanner::hasElementForMediaType const):
+        (WebCore::GStreamerRegistryScanner::initialize):
+        * platform/graphics/gstreamer/GStreamerRegistryScanner.h:
+
 2020-07-09  Alicia Boya GarcĂ­a  <[email protected]>
 
         [MSE][GStreamer] Remove orphan code in SourceBufferPrivateGStreamer::append()

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp (264161 => 264162)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp	2020-07-09 08:29:35 UTC (rev 264161)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp	2020-07-09 09:24:58 UTC (rev 264162)
@@ -67,7 +67,7 @@
     gst_plugin_feature_list_free(m_demuxerFactories);
 }
 
-GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::hasElementForMediaType(GList* elementFactories, const char* capsString, bool shouldCheckHardwareClassifier) const
+GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::hasElementForMediaType(GList* elementFactories, const char* capsString, bool shouldCheckHardwareClassifier, Optional<Vector<String>> blackList) const
 {
     GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string(capsString));
     GList* candidates = gst_element_factory_list_filter(elementFactories, caps.get(), GST_PAD_SINK, false);
@@ -74,6 +74,22 @@
     bool isSupported = candidates;
     bool isUsingHardware = false;
 
+    if (blackList.hasValue() && !blackList->isEmpty()) {
+        bool hasValidCandidate = false;
+        for (GList* factories = candidates; factories; factories = g_list_next(factories)) {
+            String name(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE_CAST(factories->data)));
+            if (blackList->contains(name))
+                continue;
+            hasValidCandidate = true;
+            break;
+        }
+        if (!hasValidCandidate) {
+            GST_WARNING("All elements for caps %" GST_PTR_FORMAT " are blacklisted", caps.get());
+            isSupported = false;
+            shouldCheckHardwareClassifier = false;
+        }
+    }
+
     if (shouldCheckHardwareClassifier) {
         for (GList* factories = candidates; factories; factories = g_list_next(factories)) {
             auto* factory = reinterpret_cast<GstElementFactory*>(factories->data);
@@ -159,7 +175,8 @@
         m_codecMap.add(AtomString("x-vorbis"), false);
     }
 
-    if (hasElementForMediaType(m_demuxerFactories, "video/x-matroska")) {
+    bool matroskaSupported = hasElementForMediaType(m_demuxerFactories, "video/x-matroska");
+    if (matroskaSupported) {
         auto vp8DecoderAvailable = hasElementForMediaType(m_videoDecoderFactories, "video/x-vp8", true);
         auto vp9DecoderAvailable = hasElementForMediaType(m_videoDecoderFactories, "video/x-vp9", true);
 
@@ -190,6 +207,12 @@
         m_codecMap.add(AtomString("mp4v*"), h264DecoderAvailable.isUsingHardware);
     }
 
+    Vector<String> av1DecodersBlacklist { "av1dec"_s };
+    if ((matroskaSupported || isContainerTypeSupported("video/mp4")) && hasElementForMediaType(m_videoDecoderFactories, "video/x-av1", false, makeOptional(WTFMove(av1DecodersBlacklist)))) {
+        m_codecMap.add(AtomString("av01*"), false);
+        m_codecMap.add(AtomString("x-av1"), false);
+    }
+
     if (m_isMediaSource)
         return;
 
@@ -262,7 +285,6 @@
         m_mimeTypeSet.add(AtomString("audio/x-mpeg"));
     }
 
-    bool matroskaSupported = hasElementForMediaType(m_demuxerFactories, "video/x-matroska");
     if (matroskaSupported) {
         m_mimeTypeSet.add(AtomString("video/x-matroska"));
 
@@ -269,9 +291,6 @@
         if (hasElementForMediaType(m_videoDecoderFactories, "video/x-vp10"))
             m_mimeTypeSet.add(AtomString("video/webm"));
     }
-
-    if ((matroskaSupported || isContainerTypeSupported("video/mp4")) && hasElementForMediaType(m_videoDecoderFactories, "video/x-av1"))
-        m_codecMap.add(AtomString("av01*"), false);
 }
 
 bool GStreamerRegistryScanner::isCodecSupported(String codec, bool shouldCheckForHardwareUse) const

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h (264161 => 264162)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h	2020-07-09 08:29:35 UTC (rev 264161)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.h	2020-07-09 09:24:58 UTC (rev 264162)
@@ -74,7 +74,7 @@
     };
     void fillMimeTypeSetFromCapsMapping(Vector<GstCapsWebKitMapping>&);
 
-    RegistryLookupResult hasElementForMediaType(GList* elementFactories, const char* capsString, bool shouldCheckHardwareClassifier = false) const;
+    RegistryLookupResult hasElementForMediaType(GList* elementFactories, const char* capsString, bool shouldCheckHardwareClassifier = false, Optional<Vector<String>> blackList = WTF::nullopt) const;
 
     bool isAVC1CodecSupported(const String& codec, bool shouldCheckForHardwareUse) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to