Skip to content
Permalink
Browse files
REGRESSION(r249428): [GStreamer] VP9 video rendered green
https://bugs.webkit.org/show_bug.cgi?id=201422

Patch by Thibault Saunier <tsaunier@igalia.com> on 2019-11-19
Reviewed by Philippe Normand.

Avoid forcing a video conversion in software we end up and make
it happen in GL with a sensibly simpler pipeline, this is possible as
`glcolorconvert` properly setups the converted GL buffers.

Without that patch we are getting "random" not negotiated issues with
MediaStream sources related to the `GLMemory` caps feature during
renegotiation between the software `videoconvert` and our sink.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):

Canonical link: https://commits.webkit.org/217618@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
thiblahute authored and webkit-commit-queue committed Nov 19, 2019
1 parent f2d7339 commit 2da67f3dd10d15933464bb900a149e6cf8c4aaf4
Showing with 31 additions and 19 deletions.
  1. +18 −0 Source/WebCore/ChangeLog
  2. +13 −19 Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
@@ -1,3 +1,21 @@
2019-11-19 Thibault Saunier <tsaunier@igalia.com>

REGRESSION(r249428): [GStreamer] VP9 video rendered green
https://bugs.webkit.org/show_bug.cgi?id=201422

Reviewed by Philippe Normand.

Avoid forcing a video conversion in software we end up and make
it happen in GL with a sensibly simpler pipeline, this is possible as
`glcolorconvert` properly setups the converted GL buffers.

Without that patch we are getting "random" not negotiated issues with
MediaStream sources related to the `GLMemory` caps feature during
renegotiation between the software `videoconvert` and our sink.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):

2019-11-18 John Wilander <wilander@apple.com>

Check if ITP is on before applying third-party cookie blocking
@@ -1200,12 +1200,6 @@ GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL()

gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr);

GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw, format = (string) " GST_GL_CAPS_FORMAT));
gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, nullptr));
g_object_set(appsink, "caps", caps.get(), nullptr);

result &= gst_element_link_many(upload, colorconvert, appsink, nullptr);

// Workaround until we can depend on GStreamer 1.16.2.
// https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/commit/8d32de090554cf29fe359f83aa46000ba658a693
// Forcing a color conversion to RGBA here allows glupload to internally use
@@ -1218,21 +1212,21 @@ GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL()
// and set the WEBKIT_GST_NO_RGBA_CONVERSION environment variable until
// GStreamer 1.16.2 is released.
// See also https://bugs.webkit.org/show_bug.cgi?id=201422
if (webkitGstCheckVersion(1, 16, 2) || getenv("WEBKIT_GST_NO_RGBA_CONVERSION")) {
GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink"));
gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get()));
} else {
GstElement* capsFilter = gst_element_factory_make("capsfilter", nullptr);
GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw, format=RGBA"));
g_object_set(capsFilter, "caps", caps.get(), nullptr);
GRefPtr<GstCaps> caps;
if (webkitGstCheckVersion(1, 16, 2) || getenv("WEBKIT_GST_NO_RGBA_CONVERSION"))
caps = adoptGRef(gst_caps_from_string("video/x-raw, format = (string) " GST_GL_CAPS_FORMAT));
else {
GST_INFO_OBJECT(pipeline(), "Forcing RGBA as GStreamer is not new enough.");
caps = adoptGRef(gst_caps_from_string("video/x-raw, format = (string) RGBA"));
}

gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, nullptr));
g_object_set(appsink, "caps", caps.get(), nullptr);

GstElement* videoconvert = gst_element_factory_make("videoconvert", nullptr);
gst_bin_add_many(GST_BIN_CAST(videoSink), capsFilter, videoconvert, nullptr);
result &= gst_element_link_many(capsFilter, videoconvert, upload, nullptr);
result &= gst_element_link_many(upload, colorconvert, appsink, nullptr);

GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(capsFilter, "sink"));
gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get()));
}
GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink"));
gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get()));

if (!result) {
GST_WARNING("Failed to link GstGL elements");

0 comments on commit 2da67f3

Please sign in to comment.