Changeset 231891 in webkit


Ignore:
Timestamp:
May 17, 2018 1:16:40 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer]: Consider GstStream(Collection) as if if was not a GInitiallyUnowned
https://bugs.webkit.org/show_bug.cgi?id=185657

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-05-17
Reviewed by Philippe Normand.

Starting with GStreamer 1.14[1] the reference is sunk at object creation time, making it a normal
GObject in practice, in our GRefPtr template implementation we should just consider GstStream
as if it was a normal GObject and not care about its floating reference state as
the ref is never sunk by anyone before 1.14 though that floating ref is considered
as a hard reference by the GstStreamCollection (leading to assertions/)

The exact same issue happens with GstStreamCollection, so fix it at the same time.

Also do not adoptRef() on the result of gst_stream_collection_get_stream() as this function
is transfer-none.

[1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent

  • platform/graphics/gstreamer/GRefPtrGStreamer.cpp:

(WTF::adoptGRef):
(WTF::refGPtr<GstStream>):
(WTF::refGPtr<GstStreamCollection>):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

(WebCore::MediaPlayerPrivateGStreamer::handleMessage):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231881 r231891  
     12018-05-17  Thibault Saunier  <tsaunier@igalia.com>
     2
     3        [GStreamer]: Consider GstStream(Collection) as if if was not a GInitiallyUnowned
     4        https://bugs.webkit.org/show_bug.cgi?id=185657
     5
     6        Reviewed by Philippe Normand.
     7
     8        Starting with GStreamer 1.14[1] the reference is sunk at object creation time, making it a normal
     9        GObject in practice, in our GRefPtr template implementation we should just consider GstStream
     10        as if it was a normal GObject and not care about its floating reference state as
     11        the ref is never sunk by anyone before 1.14 though that floating ref is considered
     12        as a hard reference by the GstStreamCollection (leading to assertions/)
     13
     14        The exact same issue happens with GstStreamCollection, so fix it at the same time.
     15
     16        Also do not adoptRef() on the result of gst_stream_collection_get_stream() as this function
     17        is transfer-none.
     18
     19        [1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 `gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent`
     20
     21        * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
     22        (WTF::adoptGRef):
     23        (WTF::refGPtr<GstStream>):
     24        (WTF::refGPtr<GstStreamCollection>):
     25        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     26        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
     27
    1282018-05-16  Devin Rousso  <webkit@devinrousso.com>
    229
  • trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp

    r230540 r231891  
    357357template <> GRefPtr<GstStream> adoptGRef(GstStream* ptr)
    358358{
    359     ASSERT(!ptr || !g_object_is_floating(ptr));
    360359    return GRefPtr<GstStream>(ptr, GRefPtrAdopt);
    361360}
     
    364363{
    365364    if (ptr)
    366         gst_object_ref_sink(GST_OBJECT_CAST(ptr));
     365        gst_object_ref(GST_OBJECT_CAST(ptr));
    367366
    368367    return ptr;
     
    377376template <> GRefPtr<GstStreamCollection> adoptGRef(GstStreamCollection* ptr)
    378377{
    379     ASSERT(!ptr || !g_object_is_floating(ptr));
    380378    return GRefPtr<GstStreamCollection>(ptr, GRefPtrAdopt);
    381379}
     
    384382{
    385383    if (ptr)
    386         gst_object_ref_sink(GST_OBJECT_CAST(ptr));
     384        gst_object_ref(GST_OBJECT_CAST(ptr));
    387385
    388386    return ptr;
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r231600 r231891  
    13241324        unsigned length = gst_message_streams_selected_get_size(message);
    13251325        for (unsigned i = 0; i < length; i++) {
    1326             GRefPtr<GstStream> stream = adoptGRef(gst_message_streams_selected_get_stream(message, i));
     1326            GRefPtr<GstStream> stream = gst_message_streams_selected_get_stream(message, i);
    13271327            if (!stream)
    13281328                continue;
     1329
    13291330            GstStreamType type = gst_stream_get_stream_type(stream.get());
    13301331            String streamId(gst_stream_get_stream_id(stream.get()));
Note: See TracChangeset for help on using the changeset viewer.