Commit f59b9856 authored by Ole André Vadla Ravnås's avatar Ole André Vadla Ravnås Committed by Sebastian Dröge

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.
parent 8ff295a7
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment