File webkit2gtk3-old-gstreamer.patch of Package webkit2gtk3.28762
diff -urp webkitgtk-2.38.6.orig/Source/cmake/GStreamerChecks.cmake webkitgtk-2.38.6/Source/cmake/GStreamerChecks.cmake
--- webkitgtk-2.38.6.orig/Source/cmake/GStreamerChecks.cmake 2023-01-24 15:39:22.682084800 -0600
+++ webkitgtk-2.38.6/Source/cmake/GStreamerChecks.cmake 2023-04-21 15:38:22.285824796 -0500
@@ -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)
Only in webkitgtk-2.38.6.orig/Source/WebCore/page: Page.h.orig
diff -urp webkitgtk-2.38.6.orig/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2023-02-12 15:31:28.423736000 -0600
+++ webkitgtk-2.38.6/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2023-04-21 15:38:22.289824816 -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()
@@ -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.6.orig/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2022-09-20 03:13:48.420554000 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp 2023-04-21 15:38:22.289824816 -0500
@@ -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.6.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp 2022-08-19 06:14:27.263430600 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GStreamerAudioMixer.cpp 2023-04-21 15:38:22.293824838 -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.38.6.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2023-04-12 16:16:29.791194200 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2023-04-21 15:38:22.293824838 -0500
@@ -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
@@ -791,9 +792,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());
@@ -849,9 +852,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.6.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2023-04-17 02:53:58.232634300 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2023-04-21 15:41:36.190861611 -0500
@@ -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);
}
@@ -1904,6 +1917,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) {
@@ -1942,6 +1956,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_LOG_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();
@@ -2152,6 +2171,7 @@ void MediaPlayerPrivateGStreamer::proces
processTableOfContentsEntry(static_cast<GstTocEntry*>(i->data));
}
+#if 0
void MediaPlayerPrivateGStreamer::configureElement(GstElement* element)
{
#if PLATFORM(BROADCOM) || USE(WESTEROS_SINK)
@@ -2196,6 +2216,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
#if PLATFORM(BROADCOM) || USE(WESTEROS_SINK)
void MediaPlayerPrivateGStreamer::configureElementPlatformQuirks(GstElement* element)
@@ -2857,8 +2878,34 @@ void MediaPlayerPrivateGStreamer::create
g_object_set(m_pipeline.get(), "mute", static_cast<gboolean>(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);
@@ -2919,6 +2966,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 {
@@ -2985,6 +3033,7 @@ void MediaPlayerPrivateGStreamer::config
return GST_PAD_PROBE_OK;
}, this, nullptr);
}
+#endif
bool MediaPlayerPrivateGStreamer::didPassCORSAccessCheck() const
{
@@ -3097,8 +3146,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()) {
@@ -3673,7 +3720,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
@@ -4298,6 +4345,7 @@ WTFLogChannel& MediaPlayerPrivateGStream
}
#endif
+#if 0
std::optional<VideoFrameMetadata> MediaPlayerPrivateGStreamer::videoFrameMetadata()
{
if (m_sampleCount == m_lastVideoFrameMetadataSampleCount)
@@ -4322,6 +4370,7 @@ std::optional<VideoFrameMetadata> MediaP
return metadata;
}
+#endif
static bool areAllSinksPlayingForBin(GstBin* bin)
{
diff -urp webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2023-04-17 02:53:58.232634300 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2023-04-21 15:38:22.305824902 -0500
@@ -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*);
#if PLATFORM(BROADCOM) || USE(WESTEROS_SINK)
void configureElementPlatformQuirks(GstElement*);
@@ -599,9 +608,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.6.orig/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp 2022-08-19 06:14:27.266764000 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp 2023-04-21 15:38:22.305824902 -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.38.6.orig/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp 2022-09-20 03:13:48.433887000 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/WebKitAudioSinkGStreamer.cpp 2023-04-21 15:38:22.309824923 -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.38.6.orig/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2023-01-24 16:52:57.756447000 -0600
+++ webkitgtk-2.38.6/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2023-04-21 15:38:22.309824923 -0500
@@ -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.6.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp webkitgtk-2.38.6/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2023-02-27 16:00:18.532820700 -0600
+++ webkitgtk-2.38.6/Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp 2023-04-21 15:38:22.309824923 -0500
@@ -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.6.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp webkitgtk-2.38.6/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2023-04-12 19:53:55.657508600 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp 2023-04-21 15:38:22.313824945 -0500
@@ -31,7 +31,6 @@
#include "GStreamerCommon.h"
#include "MediaStreamPrivate.h"
#include "VideoFrameGStreamer.h"
-#include "VideoFrameMetadataGStreamer.h"
#include "VideoTrackPrivateMediaStream.h"
#if USE(GSTREAMER_WEBRTC)
@@ -318,17 +317,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();
@@ -342,13 +342,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();
@@ -446,13 +439,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());
}
@@ -467,7 +453,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.6.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp webkitgtk-2.38.6/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp 2022-09-20 03:13:48.550553000 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp 2023-04-21 15:38:22.313824945 -0500
@@ -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.6.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h webkitgtk-2.38.6/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h
--- webkitgtk-2.38.6.orig/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h 2022-08-19 06:14:27.420097400 -0500
+++ webkitgtk-2.38.6/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h 2023-04-21 15:38:22.313824945 -0500
@@ -45,6 +45,8 @@ private:
// rtc::VideoSinkInterface
void OnFrame(const webrtc::VideoFrame&) final;
+ void setCapsFromSettings();
+ GRefPtr<GstCaps> m_caps;
};
} // namespace WebCore
Only in webkitgtk-2.38.6.orig/Source/WebCore/testing: Internals.idl.orig
Only in webkitgtk-2.38.6.orig/Source/WebKit/UIProcess/API/glib: WebKitWebContext.cpp.orig
Only in webkitgtk-2.38.6.orig/Source/WebKit/UIProcess/Launcher/glib: BubblewrapLauncher.cpp.orig
Only in webkitgtk-2.38.6.orig/Source/WebKit/UIProcess: WebPageProxy.cpp.orig
Only in webkitgtk-2.38.6.orig/Source/WebKit/WebProcess/WebPage: WebPage.cpp.orig
Only in webkitgtk-2.38.6.orig/Source/WebKit/WebProcess: WebProcess.cpp.orig
diff -urp webkitgtk-2.38.6.orig/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml webkitgtk-2.38.6/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
--- webkitgtk-2.38.6.orig/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2023-03-16 07:39:29.607694000 -0500
+++ webkitgtk-2.38.6/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2023-04-21 15:38:22.313824945 -0500
@@ -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: