Changeset 135705 in webkit


Ignore:
Timestamp:
Nov 26, 2012 4:10:28 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer] Floating reference handling fix
https://bugs.webkit.org/show_bug.cgi?id=101349

Patch by Thiago Santos <thiago.sousa.santos@collabora.com> on 2012-11-26
Reviewed by Philippe Normand.

GStreamer 0.10 and 1.0 differ when creating GstGhostPad from pad
templates, the 1.0 doesn't take ownership on the passed
GstPadTemplate, while 0.10 does. So this patch adds a
GStreamerVersioning function to handle this different approach
transparently in Webkit gstreamer elements.

Existing media tests cover this change.

  • platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:

(webkit_web_audio_src_init):

  • platform/graphics/gstreamer/GStreamerVersioning.cpp:

(webkitGstGhostPadFromStaticTemplate):

  • platform/graphics/gstreamer/GStreamerVersioning.h:
  • platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:

(webkit_web_src_init):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r135703 r135705  
     12012-11-26  Thiago Santos  <thiago.sousa.santos@collabora.com>
     2
     3        [GStreamer] Floating reference handling fix
     4        https://bugs.webkit.org/show_bug.cgi?id=101349
     5
     6        Reviewed by Philippe Normand.
     7
     8        GStreamer 0.10 and 1.0 differ when creating GstGhostPad from pad
     9        templates, the 1.0 doesn't take ownership on the passed
     10        GstPadTemplate, while 0.10 does. So this patch adds a
     11        GStreamerVersioning function to handle this different approach
     12        transparently in Webkit gstreamer elements.
     13
     14        Existing media tests cover this change.
     15
     16        * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
     17        (webkit_web_audio_src_init):
     18        * platform/graphics/gstreamer/GStreamerVersioning.cpp:
     19        (webkitGstGhostPadFromStaticTemplate):
     20        * platform/graphics/gstreamer/GStreamerVersioning.h:
     21        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     22        (webkit_web_src_init):
     23
    1242012-11-26  Kentaro Hara  <haraken@chromium.org>
    225
  • trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp

    r131478 r135705  
    2727#include <wtf/gobject/GOwnPtr.h>
    2828#include "GRefPtrGStreamer.h"
     29#include "GStreamerVersioning.h"
    2930#include <gst/audio/multichannel.h>
    3031#include <gst/pbutils/pbutils.h>
     
    179180    new (priv) WebKitWebAudioSourcePrivate();
    180181
    181     GRefPtr<GstPadTemplate> padTemplate = adoptGRef(gst_static_pad_template_get(&srcTemplate));
    182     priv->sourcePad = gst_ghost_pad_new_no_target_from_template("src", padTemplate.get());
     182    priv->sourcePad = webkitGstGhostPadFromStaticTemplate(&srcTemplate, "src", 0);
    183183    gst_element_add_pad(GST_ELEMENT(src), priv->sourcePad);
    184184
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp

    r132081 r135705  
    3333    gst_object_sink(gstObject);
    3434#endif
     35}
     36
     37GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate* staticPadTemplate, const gchar* name, GstPad* target)
     38{
     39    GstPad* pad;
     40    GstPadTemplate* padTemplate = gst_static_pad_template_get(staticPadTemplate);
     41
     42    if (target)
     43        pad = gst_ghost_pad_new_from_template(name, target, padTemplate);
     44    else
     45        pad = gst_ghost_pad_new_no_target_from_template(name, padTemplate);
     46
     47#ifdef GST_API_VERSION_1
     48    gst_object_unref(padTemplate);
     49#endif
     50
     51    return pad;
    3552}
    3653
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h

    r131387 r135705  
    3030
    3131void webkitGstObjectRefSink(GstObject*);
     32GstPad* webkitGstGhostPadFromStaticTemplate(GstStaticPadTemplate*, const gchar* name, GstPad* target);
    3233GRefPtr<GstCaps> webkitGstGetPadCaps(GstPad*);
    3334bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
  • trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r128572 r135705  
    218218static void webkit_web_src_init(WebKitWebSrc* src)
    219219{
    220     GRefPtr<GstPadTemplate> padTemplate = adoptGRef(gst_static_pad_template_get(&srcTemplate));
    221220    WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC_GET_PRIVATE(src);
    222221
     
    238237
    239238    GRefPtr<GstPad> targetPad = adoptGRef(gst_element_get_static_pad(GST_ELEMENT(priv->appsrc), "src"));
    240     priv->srcpad = gst_ghost_pad_new_from_template("src", targetPad.get(), padTemplate.get());
     239    priv->srcpad = webkitGstGhostPadFromStaticTemplate(&srcTemplate, "src", targetPad.get());
    241240
    242241    gst_element_add_pad(GST_ELEMENT(src), priv->srcpad);
Note: See TracChangeset for help on using the changeset viewer.