[gnome-build-meta/mcatanzaro/imagedecodergstreamer] Test patch to fix some WebKit crashes




commit 7fcccf6c10044ef28762af2d474e0ef10b0b5075
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Mar 9 08:19:28 2021 -0600

    Test patch to fix some WebKit crashes
    
    https://bugs.webkit.org/show_bug.cgi?id=222763
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/1058>

 elements/sdk/webkitgtk.bst       |  2 ++
 files/webkitgtk/bug-222763.patch | 72 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
---
diff --git a/elements/sdk/webkitgtk.bst b/elements/sdk/webkitgtk.bst
index 825982f3..8625c3f3 100644
--- a/elements/sdk/webkitgtk.bst
+++ b/elements/sdk/webkitgtk.bst
@@ -5,6 +5,8 @@ sources:
   url: webkitgtk_org:webkitgtk-2.31.90.tar.xz
 - kind: patch
   path: files/webkitgtk/2.31.90-fix-build.patch
+- kind: patch
+  path: files/webkitgtk/bug-222763.patch
 - kind: local
   path: files/webkitgtk/toolchain.i686
 - kind: local
diff --git a/files/webkitgtk/bug-222763.patch b/files/webkitgtk/bug-222763.patch
new file mode 100644
index 00000000..ed86d92f
--- /dev/null
+++ b/files/webkitgtk/bug-222763.patch
@@ -0,0 +1,72 @@
+--- a/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp     
++++ a/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp     
+@@ -230,24 +230,6 @@ const ImageDecoderGStreamerSample* ImageDecoderGStreamer::sampleAtIndex(size_t i
+     return toSample(iter);
+ }
+ 
+-int ImageDecoderGStreamer::InnerDecoder::selectStream(GstStream* stream)
+-{
+-    // Select only the first video stream.
+-    auto* object = GST_OBJECT_CAST(m_decodebin.get());
+-    GST_OBJECT_LOCK(object);
+-    auto numberOfSourcePads = m_decodebin->numsrcpads;
+-    GST_OBJECT_UNLOCK(object);
+-
+-    if (numberOfSourcePads) {
+-        GST_DEBUG_OBJECT(m_pipeline.get(), "Discarding additional %" GST_PTR_FORMAT, stream);
+-        return 0;
+-    }
+-
+-    int result = gst_stream_get_stream_type(stream) & GST_STREAM_TYPE_VIDEO ? 1 : 0;
+-    GST_DEBUG_OBJECT(m_pipeline.get(), "%" GST_PTR_FORMAT " selected: %s", stream, boolForPrinting(result));
+-    return result;
+-}
+-
+ void ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback(ImageDecoderGStreamer::InnerDecoder* 
decoder, GstPad* pad)
+ {
+     decoder->connectDecoderPad(pad);
+@@ -336,6 +318,24 @@ void ImageDecoderGStreamer::InnerDecoder::handleMessage(GstMessage* message)
+         g_warning("Error: %d, %s. Debug output: %s", error->code, error->message, debug.get());
+         m_decoder.setHasEOS();
+         break;
++    case GST_MESSAGE_STREAM_COLLECTION: {
++        GRefPtr<GstStreamCollection> collection;
++        gst_message_parse_stream_collection(message, &collection.outPtr());
++        if (collection) {
++            unsigned size = gst_stream_collection_get_size(collection.get());
++            GList* streams = nullptr;
++            for (unsigned i = 0 ; i < size; i++) {
++                auto* stream = gst_stream_collection_get_stream(collection.get(), i);
++                auto streamType = gst_stream_get_stream_type(stream);
++                if (streamType == GST_STREAM_TYPE_VIDEO) {
++                    streams = g_list_append(streams, const_cast<char*>(gst_stream_get_stream_id(stream)));
++                    break;
++                }
++            }
++            gst_element_send_event(m_decodebin.get(), gst_event_new_select_streams(streams));
++        }
++        break;
++    }
+     default:
+         break;
+     }
+@@ -369,9 +369,6 @@ void ImageDecoderGStreamer::InnerDecoder::preparePipeline()
+     g_object_set(source, "stream", m_memoryStream.get(), nullptr);
+ 
+     m_decodebin = gst_element_factory_make("decodebin3", nullptr);
+-    g_signal_connect(m_decodebin.get(), "select-stream", G_CALLBACK(+[](GstElement*, GstStreamCollection*, 
GstStream* stream, ImageDecoderGStreamer::InnerDecoder* decoder) -> int {
+-        return decoder->selectStream(stream);
+-    }), this);
+     g_signal_connect_swapped(m_decodebin.get(), "pad-added", G_CALLBACK(decodebinPadAddedCallback), this);
+ 
+     gst_bin_add_many(GST_BIN_CAST(m_pipeline.get()), source, m_decodebin.get(), nullptr);
+--- a/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.h       
++++ a/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.h       
+@@ -106,7 +106,6 @@ private:
+         static void decodebinPadAddedCallback(ImageDecoderGStreamer::InnerDecoder*, GstPad*);
+         void handleMessage(GstMessage*);
+         void preparePipeline();
+-        int selectStream(GstStream*);
+         void connectDecoderPad(GstPad*);
+ 
+         ImageDecoderGStreamer& m_decoder;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]