RESOLVED FIXED 107445
[gstreamer] MediaPlayerPrivateGStreamer should take ownership of the playbin
https://bugs.webkit.org/show_bug.cgi?id=107445
Summary [gstreamer] MediaPlayerPrivateGStreamer should take ownership of the playbin
Chris Dumez
Reported 2013-01-21 06:38:28 PST
In gstreamer 1.0, gst_element_factory_make() now returns a floating reference [1]. MediaPlayerPrivateGStreamer calls gst_element_factory_make() to create the playbin object but does not take ownership of the object. As a consequence, the object keeps floating until it is unref'd in the MediaPlayerPrivateGStreamer destructor. We should call gst_object_ref_sink() on the playbin object returned by gst_element_factory_make() to effectively take ownership of it. [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make
Attachments
Patch (2.13 KB, patch)
2013-01-21 06:42 PST, Chris Dumez
no flags
Patch (1.99 KB, patch)
2013-01-21 07:01 PST, Chris Dumez
no flags
Patch using a smart pointer (alternative) (22.83 KB, patch)
2013-01-22 02:57 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2013-01-21 06:42:33 PST
Philippe Normand
Comment 2 2013-01-21 06:43:52 PST
How about using an adopted GRefPtr<GstElement>?
Chris Dumez
Comment 3 2013-01-21 06:47:56 PST
(In reply to comment #2) > How about using an adopted GRefPtr<GstElement>? Hmm. We cannot adopt since it is floating. Did I understand correctly that you want to make m_playBin a GRefPtr<GstElement> ? If so, then we need to adopt with gstreamer 0.10 and *not* adopt with gstreamer 1.0. I'm fine with that. However, I will likely need to replace uses to m_playBin everywhere by m_playBin.get(), right?
Philippe Normand
Comment 4 2013-01-21 06:52:05 PST
Comment on attachment 183772 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=183772&action=review Right, Christophe... Well, Martin are you OK with this patch? > Source/WebCore/ChangeLog:17 > +We should call gst_object_ref_sink() on the playbin object returned by gst_element_factory_make() to effectively take ownership of it. Left over?
Chris Dumez
Comment 5 2013-01-21 06:53:39 PST
Comment on attachment 183772 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=183772&action=review >> Source/WebCore/ChangeLog:17 >> +We should call gst_object_ref_sink() on the playbin object returned by gst_element_factory_make() to effectively take ownership of it. > > Left over? Oops.
Chris Dumez
Comment 6 2013-01-21 06:59:55 PST
(In reply to comment #2) > How about using an adopted GRefPtr<GstElement>? Well, I do not mind using a smart pointer if you prefer. However, keep in mind this involves more changes. Also note that we are already doing the following a few lines below: // Take ownership. gst_object_ref_sink(m_videoSinkBin);
Chris Dumez
Comment 7 2013-01-21 07:01:38 PST
Created attachment 183778 [details] Patch Fix changelog (not using smart pointer yet).
Chris Dumez
Comment 8 2013-01-22 02:57:48 PST
Created attachment 183949 [details] Patch using a smart pointer (alternative)
Philippe Normand
Comment 9 2013-01-22 04:30:59 PST
Comment on attachment 183949 [details] Patch using a smart pointer (alternative) LGTM!
WebKit Review Bot
Comment 10 2013-01-22 04:56:51 PST
Comment on attachment 183949 [details] Patch using a smart pointer (alternative) Clearing flags on attachment: 183949 Committed r140414: <http://trac.webkit.org/changeset/140414>
WebKit Review Bot
Comment 11 2013-01-22 04:56:55 PST
All reviewed patches have been landed. Closing bug.
Chris Dumez
Comment 12 2013-01-22 06:19:54 PST
Comment on attachment 183949 [details] Patch using a smart pointer (alternative) View in context: https://bugs.webkit.org/attachment.cgi?id=183949&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1797 > + // In gstreamer 1.0, gst_element_factory_make returns a floating Based on the results on the Qt bots, it seems like the gstreamer 0.10 doc may be wrong and gst_element_factory_make() is returning a floating reference there as well :( I'll upload a fix soon.
Note You need to log in before you can comment on or make changes to this bug.