Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15:Update
webkit2gtk3.27317
webkit2gtk3-old-gstreamer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File webkit2gtk3-old-gstreamer.patch of Package webkit2gtk3.27317
diff -urp webkitgtk-2.38.5.orig/Source/cmake/GStreamerChecks.cmake webkitgtk-2.38.5/Source/cmake/GStreamerChecks.cmake --- webkitgtk-2.38.5.orig/Source/cmake/GStreamerChecks.cmake 2023-02-14 03:01:07.457508800 -0600 +++ webkitgtk-2.38.5/Source/cmake/GStreamerChecks.cmake 2023-02-16 08:36:58.853592618 -0600 @@ -36,7 +36,7 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO) list(APPEND GSTREAMER_COMPONENTS webrtc) endif () - find_package(GStreamer 1.14.0 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS}) + find_package(GStreamer 1.10.0 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS}) if (ENABLE_WEB_AUDIO) if (NOT PC_GSTREAMER_AUDIO_FOUND OR NOT PC_GSTREAMER_FFT_FOUND) diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2023-02-14 03:01:07.357508400 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2023-02-16 08:36:58.853592618 -0600 @@ -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() @@ -380,7 +386,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) @@ -439,7 +445,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.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2022-08-31 02:59:56.270519500 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2023-02-16 08:36:58.853592618 -0600 @@ -159,7 +159,11 @@ std::optional<GRefPtr<GstContext>> reque if (!g_strcmp0(contextType, "gst.gl.app_context")) { GRefPtr<GstContext> appContext = adoptGRef(gst_context_new("gst.gl.app_context", TRUE)); GstStructure* structure = gst_context_writable_structure(appContext.get()); +#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 appContext; } @@ -180,11 +184,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.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp 2022-08-31 02:59:56.270519500 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp 2023-02-16 08:36:58.853592618 -0600 @@ -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.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2023-02-14 03:01:07.365508600 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2023-02-16 08:36:58.853592618 -0600 @@ -43,6 +43,7 @@ #include <wtf/Scope.h> #include <wtf/glib/GUniquePtr.h> #include <wtf/glib/RunLoopSourcePriority.h> +#include <wtf/PrintStream.h> #if USE(GSTREAMER_MPEGTS) #define GST_USE_UNSTABLE_API @@ -782,9 +783,11 @@ PlatformVideoColorSpace videoColorSpaceF case GST_VIDEO_COLOR_MATRIX_BT709: colorSpace.matrix = PlatformVideoMatrixCoefficients::Bt709; break; +#if GST_CHECK_VERSION(1, 18, 0) case GST_VIDEO_COLOR_MATRIX_BT601: colorSpace.matrix = PlatformVideoMatrixCoefficients::Bt470bg; break; +#endif default: #ifndef GST_DISABLE_GST_DEBUG GST_WARNING("Unhandled colorspace matrix from %s", colorimetry.get()); @@ -840,9 +843,11 @@ void fillVideoInfoColorimetryFromColorSp case PlatformVideoMatrixCoefficients::Bt709: GST_VIDEO_INFO_COLORIMETRY(info).matrix = GST_VIDEO_COLOR_MATRIX_BT709; break; +#if GST_CHECK_VERSION(1, 18, 0) case PlatformVideoMatrixCoefficients::Bt470bg: GST_VIDEO_INFO_COLORIMETRY(info).matrix = GST_VIDEO_COLOR_MATRIX_BT601; break; +#endif default: break; }; diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2023-02-14 03:01:07.365508600 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -51,7 +51,6 @@ #include "InbandTextTrackPrivateGStreamer.h" #include "TextCombinerGStreamer.h" #include "TextSinkGStreamer.h" -#include "VideoFrameMetadataGStreamer.h" #include "VideoTrackPrivateGStreamer.h" #if ENABLE(MEDIA_STREAM) @@ -148,6 +147,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; @@ -828,15 +835,20 @@ bool MediaPlayerPrivateGStreamer::hasSin std::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() @@ -934,6 +946,7 @@ void MediaPlayerPrivateGStreamer::setPla cleanURLString = cleanURLString.left(url.pathEnd()); m_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); } @@ -1915,6 +1928,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 { String::fromLatin1(uri) }; + convertToInternalProtocol(m_url); m_origins.add(SecurityOrigin::create(url)); if (url != m_url) { @@ -1953,6 +1967,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(), String::fromLatin1(uri)))); + } } else if (gst_structure_has_name(structure, "GstCacheDownloadComplete")) { GST_INFO_OBJECT(pipeline(), "Stream is fully downloaded, stopping monitoring downloading progress."); m_fillTimer.stop(); @@ -2163,6 +2182,7 @@ void MediaPlayerPrivateGStreamer::proces processTableOfContentsEntry(static_cast<GstTocEntry*>(i->data)); } +#if 0 void MediaPlayerPrivateGStreamer::configureElement(GstElement* element) { GUniquePtr<char> elementName(gst_element_get_name(element)); @@ -2201,6 +2221,7 @@ void MediaPlayerPrivateGStreamer::config if (!g_strcmp0(G_OBJECT_TYPE_NAME(G_OBJECT(element)), "GstQueue2")) g_object_set(G_OBJECT(element), "high-watermark", 0.10, nullptr); } +#endif void MediaPlayerPrivateGStreamer::configureDownloadBuffer(GstElement* element) { @@ -2808,8 +2829,34 @@ void MediaPlayerPrivateGStreamer::create g_object_set(m_pipeline.get(), "mute", m_player->muted(), nullptr); - g_signal_connect(GST_BIN_CAST(m_pipeline.get()), "element-setup", G_CALLBACK(+[](GstBin*, GstElement* element, MediaPlayerPrivateGStreamer* player) { - player->configureElement(element); + g_signal_connect(GST_BIN_CAST(m_pipeline.get()), "deep-element-added", G_CALLBACK(+[](GstBin*, GstBin* subBin, GstElement* element, MediaPlayerPrivateGStreamer* player) { + GUniquePtr<char> binName(gst_element_get_name(GST_ELEMENT_CAST(subBin))); + GUniquePtr<char> elementName(gst_element_get_name(element)); + + if (g_str_has_prefix(elementName.get(), "downloadbuffer")) { + player->configureDownloadBuffer(element); + return; + } + + if (g_str_has_prefix(elementName.get(), "uridecodebin")) { + // This will set the multiqueue size to the default value. + g_object_set(element, "buffer-size", 2 * MB, nullptr); + return; + } + + if (!g_str_has_prefix(binName.get(), "decodebin")) + return; + + if (g_str_has_prefix(elementName.get(), "v4l2")) + player->m_videoDecoderPlatform = GstVideoDecoderPlatform::Video4Linux; + else if (g_str_has_prefix(elementName.get(), "imxvpudec")) + player->m_videoDecoderPlatform = GstVideoDecoderPlatform::ImxVPU; + else if (g_str_has_prefix(elementName.get(), "omx")) + player->m_videoDecoderPlatform = GstVideoDecoderPlatform::OpenMAX; + +#if USE(TEXTURE_MAPPER_GL) + player->updateTextureMapperFlags(); +#endif }), this); g_signal_connect_swapped(m_pipeline.get(), "source-setup", G_CALLBACK(sourceSetupCallback), this); @@ -2864,6 +2911,7 @@ void MediaPlayerPrivateGStreamer::config g_object_set(depayloader, "wait-for-keyframe", TRUE, nullptr); } +#if 0 void MediaPlayerPrivateGStreamer::configureVideoDecoder(GstElement* decoder) { auto decoderHasProperty = [&decoder](const char* name) -> bool { @@ -2930,6 +2978,7 @@ void MediaPlayerPrivateGStreamer::config return GST_PAD_PROBE_OK; }, this, nullptr); } +#endif bool MediaPlayerPrivateGStreamer::didPassCORSAccessCheck() const { @@ -3042,8 +3091,6 @@ void MediaPlayerPrivateGStreamer::pushTe if (!GST_IS_SAMPLE(m_sample.get())) return; - ++m_sampleCount; - auto internalCompositingOperation = [this](TextureMapperPlatformLayerProxyGL& proxy, std::unique_ptr<GstVideoFrameHolder>&& frameHolder) { std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer; if (frameHolder->hasMappedTextures()) { @@ -3614,7 +3661,7 @@ void MediaPlayerPrivateGStreamer::flushC { Locker sampleLocker { m_sampleMutex }; - if (m_sample && gst_sample_get_buffer(m_sample.get())) { + if (m_sample) { // Allocate a new copy of the sample which has to be released. The copy is necessary so that // the video dimensions can still be fetched and also for canvas rendering. The release is // necessary because the sample might have been allocated by a hardware decoder and memory @@ -4236,31 +4283,6 @@ WTFLogChannel& MediaPlayerPrivateGStream } #endif -std::optional<VideoFrameMetadata> MediaPlayerPrivateGStreamer::videoFrameMetadata() -{ - if (m_sampleCount == m_lastVideoFrameMetadataSampleCount) - return { }; - - m_lastVideoFrameMetadataSampleCount = m_sampleCount; - - Locker sampleLocker { m_sampleMutex }; - if (!GST_IS_SAMPLE(m_sample.get())) - return { }; - - auto* buffer = gst_sample_get_buffer(m_sample.get()); - auto metadata = webkitGstBufferGetVideoFrameMetadata(buffer); - auto size = naturalSize(); - metadata.width = size.width(); - metadata.height = size.height(); - metadata.presentedFrames = m_sampleCount; - - // FIXME: presentationTime and expectedDisplayTime might not always have the same value, we should try getting more precise values. - metadata.presentationTime = MonotonicTime::now().secondsSinceEpoch().seconds(); - metadata.expectedDisplayTime = metadata.presentationTime; - - return metadata; -} - } #endif // USE(GSTREAMER) diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2023-02-14 03:01:07.365508600 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2023-02-16 08:36:58.857592639 -0600 @@ -54,6 +54,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 @@ -492,7 +502,6 @@ private: static void downloadBufferFileCreatedCallback(MediaPlayerPrivateGStreamer*); void configureDepayloader(GstElement*); - void configureVideoDecoder(GstElement*); void configureElement(GstElement*); void setPlaybinURL(const URL& urlString); @@ -595,9 +604,6 @@ private: DataMutex<TaskAtMediaTimeScheduler> m_TaskAtMediaTimeSchedulerDataMutex; private: - std::optional<VideoFrameMetadata> videoFrameMetadata() final; - uint64_t m_sampleCount { 0 }; - uint64_t m_lastVideoFrameMetadataSampleCount { 0 }; #if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF) GUniquePtr<struct wpe_video_plane_display_dmabuf_source> m_wpeVideoPlaneDisplayDmaBuf; #endif diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp 2022-08-31 02:59:56.274519400 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -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.38.5.orig/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp 2022-08-31 02:59:56.274519400 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -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.38.5.orig/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2023-02-14 03:01:07.369508500 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -467,8 +467,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())) { @@ -870,16 +874,27 @@ 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; } static URL convertPlaybinURI(const char* uriString) { - return URL { String::fromLatin1(uriString) }; + URL url { String::fromLatin1(uriString) }; + if (!webkitGstCheckVersion(1, 12, 0)) { + ASSERT(url.protocol().substring(0, 7) == "webkit+"); + url.setProtocol(url.protocol().substring(7).toString()); + } + return url; } static gchar* webKitWebSrcGetUri(GstURIHandler* handler) diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp webkitgtk-2.38.5/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2023-02-14 03:01:07.377508400 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -129,18 +129,6 @@ GstElement* GStreamerCapturer::createSou g_object_set(m_src.get(), "do-timestamp", TRUE, nullptr); } - if (m_deviceType == CaptureDevice::DeviceType::Camera) { - auto srcPad = adoptGRef(gst_element_get_static_pad(m_src.get(), "src")); - gst_pad_add_probe(srcPad.get(), static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_BUFFER), [](GstPad*, GstPadProbeInfo* info, gpointer) -> GstPadProbeReturn { - VideoFrameTimeMetadata metadata; - metadata.captureTime = MonotonicTime::now().secondsSinceEpoch(); - auto* buffer = GST_PAD_PROBE_INFO_BUFFER(info); - auto* modifiedBuffer = webkitGstBufferSetVideoFrameTimeMetadata(buffer, metadata); - gst_buffer_replace(&buffer, modifiedBuffer); - return GST_PAD_PROBE_OK; - }, nullptr, nullptr); - } - return m_src.get(); } diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp webkitgtk-2.38.5/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2023-02-14 03:01:07.377508400 -0600 +++ webkitgtk-2.38.5/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -31,7 +31,6 @@ #include "GStreamerCommon.h" #include "MediaStreamPrivate.h" #include "VideoFrameGStreamer.h" -#include "VideoFrameMetadataGStreamer.h" #include "VideoTrackPrivateMediaStream.h" #if USE(GSTREAMER_WEBRTC) @@ -68,10 +67,8 @@ GRefPtr<GstTagList> mediaStreamTrackPriv gst_tag_list_add(tagList.get(), GST_TAG_MERGE_APPEND, WEBKIT_MEDIA_TRACK_TAG_KIND, static_cast<int>(VideoTrackPrivate::Kind::Main), nullptr); auto& settings = track->settings(); - if (settings.width()) - gst_tag_list_add(tagList.get(), GST_TAG_MERGE_APPEND, WEBKIT_MEDIA_TRACK_TAG_WIDTH, settings.width(), nullptr); - if (settings.height()) - gst_tag_list_add(tagList.get(), GST_TAG_MERGE_APPEND, WEBKIT_MEDIA_TRACK_TAG_HEIGHT, settings.height(), nullptr); + gst_tag_list_add(tagList.get(), GST_TAG_MERGE_APPEND, WEBKIT_MEDIA_TRACK_TAG_WIDTH, settings.width(), + WEBKIT_MEDIA_TRACK_TAG_HEIGHT, settings.height(), nullptr); } GST_DEBUG("Track tags: %" GST_PTR_FORMAT, tagList.get()); @@ -324,17 +321,18 @@ public: if (!m_parent || !m_isObserving) return; - auto videoFrameSize = videoFrame.presentationSize(); - IntSize captureSize(videoFrameSize.width(), videoFrameSize.height()); + auto* gstSample = static_cast<MediaSampleGStreamer*>(&sample)->platformSample().sample.gstSample; + auto* caps = gst_sample_get_caps(gstSample); + GstVideoInfo info; + gst_video_info_from_caps(&info, caps); - auto settings = m_track.settings(); - m_configuredSize.setWidth(settings.width()); - m_configuredSize.setHeight(settings.height()); - - if (!m_configuredSize.width()) - m_configuredSize.setWidth(captureSize.width()); - if (!m_configuredSize.height()) - m_configuredSize.setHeight(captureSize.height()); + int width = GST_VIDEO_INFO_WIDTH(&info); + int height = GST_VIDEO_INFO_HEIGHT(&info); + if (m_lastKnownSize != IntSize(width, height)) { + m_lastKnownSize.setWidth(width); + m_lastKnownSize.setHeight(height); + updateBlackFrame(caps); + } auto videoRotation = videoFrame.rotation(); bool videoMirrored = videoFrame.isMirrored(); @@ -348,13 +346,6 @@ public: gst_pad_push_event(pad.get(), gst_event_new_tag(gst_tag_list_new(GST_TAG_IMAGE_ORIENTATION, orientation.utf8().data(), nullptr))); } - auto* gstSample = static_cast<VideoFrameGStreamer*>(&videoFrame)->sample(); - if (!m_configuredSize.isEmpty() && m_lastKnownSize != m_configuredSize) { - GST_DEBUG_OBJECT(m_src.get(), "Video size changed from %dx%d to %dx%d", m_lastKnownSize.width(), m_lastKnownSize.height(), m_configuredSize.width(), m_configuredSize.height()); - m_lastKnownSize = m_configuredSize; - updateBlackFrame(); - } - if (!m_blackFrame) updateBlackFrame(); @@ -452,13 +443,6 @@ private: void pushBlackFrame() { GST_TRACE_OBJECT(m_src.get(), "Pushing black video frame"); - VideoFrameTimeMetadata metadata; - metadata.captureTime = MonotonicTime::now().secondsSinceEpoch(); - auto* buffer = webkitGstBufferSetVideoFrameTimeMetadata(gst_sample_get_buffer(m_blackFrame.get()), metadata); - GST_BUFFER_DTS(buffer) = GST_BUFFER_PTS(buffer) = gst_element_get_current_running_time(m_parent); - // TODO: Use gst_sample_set_buffer() after bumping GStreamer dependency to 1.16. - auto* caps = gst_sample_get_caps(m_blackFrame.get()); - m_blackFrame = adoptGRef(gst_sample_new(buffer, caps, nullptr, nullptr)); pushSample(m_blackFrame.get()); } @@ -473,7 +457,6 @@ private: bool m_isObserving { false }; RefPtr<AudioTrackPrivateMediaStream> m_audioTrack; RefPtr<VideoTrackPrivateMediaStream> m_videoTrack; - IntSize m_configuredSize; IntSize m_lastKnownSize; GRefPtr<GstSample> m_blackFrame; GRefPtr<GstSample> m_silentSample; diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp webkitgtk-2.38.5/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp --- webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp 2022-08-31 02:59:56.358520000 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp 2023-02-16 08:36:58.857592639 -0600 @@ -64,7 +64,7 @@ void RealtimeIncomingVideoSourceLibWebRT videoFrameAvailable(VideoFrameGStreamer::createWrappedSample(framebuffer->getSample(), presentationTime, static_cast<VideoFrame::Rotation>(frame.rotation())), { }); } else { auto gstSample = convertLibWebRTCVideoFrameToGStreamerSample(frame); - auto metadata = std::make_optional(metadataFromVideoFrame(frame)); + auto sample = MediaSampleGStreamer::create(WTFMove(gstSample), { }, { }); videoFrameAvailable(VideoFrameGStreamer::create(WTFMove(gstSample), { }, presentationTime, static_cast<VideoFrame::Rotation>(frame.rotation()), false, WTFMove(metadata)), { }); } } diff -urp webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h webkitgtk-2.38.5/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h --- webkitgtk-2.38.5.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h 2022-08-31 02:59:56.358520000 -0500 +++ webkitgtk-2.38.5/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h 2023-02-16 08:36:58.857592639 -0600 @@ -45,6 +45,8 @@ private: // rtc::VideoSinkInterface void OnFrame(const webrtc::VideoFrame&) final; + void setCapsFromSettings(); + GRefPtr<GstCaps> m_caps; }; } // namespace WebCore diff -urp webkitgtk-2.38.5.orig/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml webkitgtk-2.38.5/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml --- webkitgtk-2.38.5.orig/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2022-09-14 06:58:10.404862600 -0500 +++ webkitgtk-2.38.5/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2023-02-16 08:36:58.861592661 -0600 @@ -1274,11 +1274,9 @@ RequestVideoFrameCallbackEnabled: default: false WebKit: "PLATFORM(COCOA) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)" : true - "USE(GSTREAMER)": true default: false WebCore: "PLATFORM(COCOA) && HAVE(AVSAMPLEBUFFERVIDEOOUTPUT)" : true - "USE(GSTREAMER)": true default: false ResizeObserverEnabled:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor