Changeset 206866 in webkit


Ignore:
Timestamp:
Oct 6, 2016 9:38:48 AM (7 years ago)
Author:
Philippe Normand
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.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206864 r206866  
     12016-10-05  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer][OWR] GL rendering support
     4        https://bugs.webkit.org/show_bug.cgi?id=162972
     5
     6        Reviewed by Žan Doberšek.
     7
     8        When GStreamer-GL is enabled the GL context needs to be properly passed
     9        to the GStreamer pipeline running within the OpenWebRTC video renderer.
     10        This is now supported using a new OpenWebRTC API that allows the
     11        renderer to request the context from the application using a callback
     12        registered within the renderer.
     13
     14        The player's GL context/display set-up was refactored to a new
     15        method, requestGLContext, which is used as callback for the
     16        OpenWebRTC request_context handler.
     17
     18        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     19        (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
     20        (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext):
     21        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
     22        (WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext):
     23        (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
     24        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
     25        (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink):
     26
    1272016-10-06  Antoine Quint  <graouts@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r206863 r206866  
    228228    gst_message_parse_context_type(message, &contextType);
    229229
    230     if (!ensureGstGLContext())
     230    GRefPtr<GstContext> elementContext = adoptGRef(requestGLContext(contextType, this));
     231    if (!elementContext)
    231232        return false;
    232233
    233     if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
    234         GRefPtr<GstContext> displayContext = adoptGRef(gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE));
    235         gst_context_set_gl_display(displayContext.get(), m_glDisplay.get());
    236         gst_element_set_context(GST_ELEMENT(message->src), displayContext.get());
    237         return true;
    238     }
    239 
    240     if (!g_strcmp0(contextType, "gst.gl.app_context")) {
    241         GRefPtr<GstContext> appContext = adoptGRef(gst_context_new("gst.gl.app_context", TRUE));
    242         GstStructure* structure = gst_context_writable_structure(appContext.get());
    243         gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, m_glContext.get(), nullptr);
    244         gst_element_set_context(GST_ELEMENT(message->src), appContext.get());
    245         return true;
    246     }
     234    gst_element_set_context(GST_ELEMENT(message->src), elementContext.get());
     235    return true;
    247236#else
    248237    UNUSED_PARAM(message);
     
    253242
    254243#if USE(GSTREAMER_GL)
     244GstContext* MediaPlayerPrivateGStreamerBase::requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase* player)
     245{
     246    if (!player->ensureGstGLContext())
     247        return nullptr;
     248
     249    if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
     250        GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
     251        gst_context_set_gl_display(displayContext, player->gstGLDisplay());
     252        return displayContext;
     253    }
     254
     255    if (!g_strcmp0(contextType, "gst.gl.app_context")) {
     256        GstContext* appContext = gst_context_new("gst.gl.app_context", TRUE);
     257        GstStructure* structure = gst_context_writable_structure(appContext);
     258        gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, player->gstGLContext(), nullptr);
     259        return appContext;
     260    }
     261
     262    return nullptr;
     263}
     264
    255265bool MediaPlayerPrivateGStreamerBase::ensureGstGLContext()
    256266{
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h

    r206863 r206866  
    7171#if USE(GSTREAMER_GL)
    7272    bool ensureGstGLContext();
     73    static GstContext* requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase*);
    7374#endif
    7475
     
    134135    GstElement* createGLAppSink();
    135136    GstElement* createVideoSinkGL();
     137    GstGLContext* gstGLContext() const { return m_glContext.get(); }
     138    GstGLDisplay* gstGLDisplay() const { return m_glDisplay.get(); }
    136139#if USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS)
    137140    GLContext* prepareContextForCairoPaint(GstVideoInfo&, IntSize&, IntSize&);
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp

    r206204 r206866  
    356356    gst_element_add_pad(sink, gst_ghost_pad_new("sink", pad.get()));
    357357#endif
     358
    358359    m_videoRenderer = adoptGRef(owr_gst_video_renderer_new(sink));
    359 
     360#if USE(GSTREAMER_GL)
     361    owr_video_renderer_set_request_context_callback(OWR_VIDEO_RENDERER(m_videoRenderer.get()), (OwrVideoRendererRequestContextCallback) MediaPlayerPrivateGStreamerBase::requestGLContext, this, nullptr);
     362#endif
    360363    return sink;
    361364}
  • trunk/Tools/ChangeLog

    r206851 r206866  
     12016-10-05  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer][OWR] GL rendering support
     4        https://bugs.webkit.org/show_bug.cgi?id=162972
     5
     6        Reviewed by Žan Doberšek.
     7
     8        When GStreamer-GL is enabled the GL context needs to be properly passed
     9        to the GStreamer pipeline running within the OpenWebRTC video renderer.
     10        This is now supported using a new OpenWebRTC API that allows the
     11        renderer to request the context from the application using a callback
     12        registered within the renderer.
     13
     14        * gtk/jhbuild.modules: Bump to latest OpenWebRTC for the new
     15        owr_video_renderer_set_request_context_callback API added
     16        recently.
     17
    1182016-10-05  Youenn Fablet  <youenn@apple.com>
    219
  • trunk/Tools/gtk/jhbuild.modules

    r205451 r206866  
    515515      <dep package="libnice"/>
    516516     </dependencies>
    517     <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="c997bff14a9389582bc107e2aea7ce77fb700ed9"/>
     517    <branch repo="github.com" module="EricssonResearch/openwebrtc.git" checkoutdir="openwebrtc" tag="0b28b080d61af3adb1f779e693fc029f9c1ad499"/>
    518518  </autotools>
    519519
Note: See TracChangeset for help on using the changeset viewer.