- Revision
- 206866
- Author
- [email protected]
- Date
- 2016-10-06 09:38:48 -0700 (Thu, 06 Oct 2016)
Log Message
[GStreamer][OWR] GL rendering support
https://bugs.webkit.org/show_bug.cgi?id=162972
Reviewed by Žan Doberšek.
When GStreamer-GL is enabled the GL context needs to be properly passed
to the GStreamer pipeline running within the OpenWebRTC video renderer.
This is now supported using a new OpenWebRTC API that allows the
renderer to request the context from the application using a callback
registered within the renderer.
Source/WebCore:
The player's GL context/display set-up was refactored to a new
method, requestGLContext, which is used as callback for the
OpenWebRTC request_context handler.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
(WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
(WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext):
(WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
(WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink):
Tools:
* gtk/jhbuild.modules: Bump to latest OpenWebRTC for the new
owr_video_renderer_set_request_context_callback API added
recently.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (206865 => 206866)
--- trunk/Source/WebCore/ChangeLog 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Source/WebCore/ChangeLog 2016-10-06 16:38:48 UTC (rev 206866)
@@ -1,3 +1,29 @@
+2016-10-05 Philippe Normand <[email protected]>
+
+ [GStreamer][OWR] GL rendering support
+ https://bugs.webkit.org/show_bug.cgi?id=162972
+
+ Reviewed by Žan Doberšek.
+
+ When GStreamer-GL is enabled the GL context needs to be properly passed
+ to the GStreamer pipeline running within the OpenWebRTC video renderer.
+ This is now supported using a new OpenWebRTC API that allows the
+ renderer to request the context from the application using a callback
+ registered within the renderer.
+
+ The player's GL context/display set-up was refactored to a new
+ method, requestGLContext, which is used as callback for the
+ OpenWebRTC request_context handler.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
+ (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ (WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext):
+ (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink):
+
2016-10-06 Antoine Quint <[email protected]>
[Modern Media Controls] Icon service and the IconButton class
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (206865 => 206866)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2016-10-06 16:38:48 UTC (rev 206866)
@@ -227,31 +227,41 @@
const gchar* contextType;
gst_message_parse_context_type(message, &contextType);
- if (!ensureGstGLContext())
+ GRefPtr<GstContext> elementContext = adoptGRef(requestGLContext(contextType, this));
+ if (!elementContext)
return false;
+ gst_element_set_context(GST_ELEMENT(message->src), elementContext.get());
+ return true;
+#else
+ UNUSED_PARAM(message);
+#endif // USE(GSTREAMER_GL)
+
+ return false;
+}
+
+#if USE(GSTREAMER_GL)
+GstContext* MediaPlayerPrivateGStreamerBase::requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase* player)
+{
+ if (!player->ensureGstGLContext())
+ return nullptr;
+
if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
- GRefPtr<GstContext> displayContext = adoptGRef(gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE));
- gst_context_set_gl_display(displayContext.get(), m_glDisplay.get());
- gst_element_set_context(GST_ELEMENT(message->src), displayContext.get());
- return true;
+ GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
+ gst_context_set_gl_display(displayContext, player->gstGLDisplay());
+ return displayContext;
}
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());
- gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, m_glContext.get(), nullptr);
- gst_element_set_context(GST_ELEMENT(message->src), appContext.get());
- return true;
+ GstContext* appContext = gst_context_new("gst.gl.app_context", TRUE);
+ GstStructure* structure = gst_context_writable_structure(appContext);
+ gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, player->gstGLContext(), nullptr);
+ return appContext;
}
-#else
- UNUSED_PARAM(message);
-#endif // USE(GSTREAMER_GL)
- return false;
+ return nullptr;
}
-#if USE(GSTREAMER_GL)
bool MediaPlayerPrivateGStreamerBase::ensureGstGLContext()
{
if (m_glContext)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (206865 => 206866)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2016-10-06 16:38:48 UTC (rev 206866)
@@ -70,6 +70,7 @@
#if USE(GSTREAMER_GL)
bool ensureGstGLContext();
+ static GstContext* requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase*);
#endif
bool supportsMuting() const override { return true; }
@@ -133,6 +134,8 @@
static GstFlowReturn newPrerollCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
GstElement* createGLAppSink();
GstElement* createVideoSinkGL();
+ GstGLContext* gstGLContext() const { return m_glContext.get(); }
+ GstGLDisplay* gstGLDisplay() const { return m_glDisplay.get(); }
#if USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS)
GLContext* prepareContextForCairoPaint(GstVideoInfo&, IntSize&, IntSize&);
bool paintToCairoSurface(cairo_surface_t*, cairo_device_t*, GstVideoInfo&, const IntSize&, const IntSize&, bool);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp (206865 => 206866)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2016-10-06 16:38:48 UTC (rev 206866)
@@ -355,8 +355,11 @@
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));
-
+#if USE(GSTREAMER_GL)
+ owr_video_renderer_set_request_context_callback(OWR_VIDEO_RENDERER(m_videoRenderer.get()), (OwrVideoRendererRequestContextCallback) MediaPlayerPrivateGStreamerBase::requestGLContext, this, nullptr);
+#endif
return sink;
}
Modified: trunk/Tools/ChangeLog (206865 => 206866)
--- trunk/Tools/ChangeLog 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Tools/ChangeLog 2016-10-06 16:38:48 UTC (rev 206866)
@@ -1,3 +1,20 @@
+2016-10-05 Philippe Normand <[email protected]>
+
+ [GStreamer][OWR] GL rendering support
+ https://bugs.webkit.org/show_bug.cgi?id=162972
+
+ Reviewed by Žan Doberšek.
+
+ When GStreamer-GL is enabled the GL context needs to be properly passed
+ to the GStreamer pipeline running within the OpenWebRTC video renderer.
+ This is now supported using a new OpenWebRTC API that allows the
+ renderer to request the context from the application using a callback
+ registered within the renderer.
+
+ * gtk/jhbuild.modules: Bump to latest OpenWebRTC for the new
+ owr_video_renderer_set_request_context_callback API added
+ recently.
+
2016-10-05 Youenn Fablet <[email protected]>
Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
Modified: trunk/Tools/gtk/jhbuild.modules (206865 => 206866)
--- trunk/Tools/gtk/jhbuild.modules 2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Tools/gtk/jhbuild.modules 2016-10-06 16:38:48 UTC (rev 206866)
@@ -514,7 +514,7 @@
<dep package="gst-plugins-openwebrtc"/>
<dep package="libnice"/>
</dependencies>
- <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="c997bff14a9389582bc107e2aea7ce77fb700ed9"/>
+ <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="0b28b080d61af3adb1f779e693fc029f9c1ad499"/>
</autotools>
<autotools id="llvm"