mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
rtp: fix pad callbacks so they handle when parent goes away
1) We need to lock and get a strong ref to the parent, if still there. 2) If it has gone away, we need to handle that gracefully. This is necessary in order to safely modify a running pipeline. Has been observed when a streaming thread is doing a buffer_alloc() while an application thread sends an event on a pad further downstream, and from within a pad probe (holding STREAM_LOCK) carries out the pipeline plumbing while the streaming thread has its buffer_alloc() in progress.
This commit is contained in:
parent
8ff295a788
commit
f59b985698
2 changed files with 6 additions and 1 deletions
|
@ -481,12 +481,15 @@ gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
|
|||
GstBaseRTPDepayload *filter;
|
||||
GstBaseRTPDepayloadClass *bclass;
|
||||
|
||||
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
||||
filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
|
||||
if (G_UNLIKELY (filter == NULL))
|
||||
return FALSE;
|
||||
|
||||
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
||||
if (bclass->handle_event)
|
||||
res = bclass->handle_event (filter, event);
|
||||
|
||||
gst_object_unref (filter);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -383,6 +383,8 @@ gst_basertppayload_event (GstPad * pad, GstEvent * event)
|
|||
gboolean res;
|
||||
|
||||
basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
|
||||
if (G_UNLIKELY (basertppayload == NULL))
|
||||
return FALSE;
|
||||
basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
|
||||
|
||||
if (basertppayload_class->handle_event) {
|
||||
|
|
Loading…
Reference in a new issue