Login  Register

GST_PAD_PARENT caused seg fault on channel change

classic Classic list List threaded Threaded
3 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

GST_PAD_PARENT caused seg fault on channel change

deeps8us
62 posts
I have a media player application integrated. While doing channel change, after 2-3 times, it was showing segmentation fault. Found the line to be
ts_demux *demux = TS_DEMUX (GST_PAD_PARENT (pad)); returning demux as null.

From some links I saw to use gst_pad_get_parent instead of GST_PAD_PARENT. This solved the seg fault. But I am quite not sure how.  All comments will be very helpful.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GST_PAD_PARENT caused seg fault on channel change

Nicolas Dufresne
104 posts
Le vendredi 07 décembre 2012 à 04:05 -0800, deepthips a écrit :

From some links I saw to use gst_pad_get_parent instead of GST_PAD_PARENT.
This solved the seg fault. But I am quite not sure how.  All comments will
be very helpful.

The main difference is that gst_pad_get_parent() will return a reference on the object (you need to unref it when done). This prevent another thread from freeing the object while you are doing your operations. GST_PAD_PARENT() is normally used when the stream lock is taken, i.e. when the chain function is called.

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: GST_PAD_PARENT caused seg fault on channel change

Olivier Crête-3
266 posts
Where by stream lock, Nicolas means object lock. In case of doubt, use the function, not the macro.

Olivier

Nicolas Dufresne <[hidden email]> wrote:

>Le vendredi 07 décembre 2012 à 04:05 -0800, deepthips a écrit :
>
>>
>> From some links I saw to use gst_pad_get_parent instead of
>> GST_PAD_PARENT.
>> This solved the seg fault. But I am quite not sure how.  All comments
>> will
>> be very helpful.
>
>
>The main difference is that gst_pad_get_parent() will return a
>reference
>on the object (you need to unref it when done). This prevent another
>thread from freeing the object while you are doing your operations.
>GST_PAD_PARENT() is normally used when the stream lock is taken, i.e.
>when the chain function is called.
>
>regards,
>Nicolas
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>gstreamer-devel mailing list
>[hidden email]
>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel