File webkit2gtk3-old-gstreamer.patch of Package webkit2gtk3.20666

diff -urp webkitgtk-2.32.1.gtk/Source/cmake/GStreamerChecks.cmake webkitgtk-2.32.1.gstreamer/Source/cmake/GStreamerChecks.cmake
--- webkitgtk-2.32.1.gtk/Source/cmake/GStreamerChecks.cmake	2021-02-26 03:57:17.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/cmake/GStreamerChecks.cmake	2021-05-28 03:18:05.149868431 -0500
@@ -28,7 +28,7 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
               list(APPEND GSTREAMER_COMPONENTS audio fft)
           endif ()
 
-          find_package(GStreamer 1.14.0 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
+          find_package(GStreamer 1.8.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 
           if (ENABLE_WEB_AUDIO)
               if (NOT PC_GSTREAMER_AUDIO_FOUND OR NOT PC_GSTREAMER_FFT_FOUND)
@@ -42,17 +42,29 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
               endif ()
           endif ()
 
-          if (USE_GSTREAMER_MPEGTS AND NOT PC_GSTREAMER_MPEGTS_FOUND)
-              message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
+    if (USE_GSTREAMER_MPEGTS)
+        if (NOT PC_GSTREAMER_MPEGTS_FOUND)
+            message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
+        endif ()
           endif ()
 
-          if (USE_GSTREAMER_GL AND NOT PC_GSTREAMER_GL_FOUND)
-              message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
+    if (USE_GSTREAMER_GL)
+        if (PC_GSTREAMER_VERSION VERSION_LESS "1.10")
+            message(FATAL_ERROR "GStreamer 1.10 is needed for USE_GSTREAMER_GL.")
+        else ()
+            if (NOT PC_GSTREAMER_GL_FOUND)
+                message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
+            endif ()
+        endif ()
           endif ()
       endif ()
 endif ()
 
+
 if (ENABLE_MEDIA_STREAM AND ENABLE_WEB_RTC)
+    if (PC_GSTREAMER_VERSION VERSION_LESS "1.12")
+        message(FATAL_ERROR "GStreamer 1.12 is needed for ENABLE_WEB_RTC.")
+    endif ()
     SET_AND_EXPOSE_TO_BUILD(USE_LIBWEBRTC TRUE)
     SET_AND_EXPOSE_TO_BUILD(WEBRTC_WEBKIT_BUILD TRUE)
 else ()
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp	2021-05-28 04:50:41.359578680 -0500
@@ -151,7 +151,7 @@ AudioFileReader::~AudioFileReader()
 
 GstFlowReturn AudioFileReader::handleSample(GstAppSink* sink)
 {
-    auto sample = adoptGRef(gst_app_sink_try_pull_sample(sink, 0));
+    auto sample = adoptGRef(gst_app_sink_pull_sample(sink));
     if (!sample)
         return gst_app_sink_is_eos(sink) ? GST_FLOW_EOS : GST_FLOW_ERROR;
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp	2021-05-10 02:59:16.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp	2021-05-28 10:15:11.467679140 -0500
@@ -167,7 +167,7 @@ void AudioSourceProviderGStreamer::provi
 GstFlowReturn AudioSourceProviderGStreamer::handleSample(GstAppSink* sink, bool isPreroll)
 {
     GST_TRACE("Pulling audio sample from the sink");
-    auto sample = adoptGRef(isPreroll ? gst_app_sink_try_pull_preroll(sink, 0) : gst_app_sink_try_pull_sample(sink, 0));
+    auto sample = adoptGRef(isPreroll ? gst_app_sink_pull_preroll(sink) : gst_app_sink_pull_sample(sink));
     if (!sample)
         return gst_app_sink_is_eos(sink) ? GST_FLOW_EOS : GST_FLOW_ERROR;
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2021-05-10 02:59:16.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2021-05-28 03:18:05.149868431 -0500
@@ -79,6 +79,7 @@ struct _WebKitWebAudioSrcPrivate {
 
     GRefPtr<GstBufferPool> pool;
 
+    bool enableGapBufferSupport;
     bool hasRenderedAudibleFrame { false };
 
     Lock dispatchToRenderThreadLock;
@@ -93,6 +94,11 @@ struct _WebKitWebAudioSrcPrivate {
         sourcePad = webkitGstGhostPadFromStaticTemplate(&srcTemplate, "src", nullptr);
 
         g_rec_mutex_init(&mutex);
+
+        // GAP buffer support is enabled only for GStreamer 1.12.5 because of a
+        // memory leak that was fixed in that version.
+        // https://bugzilla.gnome.org/show_bug.cgi?id=793067
+        enableGapBufferSupport = webkitGstCheckVersion(1, 12, 5);
     }
 
     ~_WebKitWebAudioSrcPrivate()
@@ -375,7 +381,7 @@ static void webKitWebAudioSrcRenderAndPu
         GST_BUFFER_TIMESTAMP(buffer.get()) = outputTimestamp.position.nanoseconds();
         GST_BUFFER_DURATION(buffer.get()) = duration;
 
-        if (priv->bus->channel(i)->isSilent())
+        if (priv->enableGapBufferSupport && priv->bus->channel(i)->isSilent())
             GST_BUFFER_FLAG_SET(buffer.get(), GST_BUFFER_FLAG_GAP);
 
         if (failed)
@@ -429,7 +435,9 @@ static GstStateChangeReturn webKitWebAud
     auto* src = WEBKIT_WEB_AUDIO_SRC(element);
     auto* priv = src->priv;
 
+#if GST_CHECK_VERSION(1, 14, 0)
     GST_DEBUG_OBJECT(element, "%s", gst_state_change_get_name(transition));
+#endif
 
     switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp	2021-05-29 10:56:20.662833652 -0500
@@ -42,6 +42,7 @@ AudioTrackPrivateGStreamer::AudioTrackPr
     m_id = "A" + String::number(index);
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstStream> stream)
     : TrackPrivateBaseGStreamer(this, index, stream)
     , m_player(player)
@@ -56,11 +57,14 @@ AudioTrackPrivateGStreamer::AudioTrackPr
 
     m_id = gst_stream_get_stream_id(stream.get());
 }
+#endif
 
 AudioTrackPrivate::Kind AudioTrackPrivateGStreamer::kind() const
 {
+#if GST_CHECK_VERSION(1, 10, 0)
     if (m_stream.get() && gst_stream_get_stream_flags(m_stream.get()) & GST_STREAM_FLAG_SELECT)
         return AudioTrackPrivate::Kind::Main;
+#endif
 
     return AudioTrackPrivate::kind();
 }
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h	2021-05-28 14:14:47.860549181 -0500
@@ -43,10 +43,12 @@ public:
         return adoptRef(*new AudioTrackPrivateGStreamer(player, index, pad));
     }
 
+#if GST_CHECK_VERSION(1, 10, 0)
     static Ref<AudioTrackPrivateGStreamer> create(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstStream> stream)
     {
         return adoptRef(*new AudioTrackPrivateGStreamer(player, index, stream));
     }
+#endif
 
     Kind kind() const final;
 
@@ -63,7 +65,9 @@ public:
 
 private:
     AudioTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstPad>);
+#if GST_CHECK_VERSION(1, 10, 0)
     AudioTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstStream>);
+#endif
 
     AtomString m_id;
     WeakPtr<MediaPlayerPrivateGStreamer> m_player;
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h	2021-05-28 03:18:05.149868431 -0500
@@ -79,7 +79,7 @@ public:
     const String& systemId() const { return m_systemId; }
     String payloadContainerType() const
     {
-#if GST_CHECK_VERSION(1, 16, 0)
+#if GST_CHECK_VERSION(1, 15, 0)
         if (m_systemId == GST_PROTECTION_UNSPECIFIED_SYSTEM_ID)
             return "webm"_s;
 #endif
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2021-05-05 00:33:24.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2021-05-28 03:18:05.149868431 -0500
@@ -148,7 +148,7 @@ static GstCaps* transformCaps(GstBaseTra
             // GST_PROTECTION_UNSPECIFIED_SYSTEM_ID was added in the GStreamer
             // developement git master which will ship as version 1.16.0.
             gst_structure_set_name(outgoingStructure.get(),
-#if GST_CHECK_VERSION(1, 16, 0)
+#if GST_CHECK_VERSION(1, 15, 0)
                 !g_strcmp0(klass->protectionSystemId(self), GST_PROTECTION_UNSPECIFIED_SYSTEM_ID) ? "application/x-webm-enc" :
 #endif
                 "application/x-cenc");
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-10 02:59:16.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp	2021-05-28 03:18:05.149868431 -0500
@@ -168,7 +168,11 @@ Optional<GRefPtr<GstContext>> requestGLC
     if (!g_strcmp0(contextType, "gst.gl.app_context")) {
         GstContext* appContext = gst_context_new("gst.gl.app_context", TRUE);
         GstStructure* structure = gst_context_writable_structure(appContext);
+#if GST_CHECK_VERSION(1, 12, 0)
         gst_structure_set(structure, "context", GST_TYPE_GL_CONTEXT, gstGLContext, nullptr);
+#else
+        gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, gstGLContext, nullptr);
+#endif
         return adoptGRef(appContext);
     }
 
@@ -189,11 +193,15 @@ static bool setGLContext(GstElement* ele
 
 static GstStateChangeReturn webKitGLVideoSinkChangeState(GstElement* element, GstStateChange transition)
 {
+#if GST_CHECK_VERSION(1, 14, 0)
     GST_DEBUG_OBJECT(element, "%s", gst_state_change_get_name(transition));
+#endif
 
     switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
+#if GST_CHECK_VERSION(1, 14, 0)
     case GST_STATE_CHANGE_READY_TO_READY:
+#endif
     case GST_STATE_CHANGE_READY_TO_PAUSED: {
         if (!setGLContext(element, GST_GL_DISPLAY_CONTEXT_TYPE))
             return GST_STATE_CHANGE_FAILURE;
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp	2021-05-28 14:00:08.187845703 -0500
@@ -378,6 +378,7 @@ template <> void derefGPtr<GstQuery>(Gst
         gst_query_unref(ptr);
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 template <> GRefPtr<GstStream> adoptGRef(GstStream* ptr)
 {
     return GRefPtr<GstStream>(ptr, GRefPtrAdopt);
@@ -415,6 +416,7 @@ template <> void derefGPtr<GstStreamColl
     if (ptr)
         gst_object_unref(ptr);
 }
+#endif
 
 template <>
 GRefPtr<GstClock> adoptGRef(GstClock* ptr)
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h	2021-05-28 03:18:05.153868453 -0500
@@ -116,6 +116,7 @@ GRefPtr<WebKitWebSrc> ensureGRef(WebKitW
 template<> WebKitWebSrc* refGPtr<WebKitWebSrc>(WebKitWebSrc* ptr);
 template<> void derefGPtr<WebKitWebSrc>(WebKitWebSrc* ptr);
 
+#if GST_CHECK_VERSION(1, 10, 0)
 template<> GRefPtr<GstStream> adoptGRef(GstStream*);
 template<> GstStream* refGPtr<GstStream>(GstStream*);
 template<> void derefGPtr<GstStream>(GstStream*);
@@ -123,6 +124,7 @@ template<> void derefGPtr<GstStream>(Gst
 template<> GRefPtr<GstStreamCollection> adoptGRef(GstStreamCollection*);
 template<> GstStreamCollection* refGPtr<GstStreamCollection>(GstStreamCollection*);
 template<> void derefGPtr<GstStreamCollection>(GstStreamCollection*);
+#endif
 
 template<> GRefPtr<GstClock> adoptGRef(GstClock*);
 template<> GstClock* refGPtr<GstClock>(GstClock*);
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -57,8 +57,9 @@ GStreamerAudioMixer::GStreamerAudioMixer
 
 void GStreamerAudioMixer::ensureState(GstStateChange stateChange)
 {
+#if GST_CHECK_VERSION(1, 14, 0)
     GST_DEBUG_OBJECT(m_pipeline.get(), "Handling %s transition (%u mixer pads)", gst_state_change_get_name(stateChange), m_mixer->numsinkpads);
-
+#endif
     switch (stateChange) {
     case GST_STATE_CHANGE_READY_TO_PAUSED:
         gst_element_set_state(m_pipeline.get(), GST_STATE_PAUSED);
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2021-05-05 00:33:24.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -52,7 +52,7 @@
 #include "WebKitMediaSourceGStreamer.h"
 #endif
 
-#if ENABLE(MEDIA_STREAM)
+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1, 10, 0)
 #include "GStreamerMediaStreamSource.h"
 #endif
 
@@ -313,8 +313,9 @@ void registerWebKitGStreamerElements()
         gst_element_register(nullptr, "webkitclearkey", GST_RANK_PRIMARY + 200, WEBKIT_TYPE_MEDIA_CK_DECRYPT);
 #endif
 
-#if ENABLE(MEDIA_STREAM)
-        gst_element_register(nullptr, "mediastreamsrc", GST_RANK_PRIMARY, WEBKIT_TYPE_MEDIA_STREAM_SRC);
+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1, 10, 0)
+        if (webkitGstCheckVersion(1, 10, 0))
+            gst_element_register(nullptr, "mediastreamsrc", GST_RANK_PRIMARY, WEBKIT_TYPE_MEDIA_STREAM_SRC);
 #endif
 
 #if ENABLE(MEDIA_SOURCE)
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp	2021-05-05 00:33:24.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/ImageDecoderGStreamer.cpp	2021-05-28 03:47:11.735207877 -0500
@@ -246,12 +246,12 @@ void ImageDecoderGStreamer::InnerDecoder
     static GstAppSinkCallbacks callbacks = {
         nullptr,
         [](GstAppSink* sink, gpointer userData) -> GstFlowReturn {
-            auto sample = adoptGRef(gst_app_sink_try_pull_preroll(sink, 0));
+            auto sample = adoptGRef(gst_app_sink_pull_preroll(sink));
             static_cast<ImageDecoderGStreamer*>(userData)->notifySample(WTFMove(sample));
             return GST_FLOW_OK;
         },
         [](GstAppSink* sink, gpointer userData) -> GstFlowReturn {
-            auto sample = adoptGRef(gst_app_sink_try_pull_sample(sink, 0));
+            auto sample = adoptGRef(gst_app_sink_pull_sample(sink));
             static_cast<ImageDecoderGStreamer*>(userData)->notifySample(WTFMove(sample));
             return GST_FLOW_OK;
         },
@@ -327,6 +327,7 @@ void ImageDecoderGStreamer::InnerDecoder
         g_warning("Error: %d, %s. Debug output: %s", error->code, error->message, debug.get());
         m_decoder.setHasEOS();
         break;
+#if GST_CHECK_VERSION(1, 10, 0)
     case GST_MESSAGE_STREAM_COLLECTION: {
         GRefPtr<GstStreamCollection> collection;
         gst_message_parse_stream_collection(message, &collection.outPtr());
@@ -339,6 +340,7 @@ void ImageDecoderGStreamer::InnerDecoder
                 if (streamType == GST_STREAM_TYPE_VIDEO) {
                     streams = g_list_append(streams, const_cast<char*>(gst_stream_get_stream_id(stream)));
                     break;
+#endif
                 }
             }
             if (streams) {
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -59,6 +59,7 @@ InbandTextTrackPrivateGStreamer::InbandT
     notifyTrackOfStreamChanged();
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer(gint index, GRefPtr<GstStream> stream)
     : InbandTextTrackPrivate(CueFormat::WebVTT)
     , TrackPrivateBaseGStreamer(this, index, stream)
@@ -71,6 +72,7 @@ InbandTextTrackPrivateGStreamer::InbandT
     const char* mediaType = capsMediaType(caps.get());
     m_kind = g_str_has_prefix(mediaType, "closedcaption/") ? Kind::Captions : Kind::Subtitles;
 }
+#endif
 
 void InbandTextTrackPrivateGStreamer::disconnect()
 {
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h	2021-05-28 03:18:05.153868453 -0500
@@ -44,10 +44,12 @@ public:
         return adoptRef(*new InbandTextTrackPrivateGStreamer(index, pad));
     }
 
+#if GST_CHECK_VERSION(1, 10, 0)
     static Ref<InbandTextTrackPrivateGStreamer> create(gint index, GRefPtr<GstStream> stream)
     {
         return adoptRef(*new InbandTextTrackPrivateGStreamer(index, stream));
     }
+#endif
 
     void disconnect() override;
 
@@ -63,7 +65,9 @@ public:
 
 private:
     InbandTextTrackPrivateGStreamer(gint index, GRefPtr<GstPad>);
+#if GST_CHECK_VERSION(1, 10, 0)
     InbandTextTrackPrivateGStreamer(gint index, GRefPtr<GstStream>);
+#endif
 
     void streamChanged();
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-10 02:59:16.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-05-28 11:20:53.284754904 -0500
@@ -53,7 +53,7 @@
 #include "TextSinkGStreamer.h"
 #include "VideoTrackPrivateGStreamer.h"
 
-#if ENABLE(MEDIA_STREAM)
+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION(1, 10, 0)
 #include "GStreamerMediaStreamSource.h"
 #include "MediaStreamPrivate.h"
 #endif
@@ -134,6 +134,14 @@ using namespace std;
 static const FloatSize s_holePunchDefaultFrameSize(1280, 720);
 #endif
 
+static void convertToInternalProtocol(URL& url)
+{
+    if (webkitGstCheckVersion(1, 12, 0))
+        return;
+    if (url.protocolIsInHTTPFamily() || url.protocolIsBlob())
+        url.setProtocol(makeString("webkit+", url.protocol()));
+}
+
 static void initializeDebugCategory()
 {
     static std::once_flag onceFlag;
@@ -371,6 +379,7 @@ void MediaPlayerPrivateGStreamer::load(c
 #if ENABLE(MEDIA_STREAM)
 void MediaPlayerPrivateGStreamer::load(MediaStreamPrivate& stream)
 {
+#if GST_CHECK_VERSION(1, 10, 0)
     m_streamPrivate = &stream;
     static Atomic<uint32_t> pipelineId;
     auto pipelineName = makeString("mediastream-", pipelineId.exchangeAdd(1));
@@ -379,6 +388,12 @@ void MediaPlayerPrivateGStreamer::load(M
     syncOnClock(false);
 
     m_player->play();
+#else
+    // Properly fail so the global MediaPlayer tries to fallback to the next MediaPlayerPrivate.
+    m_networkState = MediaPlayer::FormatError;
+    m_player->networkStateChanged();
+    notImplemented();
+#endif
 }
 #endif
 
@@ -823,15 +838,20 @@ bool MediaPlayerPrivateGStreamer::hasSin
 
 Optional<bool> MediaPlayerPrivateGStreamer::wouldTaintOrigin(const SecurityOrigin& origin) const
 {
-    GST_TRACE_OBJECT(pipeline(), "Checking %u origins", m_origins.size());
-    for (auto& responseOrigin : m_origins) {
-        if (!origin.isSameOriginDomain(*responseOrigin)) {
-            GST_DEBUG_OBJECT(pipeline(), "Found reachable response origin");
-            return true;
+    if (webkitGstCheckVersion(1, 12, 0)) {
+        GST_TRACE_OBJECT(pipeline(), "Checking %u origins", m_origins.size());
+        for (auto& responseOrigin : m_origins) {
+            if (!origin.isSameOriginDomain(*responseOrigin)) {
+                GST_DEBUG_OBJECT(pipeline(), "Found reachable response origin");
+                return true;
+            }
         }
     }
-    GST_DEBUG_OBJECT(pipeline(), "No valid response origin found");
-    return false;
+
+    // GStreamer < 1.12 has an incomplete uridownloader implementation so we
+    // can't use WebKitWebSrc for adaptive fragments downloading if this
+    // version is detected.
+    return m_hasTaintedOrigin;
 }
 
 void MediaPlayerPrivateGStreamer::simulateAudioInterruption()
@@ -878,7 +898,7 @@ void MediaPlayerPrivateGStreamer::source
     if (WEBKIT_IS_WEB_SRC(m_source.get())) {
         webKitWebSrcSetMediaPlayer(WEBKIT_WEB_SRC_CAST(m_source.get()), m_player, m_referrer);
         g_signal_connect(GST_ELEMENT_PARENT(m_source.get()), "element-added", G_CALLBACK(uriDecodeBinElementAddedCallback), this);
-#if ENABLE(MEDIA_STREAM)
+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION (1, 10, 0)
     } else if (WEBKIT_IS_MEDIA_STREAM_SRC(sourceElement)) {
         auto stream = m_streamPrivate.get();
         ASSERT(stream);
@@ -951,6 +971,7 @@ void MediaPlayerPrivateGStreamer::setPla
         cleanURLString = cleanURLString.substring(0, url.pathEnd());
 
     m_url = URL(URL(), cleanURLString);
+    convertToInternalProtocol(m_url);
     GST_INFO_OBJECT(pipeline(), "Load %s", m_url.string().utf8().data());
     g_object_set(m_pipeline.get(), "uri", m_url.string().utf8().data(), nullptr);
 }
@@ -1441,6 +1462,7 @@ void MediaPlayerPrivateGStreamer::update
 
 void MediaPlayerPrivateGStreamer::playbin3SendSelectStreamsIfAppropriate()
 {
+#if GST_CHECK_VERSION(1, 10, 0)
     ASSERT(!m_isLegacyPlaybin);
 
     bool haveDifferentStreamIds = (m_wantedAudioStreamId != m_currentAudioStreamId || m_wantedVideoStreamId != m_currentVideoStreamId);
@@ -1466,8 +1488,10 @@ void MediaPlayerPrivateGStreamer::playbi
     m_waitingForStreamsSelectedEvent = true;
     gst_element_send_event(m_pipeline.get(), gst_event_new_select_streams(streams));
     g_list_free_full(streams, reinterpret_cast<GDestroyNotify>(g_free));
+#endif
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 void MediaPlayerPrivateGStreamer::updateTracks(const GRefPtr<GstStreamCollection>& streamCollection)
 {
     ASSERT(!m_isLegacyPlaybin);
@@ -1542,6 +1566,7 @@ void MediaPlayerPrivateGStreamer::update
 
     m_player->mediaEngineUpdated();
 }
+#endif // GST_CHECK_VERSION(1, 10, 0)
 
 void MediaPlayerPrivateGStreamer::videoChangedCallback(MediaPlayerPrivateGStreamer* player)
 {
@@ -1561,6 +1586,7 @@ void MediaPlayerPrivateGStreamer::setPip
     m_pipeline = pipeline;
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 void MediaPlayerPrivateGStreamer::handleStreamCollectionMessage(GstMessage* message)
 {
     if (m_isLegacyPlaybin)
@@ -1586,6 +1612,7 @@ void MediaPlayerPrivateGStreamer::handle
             player->updateTracks(collection);
     });
 }
+#endif
 
 bool MediaPlayerPrivateGStreamer::handleNeedContextMessage(GstMessage* message)
 {
@@ -1911,6 +1938,7 @@ void MediaPlayerPrivateGStreamer::handle
             GST_DEBUG_OBJECT(pipeline(), "Processing HTTP headers: %" GST_PTR_FORMAT, structure);
             if (const char* uri = gst_structure_get_string(structure, "uri")) {
                 URL url(URL(), uri);
+                convertToInternalProtocol(url);
                 m_origins.add(SecurityOrigin::create(url));
 
                 if (url != m_url) {
@@ -1949,6 +1977,11 @@ void MediaPlayerPrivateGStreamer::handle
         } else if (gst_structure_has_name(structure, "webkit-network-statistics")) {
             if (gst_structure_get(structure, "read-position", G_TYPE_UINT64, &m_networkReadPosition, "size", G_TYPE_UINT64, &m_httpResponseTotalSize, nullptr))
                 GST_DEBUG_OBJECT(pipeline(), "Updated network read position %" G_GUINT64_FORMAT ", size: %" G_GUINT64_FORMAT, m_networkReadPosition, m_httpResponseTotalSize);
+        } else if (gst_structure_has_name(structure, "adaptive-streaming-statistics")) {
+            if (WEBKIT_IS_WEB_SRC(m_source.get()) && !webkitGstCheckVersion(1, 12, 0)) {
+                if (const char* uri = gst_structure_get_string(structure, "uri"))
+                    m_hasTaintedOrigin = webKitSrcWouldTaintOrigin(WEBKIT_WEB_SRC_CAST(m_source.get()), SecurityOrigin::create(URL(URL(), uri)));
+            }
         } else if (gst_structure_has_name(structure, "GstCacheDownloadComplete")) {
             GST_INFO_OBJECT(pipeline(), "Stream is fully downloaded, stopping monitoring downloading progress.");
             m_fillTimer.stop();
@@ -1960,6 +1993,7 @@ void MediaPlayerPrivateGStreamer::handle
     case GST_MESSAGE_TOC:
         processTableOfContents(message);
         break;
+#if GST_CHECK_VERSION(1, 10, 0)
     case GST_MESSAGE_STREAMS_SELECTED: {
         if (m_isLegacyPlaybin)
             break;
@@ -1990,6 +2024,7 @@ void MediaPlayerPrivateGStreamer::handle
     case GST_MESSAGE_STREAM_COLLECTION:
         handleStreamCollectionMessage(message);
         break;
+#endif
     default:
         GST_DEBUG_OBJECT(pipeline(), "Unhandled GStreamer message type: %s", GST_MESSAGE_TYPE_NAME(message));
         break;
@@ -2590,7 +2625,7 @@ MediaPlayer::SupportsType MediaPlayerPri
 #endif
 
     if (parameters.isMediaStream) {
-#if ENABLE(MEDIA_STREAM)
+#if ENABLE(MEDIA_STREAM) && GST_CHECK_VERSION (1, 10, 0)
         return MediaPlayer::SupportsType::IsSupported;
 #else
         return result;
@@ -2695,9 +2730,11 @@ void MediaPlayerPrivateGStreamer::create
     // MSE doesn't support playbin3. Mediastream requires playbin3. Regular
     // playback can use playbin3 on-demand with the WEBKIT_GST_USE_PLAYBIN3
     // environment variable.
+#if GST_CHECK_VERSION (1, 10, 0)
     const char* usePlaybin3 = g_getenv("WEBKIT_GST_USE_PLAYBIN3");
     if ((!isMediaSource() && usePlaybin3 && equal(usePlaybin3, "1")) || url.protocolIs("mediastream"))
         playbinName = "playbin3";
+#endif
 
     if (m_pipeline) {
         if (!g_strcmp0(GST_OBJECT_NAME(gst_element_get_factory(m_pipeline.get())), playbinName)) {
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-05-05 00:33:24.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-05-28 03:18:05.153868453 -0500
@@ -51,6 +51,16 @@ typedef struct _GstMpegtsSection GstMpeg
 #if USE(LIBEPOXY)
 // Include the <epoxy/gl.h> header before <gst/gl/gl.h>.
 #include <epoxy/gl.h>
+
+// Workaround build issue with RPi userland GLESv2 headers and libepoxy <https://webkit.org/b/185639>
+#if !GST_CHECK_VERSION(1, 14, 0)
+#include <gst/gl/gstglconfig.h>
+#if defined(GST_GL_HAVE_WINDOW_DISPMANX) && GST_GL_HAVE_WINDOW_DISPMANX
+#define __gl2_h_
+#undef GST_GL_HAVE_GLSYNC
+#define GST_GL_HAVE_GLSYNC 1
+#endif
+#endif // !GST_CHECK_VERSION(1, 14, 0)
 #endif // USE(LIBEPOXY)
 
 #define GST_USE_UNSTABLE_API
@@ -244,8 +254,12 @@ protected:
         AudioChanged = 1 << 2,
         VolumeChanged = 1 << 3,
         MuteChanged = 1 << 4,
+#if GST_CHECK_VERSION (1, 10, 0)
         TextChanged = 1 << 5,
         StreamCollectionChanged = 1 << 7
+#else
+        TextChanged = 1 << 5
+#endif
     };
 
     static bool isAvailable();
@@ -445,7 +459,9 @@ private:
     void setPlaybinURL(const URL& urlString);
     void loadFull(const String& url, const String& pipelineName);
 
+#if GST_CHECK_VERSION (1, 10, 0)
     void updateTracks(const GRefPtr<GstStreamCollection>&);
+#endif
     void videoSinkCapsChanged(GstPad*);
     void updateVideoSizeAndOrientationFromCaps(const GstCaps*);
     bool hasFirstVideoSampleReachedSink() const;
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -98,13 +98,21 @@ bool PlatformDisplay::tryEnsureGstGLCont
     if (!contextHandle)
         return false;
 
-    m_gstGLDisplay = adoptGRef(createGstGLDisplay(*this));
+    bool shouldAdoptRef = webkitGstCheckVersion(1, 14, 0);
+
+    if (shouldAdoptRef)
+        m_gstGLDisplay = adoptGRef(createGstGLDisplay(*this));
+    else
+        m_gstGLDisplay = createGstGLDisplay(*this);
     if (!m_gstGLDisplay)
         return false;
 
     GstGLPlatform glPlatform = sharedContext->isEGLContext() ? GST_GL_PLATFORM_EGL : GST_GL_PLATFORM_GLX;
 
-    m_gstGLContext = adoptGRef(gst_gl_context_new_wrapped(m_gstGLDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI));
+    if (shouldAdoptRef)
+        m_gstGLContext = adoptGRef(gst_gl_context_new_wrapped(m_gstGLDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI));
+    else
+        m_gstGLContext = gst_gl_context_new_wrapped(m_gstGLDisplay.get(), reinterpret_cast<guintptr>(contextHandle), glPlatform, glAPI);
 
     // Activate and fill the GStreamer wrapped context with the Webkit's shared one.
     auto* previousActiveContext = GLContext::current();
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -57,6 +57,7 @@ TrackPrivateBaseGStreamer::TrackPrivateB
     tagsChanged();
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer(TrackPrivateBase* owner, gint index, GRefPtr<GstStream> stream)
     : m_notifier(MainThreadNotifier<MainThreadNotification>::create())
     , m_index(index)
@@ -68,6 +69,7 @@ TrackPrivateBaseGStreamer::TrackPrivateB
     // We can't call notifyTrackOfTagsChanged() directly, because we need tagsChanged() to setup m_tags.
     tagsChanged();
 }
+#endif
 
 TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer()
 {
@@ -79,8 +81,10 @@ void TrackPrivateBaseGStreamer::disconne
 {
     m_tags.clear();
 
+#if GST_CHECK_VERSION(1, 10, 0)
     if (m_stream)
         m_stream.clear();
+#endif
 
     m_notifier->cancelPendingNotifications();
 
@@ -105,8 +109,10 @@ void TrackPrivateBaseGStreamer::tagsChan
         else
             tags = adoptGRef(gst_tag_list_new_empty());
     }
+#if GST_CHECK_VERSION(1, 10, 0)
     else if (m_stream)
         tags = adoptGRef(gst_stream_get_tags(m_stream.get()));
+#endif
     else
         tags = adoptGRef(gst_tag_list_new_empty());
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h	2021-05-28 03:18:05.153868453 -0500
@@ -57,14 +57,18 @@ public:
 
     void setIndex(int index) { m_index =  index; }
 
+#if GST_CHECK_VERSION(1, 10, 0)
     GstStream* stream()
     {
         return m_stream.get();
     }
+#endif
 
 protected:
     TrackPrivateBaseGStreamer(TrackPrivateBase* owner, gint index, GRefPtr<GstPad>);
+#if GST_CHECK_VERSION(1, 10, 0)
     TrackPrivateBaseGStreamer(TrackPrivateBase* owner, gint index, GRefPtr<GstStream>);
+#endif
 
     void notifyTrackOfTagsChanged();
 
@@ -79,7 +83,9 @@ protected:
     AtomString m_label;
     AtomString m_language;
     GRefPtr<GstPad> m_pad;
+#if GST_CHECK_VERSION(1, 10, 0)
     GRefPtr<GstStream> m_stream;
+#endif
 
 private:
     bool getLanguageCode(GstTagList* tags, AtomString& value);
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -42,6 +42,7 @@ VideoTrackPrivateGStreamer::VideoTrackPr
     m_id = "V" + String::number(index);
 }
 
+#if GST_CHECK_VERSION(1, 10, 0)
 VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstStream> stream)
     : TrackPrivateBaseGStreamer(this, index, stream)
     , m_player(player)
@@ -64,6 +65,7 @@ VideoTrackPrivate::Kind VideoTrackPrivat
 
     return VideoTrackPrivate::kind();
 }
+#endif
 
 void VideoTrackPrivateGStreamer::disconnect()
 {
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h	2021-05-28 03:18:05.153868453 -0500
@@ -43,13 +43,13 @@ public:
     {
         return adoptRef(*new VideoTrackPrivateGStreamer(player, index, pad));
     }
-
+#if GST_CHECK_VERSION(1, 10, 0)
     static Ref<VideoTrackPrivateGStreamer> create(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstStream> stream)
     {
         return adoptRef(*new VideoTrackPrivateGStreamer(player, index, stream));
     }
-
     Kind kind() const final;
+#endif
 
     void disconnect() override;
 
@@ -64,8 +64,9 @@ public:
 
 private:
     VideoTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstPad>);
+#if GST_CHECK_VERSION(1, 10, 0)
     VideoTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstStream>);
-
+#endif
     AtomString m_id;
     WeakPtr<MediaPlayerPrivateGStreamer> m_player;
 };
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -256,7 +256,9 @@ static GstStateChangeReturn webKitAudioS
     auto* sink = WEBKIT_AUDIO_SINK(element);
     auto* priv = sink->priv;
 
+#if GST_CHECK_VERSION(1, 14, 0)
     GST_DEBUG_OBJECT(sink, "Handling %s transition", gst_state_change_get_name(stateChange));
+#endif
 
     auto& mixer = GStreamerAudioMixer::singleton();
     if (priv->interAudioSink && stateChange == GST_STATE_CHANGE_NULL_TO_READY)
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2021-03-25 10:14:07.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2021-05-28 03:18:05.153868453 -0500
@@ -465,8 +465,12 @@ static GstFlowReturn webKitWebSrcCreate(
     // 1) webKitWebSrcSetMediaPlayer() is called by MediaPlayerPrivateGStreamer by means of hooking playbin's
     //    "source-setup" event. This doesn't work for additional WebKitWebSrc elements created by adaptivedemux.
     //
-    // 2) A GstContext query made here.
-    if (!members->player) {
+    // 2) A GstContext query made here. Because of a bug, this only works in GStreamer >= 1.12.
+    //
+    // As a compatibility workaround, the http: URI protocol is only registered for gst>=1.12; otherwise using
+    // webkit+http:, which is used by MediaPlayerPrivateGStreamer but not by adaptivedemux's additional source
+    // elements, therefore using souphttpsrc instead and not routing traffic through the NetworkProcess.
+    if (webkitGstCheckVersion(1, 12, 0) && !members->player) {
         members.runUnlocked([src, baseSrc]() {
             GRefPtr<GstQuery> query = adoptGRef(gst_query_new_context(WEBKIT_WEB_SRC_PLAYER_CONTEXT_TYPE_NAME));
             if (gst_pad_peer_query(GST_BASE_SRC_PAD(baseSrc), query.get())) {
@@ -859,9 +863,15 @@ static GstURIType webKitWebSrcUriGetType
 const gchar* const* webKitWebSrcGetProtocols(GType)
 {
     static const char* protocols[4];
-    protocols[0] = "http";
-    protocols[1] = "https";
-    protocols[2] = "blob";
+    if (webkitGstCheckVersion(1, 12, 0)) {
+        protocols[0] = "http";
+        protocols[1] = "https";
+        protocols[2] = "blob";
+    } else {
+        protocols[0] = "webkit+http";
+        protocols[1] = "webkit+https";
+        protocols[2] = "webkit+blob";
+    }
     protocols[3] = nullptr;
     return protocols;
 }
@@ -869,6 +879,10 @@ const gchar* const* webKitWebSrcGetProto
 static URL convertPlaybinURI(const char* uriString)
 {
     URL url(URL(), uriString);
+    if (!webkitGstCheckVersion(1, 12, 0)) {
+        ASSERT(url.protocol().substring(0, 7) == "webkit+");
+        url.setProtocol(url.protocol().substring(7).toString());
+    }
     return url;
 }
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/ImageDecoder.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/ImageDecoder.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/graphics/ImageDecoder.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/graphics/ImageDecoder.cpp	2021-05-28 04:07:27.445708464 -0500
@@ -40,10 +40,6 @@
 #include "ImageDecoderAVFObjC.h"
 #endif
 
-#if USE(GSTREAMER) && ENABLE(VIDEO)
-#include "ImageDecoderGStreamer.h"
-#endif
-
 namespace WebCore {
 
 #if ENABLE(GPU_PROCESS) && HAVE(AVASSETREADER)
@@ -100,11 +96,6 @@ RefPtr<ImageDecoder> ImageDecoder::creat
     }
 #endif
 
-#if USE(GSTREAMER) && ENABLE(VIDEO)
-    if (ImageDecoderGStreamer::canDecodeType(mimeType))
-        return ImageDecoderGStreamer::create(data, mimeType, alphaOption, gammaAndColorProfileOption);
-#endif
-
 #if USE(CG)
     return ImageDecoderCG::create(data, alphaOption, gammaAndColorProfileOption);
 #elif USE(DIRECT2D)
@@ -139,11 +130,6 @@ bool ImageDecoder::supportsMediaType(Med
 #endif
 #endif
 
-#if USE(GSTREAMER) && ENABLE(VIDEO)
-    if (ImageDecoderGStreamer::supportsMediaType(type))
-        return true;
-#endif
-
     return false;
 }
 
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/GStreamer.cmake webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/GStreamer.cmake
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/GStreamer.cmake	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/GStreamer.cmake	2021-05-28 04:05:07.732961618 -0500
@@ -15,7 +15,6 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
         platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp
         platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
         platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp
-        platform/graphics/gstreamer/ImageDecoderGStreamer.cpp
         platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
         platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp
         platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -142,13 +141,17 @@ if (ENABLE_VIDEO)
     endif ()
 
     if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
-        list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
-            ${GSTREAMER_CODECPARSERS_INCLUDE_DIRS}
-        )
-        if (NOT USE_GSTREAMER_FULL)
-            list(APPEND WebCore_LIBRARIES
-                ${GSTREAMER_CODECPARSERS_LIBRARIES}
+        if (PC_GSTREAMER_VERSION VERSION_LESS "1.10")
+            message(FATAL_ERROR "GStreamer 1.10 is needed for ENABLE_MEDIA_STREAM or ENABLE_WEB_RTC")
+        else ()
+            list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
+                ${GSTREAMER_CODECPARSERS_INCLUDE_DIRS}
             )
+            if (NOT USE_GSTREAMER_FULL)
+                list(APPEND WebCore_LIBRARIES
+                    ${GSTREAMER_CODECPARSERS_LIBRARIES}
+                )
+            endif ()
         endif ()
     endif ()
 endif ()
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp	2021-05-28 04:48:10.886774110 -0500
@@ -22,7 +22,8 @@
 
 #include "config.h"
 
-#if ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
+#if 0
+
 #include "GStreamerCapturer.h"
 
 #include <gst/app/gstappsink.h>
@@ -184,4 +185,4 @@ void GStreamerCapturer::stop()
 
 } // namespace WebCore
 
-#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
+#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && GST_CHECK_VERSION(1, 10, 0)
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp	2021-05-05 00:33:24.000000000 -0500
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp	2021-05-28 04:49:11.663099071 -0500
@@ -24,7 +24,7 @@
 #include "config.h"
 #include "GStreamerMediaStreamSource.h"
 
-#if ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
+#if 0
 
 #include "AudioTrackPrivate.h"
 #include "GStreamerAudioData.h"
@@ -399,7 +399,9 @@ static void webkitMediaStreamSrcDispose(
 
 static GstStateChangeReturn webkitMediaStreamSrcChangeState(GstElement* element, GstStateChange transition)
 {
+#if GST_CHECK_VERSION(1, 14, 0)
     GST_DEBUG_OBJECT(element, "%s", gst_state_change_get_name(transition));
+#endif
 
     if (transition == GST_STATE_CHANGE_PAUSED_TO_READY)
         stopObservingTracks(WEBKIT_MEDIA_STREAM_SRC(element));
@@ -675,4 +677,4 @@ GstElement* webkitMediaStreamSrcNew()
     return GST_ELEMENT_CAST(g_object_new(webkit_media_stream_src_get_type(), nullptr));
 }
 
-#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
+#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && GST_CHECK_VERSION(1, 10, 0)
diff -urp webkitgtk-2.32.1.gtk/Source/WebCore/platform/MIMETypeRegistry.cpp webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/MIMETypeRegistry.cpp
--- webkitgtk-2.32.1.gtk/Source/WebCore/platform/MIMETypeRegistry.cpp	2021-02-26 03:57:13.000000000 -0600
+++ webkitgtk-2.32.1.gstreamer/Source/WebCore/platform/MIMETypeRegistry.cpp	2021-05-28 04:06:32.649415541 -0500
@@ -58,10 +58,6 @@
 #include "PreviewConverter.h"
 #endif
 
-#if USE(GSTREAMER) && ENABLE(VIDEO)
-#include "ImageDecoderGStreamer.h"
-#endif
-
 namespace WebCore {
 
 const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::supportedImageMIMETypes()
@@ -429,11 +425,6 @@ bool MIMETypeRegistry::isSupportedImageV
         return true;
 #endif
 
-#if USE(GSTREAMER) && ENABLE(VIDEO)
-    if (ImageDecoderGStreamer::supportsContainerType(mimeType))
-        return true;
-#endif
-
     return false;
 }
 
openSUSE Build Service is sponsored by