diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-04-22 16:25:07 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-05-03 12:03:17 -0400 |
commit | 30844e895122e8dab4a7fde9fbe0e4761a3ffeec (patch) | |
tree | 40467b3fe24491a532c6027ee98cf247a6be5cc1 /gst/rtpmux | |
parent | 50249ce03717eb815d9e5cd6eb3342f7148fa38e (diff) | |
download | gst-plugins-bad-30844e895122e8dab4a7fde9fbe0e4761a3ffeec.tar.gz gst-plugins-bad-30844e895122e8dab4a7fde9fbe0e4761a3ffeec.tar.bz2 gst-plugins-bad-30844e895122e8dab4a7fde9fbe0e4761a3ffeec.zip |
rtpmux: Only free pad private when pad is disposed
Diffstat (limited to 'gst/rtpmux')
-rw-r--r-- | gst/rtpmux/gstrtpmux.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c index 5957f96e..e5bc995b 100644 --- a/gst/rtpmux/gstrtpmux.c +++ b/gst/rtpmux/gstrtpmux.c @@ -85,7 +85,6 @@ static void gst_rtp_mux_finalize (GObject * object); static GstPad *gst_rtp_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name); -static void gst_rtp_mux_release_pad (GstElement * element, GstPad * pad); static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer); static gboolean gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps); static GstCaps *gst_rtp_mux_getcaps (GstPad * pad); @@ -147,7 +146,6 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass) gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_rtp_mux_request_new_pad); - gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_mux_release_pad); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_mux_change_state); klass->chain_func = gst_rtp_mux_chain; @@ -246,6 +244,14 @@ gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ) } static void +free_pad_private (gpointer data, GObject * where_the_object_was) +{ + GstRTPMuxPadPrivate *padpriv = data; + + g_slice_free (GstRTPMuxPadPrivate, padpriv); +} + +static void gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad) { GstRTPMuxClass *klass; @@ -265,6 +271,7 @@ gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad) gst_pad_set_active (sinkpad, TRUE); gst_pad_set_element_private (sinkpad, padpriv); + g_object_weak_ref (sinkpad, free_pad_private, padpriv); /* dd the pad to the element */ gst_element_add_pad (GST_ELEMENT (rtp_mux), sinkpad); @@ -296,18 +303,6 @@ gst_rtp_mux_request_new_pad (GstElement * element, return newpad; } -static void -gst_rtp_mux_release_pad (GstElement * element, GstPad * pad) -{ - GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad); - - if (padpriv) - g_slice_free (GstRTPMuxPadPrivate, padpriv); - gst_pad_set_element_private (pad, NULL); - - gst_element_remove_pad (element, pad); -} - /* Put our own clock-base on the buffer */ static void gst_rtp_mux_readjust_rtp_timestamp (GstRTPMux * rtp_mux, GstPad * pad, |