Title: [268908] releases/WebKitGTK/webkit-2.30
Revision
268908
Author
[email protected]
Date
2020-10-23 01:25:22 -0700 (Fri, 23 Oct 2020)

Log Message

Merge r268392 - [GStreamer] Crash in WebCore::GStreamerRegistryScanner::isAVC1CodecSupported
https://bugs.webkit.org/show_bug.cgi?id=217647

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

The registry scanner was assuming the avc1 codec field is always of the form
avc1.codecprofile, which is wrong.

Covered by test: media/media-can-play-mpeg4-video.html

* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const): Check for '.' presence and
fallback to unconstrained check if no profile or level information was extracted.

LayoutTests:

* media/media-can-play-mpeg4-video-expected.txt:
* media/media-can-play-mpeg4-video.html: Add test for "avc1" codec.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.30/LayoutTests/ChangeLog (268907 => 268908)


--- releases/WebKitGTK/webkit-2.30/LayoutTests/ChangeLog	2020-10-23 08:06:05 UTC (rev 268907)
+++ releases/WebKitGTK/webkit-2.30/LayoutTests/ChangeLog	2020-10-23 08:25:22 UTC (rev 268908)
@@ -1,3 +1,13 @@
+2020-10-13  Philippe Normand  <[email protected]>
+
+        [GStreamer] Crash in WebCore::GStreamerRegistryScanner::isAVC1CodecSupported
+        https://bugs.webkit.org/show_bug.cgi?id=217647
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * media/media-can-play-mpeg4-video-expected.txt:
+        * media/media-can-play-mpeg4-video.html: Add test for "avc1" codec.
+
 2020-08-28  Adrian Perez de Castro  <[email protected]>
 
         [WPE] Enable Notifications support

Modified: releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video-expected.txt (268907 => 268908)


--- releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video-expected.txt	2020-10-23 08:06:05 UTC (rev 268907)
+++ releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video-expected.txt	2020-10-23 08:25:22 UTC (rev 268908)
@@ -5,6 +5,7 @@
 
 EXPECTED (video.canPlayType('video/x-m4v') == 'maybe') OK
 EXPECTED (video.canPlayType('video/mp4') == 'maybe') OK
+EXPECTED (video.canPlayType('video/mp4; Codecs="avc1"') == 'probably') OK
 EXPECTED (video.canPlayType('video/mp4; Codecs="avc1.4D400C"') == 'probably') OK
 EXPECTED (video.canPlayType(' Video/MP4 ; CODECS="mp4v.20.8, mp4a.40.2"') == 'probably') OK
 END OF TEST

Modified: releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video.html (268907 => 268908)


--- releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video.html	2020-10-23 08:06:05 UTC (rev 268907)
+++ releases/WebKitGTK/webkit-2.30/LayoutTests/media/media-can-play-mpeg4-video.html	2020-10-23 08:25:22 UTC (rev 268908)
@@ -9,6 +9,7 @@
 
                 testExpected("video.canPlayType('video/x-m4v')", "maybe");
                 testExpected("video.canPlayType('video/mp4')", "maybe");
+                testExpected("video.canPlayType('video/mp4; Codecs=\"avc1\"')", "probably");
                 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"')", "probably");
                 testExpected("video.canPlayType('        Video/MP4 ; CODECS=\"mp4v.20.8, mp4a.40.2\"')", "probably");
 

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog (268907 => 268908)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog	2020-10-23 08:06:05 UTC (rev 268907)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/ChangeLog	2020-10-23 08:25:22 UTC (rev 268908)
@@ -1,3 +1,19 @@
+2020-10-13  Philippe Normand  <[email protected]>
+
+        [GStreamer] Crash in WebCore::GStreamerRegistryScanner::isAVC1CodecSupported
+        https://bugs.webkit.org/show_bug.cgi?id=217647
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The registry scanner was assuming the avc1 codec field is always of the form
+        avc1.codecprofile, which is wrong.
+
+        Covered by test: media/media-can-play-mpeg4-video.html
+
+        * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
+        (WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const): Check for '.' presence and
+        fallback to unconstrained check if no profile or level information was extracted.
+
 2020-10-13  Adrian Perez de Castro  <[email protected]>
 
         [GTK] Make gamepads visible after their first input is received

Modified: releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp (268907 => 268908)


--- releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp	2020-10-23 08:06:05 UTC (rev 268907)
+++ releases/WebKitGTK/webkit-2.30/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp	2020-10-23 08:25:22 UTC (rev 268908)
@@ -362,6 +362,21 @@
 
 bool GStreamerRegistryScanner::isAVC1CodecSupported(const String& codec, bool shouldCheckForHardwareUse) const
 {
+    auto checkH264Caps = [&](const char* capsString) {
+        bool supported = false;
+        auto lookupResult = hasElementForMediaType(m_videoDecoderFactories, capsString, true);
+        supported = lookupResult;
+        if (shouldCheckForHardwareUse)
+            supported = lookupResult.isUsingHardware;
+        GST_DEBUG("%s decoding supported for codec %s: %s", shouldCheckForHardwareUse ? "Hardware" : "Software", codec.utf8().data(), boolForPrinting(supported));
+        return supported;
+    };
+
+    if (codec.find('.') == notFound) {
+        GST_DEBUG("Codec has no profile/level, falling back to unconstrained caps");
+        return checkH264Caps("video/x-h264");
+    }
+
     auto components = codec.split('.');
     long int spsAsInteger = strtol(components[1].utf8().data(), nullptr, 16);
     uint8_t sps[3];
@@ -388,16 +403,6 @@
 
     GST_DEBUG("Codec %s translates to H.264 profile %s and level %s", codec.utf8().data(), profile, level);
 
-    auto checkH264Caps = [&](const char* capsString) {
-        bool supported = false;
-        auto lookupResult = hasElementForMediaType(m_videoDecoderFactories, capsString, true);
-        supported = lookupResult;
-        if (shouldCheckForHardwareUse)
-            supported = lookupResult.isUsingHardware;
-        GST_DEBUG("%s decoding supported for codec %s: %s", shouldCheckForHardwareUse ? "Hardware" : "Software", codec.utf8().data(), boolForPrinting(supported));
-        return supported;
-    };
-
     if (const char* maxVideoResolution = g_getenv("WEBKIT_GST_MAX_AVC1_RESOLUTION")) {
         uint8_t levelAsInteger = gst_codec_utils_h264_get_level_idc(level);
         GST_DEBUG("Maximum video resolution requested: %s, supplied codec level IDC: %u", maxVideoResolution, levelAsInteger);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to