Modified: trunk/Source/WebCore/ChangeLog (204408 => 204409)
--- trunk/Source/WebCore/ChangeLog 2016-08-12 09:11:09 UTC (rev 204408)
+++ trunk/Source/WebCore/ChangeLog 2016-08-12 10:35:28 UTC (rev 204409)
@@ -1,3 +1,30 @@
+2016-08-12 Philippe Normand <[email protected]>
+
+ [GStreamer][OWR] Video rendering fixes
+ https://bugs.webkit.org/show_bug.cgi?id=160764
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ The video renderer of OpenWebRTC now uses OpenGL so we have two
+ options to correctly handle this in WebKit:
+
+ - if USE_GSTREAMER_GL is enabled then we simply pass our GL
+ appsink to the renderer and there is no need to create glupload
+ and glcolorconvert element on WebKit side because those elements
+ are already created on OpenWebRTC side.
+ - if USE_GSTREAMER_GL is disabled then we need our sink to download
+ frames from the GPU so that rendering can be done with the WebKit
+ video sink in main memory.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Split out GL appsink management
+ to a separate method that can be used by sub-classes.
+ (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Use new createGLAppSink method.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): handle GStreamer-GL configurations
+ and pass a different element to the renderer depending on the configuration.
+
2016-08-11 Sam Weinig <[email protected]>
Support WebIDL unions (Part 1)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (204408 => 204409)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-08-12 09:11:09 UTC (rev 204408)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-08-12 10:35:28 UTC (rev 204409)
@@ -799,6 +799,22 @@
}
#if USE(GSTREAMER_GL)
+GstElement* MediaPlayerPrivateGStreamerBase::createGLAppSink()
+{
+ if (!webkitGstCheckVersion(1, 8, 0))
+ return nullptr;
+
+ GstElement* appsink = gst_element_factory_make("appsink", "webkit-gl-video-sink");
+ if (!appsink)
+ return nullptr;
+
+ g_object_set(appsink, "enable-last-sample", FALSE, "emit-signals", TRUE, "max-buffers", 1, nullptr);
+ g_signal_connect(appsink, "new-sample", G_CALLBACK(newSampleCallback), this);
+ g_signal_connect(appsink, "new-preroll", G_CALLBACK(newPrerollCallback), this);
+
+ return appsink;
+}
+
GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL()
{
// FIXME: Currently it's not possible to get the video frames and caps using this approach until
@@ -812,8 +828,9 @@
GstElement* videoSink = gst_bin_new(nullptr);
GstElement* upload = gst_element_factory_make("glupload", nullptr);
GstElement* colorconvert = gst_element_factory_make("glcolorconvert", nullptr);
+ GstElement* appsink = createGLAppSink();
- if (!upload || !colorconvert) {
+ if (!appsink || !upload || !colorconvert) {
GST_WARNING("Failed to create GstGL elements");
gst_object_unref(videoSink);
@@ -821,12 +838,12 @@
gst_object_unref(upload);
if (colorconvert)
gst_object_unref(colorconvert);
+ if (appsink)
+ gst_object_unref(appsink);
return nullptr;
}
- GstElement* appsink = gst_element_factory_make("appsink", "webkit-gl-video-sink");
-
gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr);
GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), format = (string) { RGBA }"));
@@ -837,12 +854,7 @@
GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink"));
gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get()));
- g_object_set(appsink, "enable-last-sample", FALSE, "emit-signals", TRUE, "max-buffers", 1, nullptr);
-
- if (result) {
- g_signal_connect(appsink, "new-sample", G_CALLBACK(newSampleCallback), this);
- g_signal_connect(appsink, "new-preroll", G_CALLBACK(newPrerollCallback), this);
- } else {
+ if (!result) {
GST_WARNING("Failed to link GstGL elements");
gst_object_unref(videoSink);
videoSink = nullptr;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (204408 => 204409)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-08-12 09:11:09 UTC (rev 204408)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-08-12 10:35:28 UTC (rev 204409)
@@ -131,6 +131,7 @@
#if USE(GSTREAMER_GL)
static GstFlowReturn newSampleCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
static GstFlowReturn newPrerollCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
+ GstElement* createGLAppSink();
GstElement* createVideoSinkGL();
#endif
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp (204408 => 204409)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2016-08-12 09:11:09 UTC (rev 204408)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2016-08-12 10:35:28 UTC (rev 204409)
@@ -330,7 +330,21 @@
GstElement* MediaPlayerPrivateGStreamerOwr::createVideoSink()
{
- GstElement* sink = MediaPlayerPrivateGStreamerBase::createVideoSink();
+#if USE(GSTREAMER_GL)
+ // No need to create glupload and glcolorconvert here because they are
+ // already created by the video renderer.
+ GstElement* sink = MediaPlayerPrivateGStreamerBase::createGLAppSink();
+ m_videoSink = sink;
+#else
+ GstElement* sink = gst_bin_new(nullptr);
+ GstElement* gldownload = gst_element_factory_make("gldownload", nullptr);
+ GstElement* videoconvert = gst_element_factory_make("videoconvert", nullptr);
+ GstElement* webkitSink = MediaPlayerPrivateGStreamerBase::createVideoSink();
+ gst_bin_add_many(GST_BIN(sink), gldownload, videoconvert, webkitSink, nullptr);
+ gst_element_link_many(gldownload, videoconvert, webkitSink, nullptr);
+ GRefPtr<GstPad> pad = gst_element_get_static_pad(gldownload, "sink");
+ gst_element_add_pad(sink, gst_ghost_pad_new("sink", pad.get()));
+#endif
m_videoRenderer = adoptGRef(owr_gst_video_renderer_new(sink));
// FIXME: Remove hardcoded video dimensions when the rendering performance:
Modified: trunk/Tools/gtk/jhbuild.modules (204408 => 204409)
--- trunk/Tools/gtk/jhbuild.modules 2016-08-12 09:11:09 UTC (rev 204408)
+++ trunk/Tools/gtk/jhbuild.modules 2016-08-12 10:35:28 UTC (rev 204409)
@@ -514,7 +514,7 @@
<dep package="gst-plugins-openwebrtc"/>
<dep package="libnice"/>
</dependencies>
- <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="f511ea1fa79a33fa3d52bfd1c0969c28084aeb35"/>
+ <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="9b18c94a1c5e5cad16f241954613c267cb032c85"/>
</autotools>
<autotools id="llvm"