rtp: Unref events if the parent element disappeared or has no event handler implemented

This commit is contained in:
Sebastian Dröge 2011-04-08 15:10:02 +02:00
parent f59b985698
commit 0a1d85c233
2 changed files with 8 additions and 2 deletions

View file

@ -482,12 +482,16 @@ gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
GstBaseRTPDepayloadClass *bclass; GstBaseRTPDepayloadClass *bclass;
filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad)); filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
if (G_UNLIKELY (filter == NULL)) if (G_UNLIKELY (filter == NULL)) {
gst_event_unref (event);
return FALSE; return FALSE;
}
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter); bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
if (bclass->handle_event) if (bclass->handle_event)
res = bclass->handle_event (filter, event); res = bclass->handle_event (filter, event);
else
gst_event_unref (event);
gst_object_unref (filter); gst_object_unref (filter);
return res; return res;

View file

@ -383,8 +383,10 @@ gst_basertppayload_event (GstPad * pad, GstEvent * event)
gboolean res; gboolean res;
basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad)); basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
if (G_UNLIKELY (basertppayload == NULL)) if (G_UNLIKELY (basertppayload == NULL)) {
gst_event_unref (event);
return FALSE; return FALSE;
}
basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload); basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
if (basertppayload_class->handle_event) { if (basertppayload_class->handle_event) {