Changeset 151673 in webkit


Ignore:
Timestamp:
Jun 18, 2013 1:09:55 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer] [texmap] upload a video buffer into the video texture
https://bugs.webkit.org/show_bug.cgi?id=116042

Patch by Víctor Manuel Jáquez Leal <vjaquez@igalia.com> on 2013-06-18
Reviewed by Philippe Normand.

This patch prepares more quickly the texture when the video frame is
already in the GPU memory.

It is done using a new buffer's metadata available in GStreamer 1.2,
and its purpose is to upload buffers into a OpenGL texture.

If the decoder provides buffers with this metadata, the buffer will be
uploaded into the texture used for the video display and it will be
rendered, avoiding a expensive mem copies. This is particularly useful
for Full HD videos, where all the processing and display will be done
in the GPU.

No new tests, covered by existing tests.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
  • platform/graphics/gstreamer/VideoSinkGStreamer.cpp:

(webkitVideoSinkProposeAllocation):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151668 r151673  
     12013-06-18  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
     2
     3        [GStreamer] [texmap] upload a video buffer into the video texture
     4        https://bugs.webkit.org/show_bug.cgi?id=116042
     5
     6        Reviewed by Philippe Normand.
     7
     8        This patch prepares more quickly the texture when the video frame is
     9        already in the GPU memory.
     10
     11        It is done using a new buffer's metadata available in GStreamer 1.2,
     12        and its purpose is to upload buffers into a OpenGL texture.
     13
     14        If the decoder provides buffers with this metadata, the buffer will be
     15        uploaded into the texture used for the video display and it will be
     16        rendered, avoiding a expensive mem copies. This is particularly useful
     17        for Full HD videos, where all the processing and display will be done
     18        in the GPU.
     19
     20        No new tests, covered by existing tests.
     21
     22        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     23        (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
     24        (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
     25        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
     26        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
     27        (webkitVideoSinkProposeAllocation):
     28
    1292013-06-17  Peter Gal  <galpeter@inf.u-szeged.hu>
    230
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r151203 r151673  
    5252#endif
    5353
     54#if GST_CHECK_VERSION(1, 1, 0) && USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
     55#include "TextureMapperGL.h"
     56#endif
     57
    5458GST_DEBUG_CATEGORY(webkit_media_player_debug);
    5559#define GST_CAT_DEFAULT webkit_media_player_debug
     
    340344        m_texture->reset(size);
    341345
     346#if GST_CHECK_VERSION(1, 1, 0)
     347    GstVideoGLTextureUploadMeta* meta;
     348    if ((meta = gst_buffer_get_video_gl_texture_upload_meta(buffer))) {
     349        if (meta->n_textures == 1) { // BRGx & BGRA formats use only one texture.
     350            const BitmapTextureGL* textureGL = static_cast<const BitmapTextureGL*>(m_texture.get());
     351            guint ids[4] = { textureGL->id(), 0, 0, 0 };
     352
     353            if (gst_video_gl_texture_upload_meta_upload(meta, ids)) {
     354                client()->setPlatformLayerNeedsDisplay();
     355                return;
     356            }
     357        }
     358    }
     359#endif
     360
    342361#ifdef GST_API_VERSION_1
    343362    GstMapInfo srcInfo;
     
    348367#endif
    349368
    350     // @TODO: support cropping
    351369    m_texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), size.width() * 4, BitmapTexture::UpdateCannotModifyOriginalImageData);
    352370
  • trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp

    r149250 r151673  
    4242
    4343// CAIRO_FORMAT_RGB24 used to render the video buffers is little/big endian dependant.
     44#ifdef GST_API_VERSION_1
    4445#if G_BYTE_ORDER == G_LITTLE_ENDIAN
    45 #ifndef GST_API_VERSION_1
     46#define GST_CAPS_FORMAT "{ BGRx, BGRA }"
     47#else
     48#define GST_CAPS_FORMAT "{ xRGB, ARGB }"
     49#endif
     50#if GST_CHECK_VERSION(1, 1, 0)
     51#define GST_FEATURED_CAPS GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, GST_CAPS_FORMAT)
     52#else
     53#define GST_FEATURED_CAPS
     54#endif
     55#endif // GST_API_VERSION_1
     56
     57#ifdef GST_API_VERSION_1
     58#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_FEATURED_CAPS ";" GST_VIDEO_CAPS_MAKE(GST_CAPS_FORMAT)
     59#else
     60#if G_BYTE_ORDER == G_LITTLE_ENDIAN
    4661#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_BGRA
    4762#else
    48 #define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA }")
    49 #endif
    50 #else
    51 #ifndef GST_API_VERSION_1
    5263#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_ARGB
    53 #else
    54 #define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_MAKE("{ xRGB, ARGB }")
    55 #endif
    56 #endif
     64#endif
     65#endif // GST_API_VERSION_1
     66
    5767static GstStaticPadTemplate s_sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS(WEBKIT_VIDEO_SINK_PAD_CAPS));
    5868
     
    352362    gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, 0);
    353363    gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE, 0);
     364#if GST_CHECK_VERSION(1, 1, 0)
     365    gst_query_add_allocation_meta(query, GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, 0);
     366#endif
    354367    return TRUE;
    355368}
Note: See TracChangeset for help on using the changeset viewer.