<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206866] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206866">206866</a></dd>
<dt>Author</dt> <dd>philn@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-06 09:38:48 -0700 (Thu, 06 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerOwrcpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsgtkjhbuildmodules">trunk/Tools/gtk/jhbuild.modules</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-10-05  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [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):
+
</ins><span class="cx"> 2016-10-06  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] Icon service and the IconButton class
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -227,31 +227,41 @@
</span><span class="cx">     const gchar* contextType;
</span><span class="cx">     gst_message_parse_context_type(message, &amp;contextType);
</span><span class="cx"> 
</span><del>-    if (!ensureGstGLContext())
</del><ins>+    GRefPtr&lt;GstContext&gt; elementContext = adoptGRef(requestGLContext(contextType, this));
+    if (!elementContext)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    gst_element_set_context(GST_ELEMENT(message-&gt;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-&gt;ensureGstGLContext())
+        return nullptr;
+
</ins><span class="cx">     if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
</span><del>-        GRefPtr&lt;GstContext&gt; 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-&gt;src), displayContext.get());
-        return true;
</del><ins>+        GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
+        gst_context_set_gl_display(displayContext, player-&gt;gstGLDisplay());
+        return displayContext;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!g_strcmp0(contextType, &quot;gst.gl.app_context&quot;)) {
</span><del>-        GRefPtr&lt;GstContext&gt; appContext = adoptGRef(gst_context_new(&quot;gst.gl.app_context&quot;, TRUE));
-        GstStructure* structure = gst_context_writable_structure(appContext.get());
-        gst_structure_set(structure, &quot;context&quot;, GST_GL_TYPE_CONTEXT, m_glContext.get(), nullptr);
-        gst_element_set_context(GST_ELEMENT(message-&gt;src), appContext.get());
-        return true;
</del><ins>+        GstContext* appContext = gst_context_new(&quot;gst.gl.app_context&quot;, TRUE);
+        GstStructure* structure = gst_context_writable_structure(appContext);
+        gst_structure_set(structure, &quot;context&quot;, GST_GL_TYPE_CONTEXT, player-&gt;gstGLContext(), nullptr);
+        return appContext;
</ins><span class="cx">     }
</span><del>-#else
-    UNUSED_PARAM(message);
-#endif // USE(GSTREAMER_GL)
</del><span class="cx"> 
</span><del>-    return false;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(GSTREAMER_GL)
</del><span class="cx"> bool MediaPlayerPrivateGStreamerBase::ensureGstGLContext()
</span><span class="cx"> {
</span><span class="cx">     if (m_glContext)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><span class="cx">     bool ensureGstGLContext();
</span><ins>+    static GstContext* requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase*);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     bool supportsMuting() const override { return true; }
</span><span class="lines">@@ -133,6 +134,8 @@
</span><span class="cx">     static GstFlowReturn newPrerollCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
</span><span class="cx">     GstElement* createGLAppSink();
</span><span class="cx">     GstElement* createVideoSinkGL();
</span><ins>+    GstGLContext* gstGLContext() const { return m_glContext.get(); }
+    GstGLDisplay* gstGLDisplay() const { return m_glDisplay.get(); }
</ins><span class="cx"> #if USE(CAIRO) &amp;&amp; ENABLE(ACCELERATED_2D_CANVAS)
</span><span class="cx">     GLContext* prepareContextForCairoPaint(GstVideoInfo&amp;, IntSize&amp;, IntSize&amp;);
</span><span class="cx">     bool paintToCairoSurface(cairo_surface_t*, cairo_device_t*, GstVideoInfo&amp;, const IntSize&amp;, const IntSize&amp;, bool);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerOwrcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -355,8 +355,11 @@
</span><span class="cx">     GRefPtr&lt;GstPad&gt; pad = gst_element_get_static_pad(gldownload, &quot;sink&quot;);
</span><span class="cx">     gst_element_add_pad(sink, gst_ghost_pad_new(&quot;sink&quot;, pad.get()));
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx">     m_videoRenderer = adoptGRef(owr_gst_video_renderer_new(sink));
</span><del>-
</del><ins>+#if USE(GSTREAMER_GL)
+    owr_video_renderer_set_request_context_callback(OWR_VIDEO_RENDERER(m_videoRenderer.get()), (OwrVideoRendererRequestContextCallback) MediaPlayerPrivateGStreamerBase::requestGLContext, this, nullptr);
+#endif
</ins><span class="cx">     return sink;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-06 16:20:12 UTC (rev 206865)
+++ trunk/Tools/ChangeLog        2016-10-06 16:38:48 UTC (rev 206866)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-10-05  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2016-10-05  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
</span></span></pre></div>
<a id="trunkToolsgtkjhbuildmodules"></a>
<div class="modfile"><h4>Modified: trunk/Tools/gtk/jhbuild.modules (206865 => 206866)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -514,7 +514,7 @@
</span><span class="cx">       &lt;dep package=&quot;gst-plugins-openwebrtc&quot;/&gt;
</span><span class="cx">       &lt;dep package=&quot;libnice&quot;/&gt;
</span><span class="cx">      &lt;/dependencies&gt;
</span><del>-    &lt;branch repo=&quot;github.com&quot; module=&quot;EricssonResearch/openwebrtc.git&quot; checkoutdir=&quot;openwebrtc&quot; tag=&quot;c997bff14a9389582bc107e2aea7ce77fb700ed9&quot;/&gt;
</del><ins>+    &lt;branch repo=&quot;github.com&quot; module=&quot;EricssonResearch/openwebrtc.git&quot; checkoutdir=&quot;openwebrtc&quot; tag=&quot;0b28b080d61af3adb1f779e693fc029f9c1ad499&quot;/&gt;
</ins><span class="cx">   &lt;/autotools&gt;
</span><span class="cx"> 
</span><span class="cx">   &lt;autotools id=&quot;llvm&quot;
</span></span></pre>
</div>
</div>

</body>
</html>