summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/gstrtpbin.c
diff options
context:
space:
mode:
authorOlivier Crete <tester@tester.ca>2008-04-21 08:26:37 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-11 02:30:34 +0100
commit3c5cf0cd38ac558736197d73bd2a9c0f04f7958c (patch)
treedaeb7b5d77214d5bdd2119eb736f0c41f2d8d64b /gst/rtpmanager/gstrtpbin.c
parent4cc70a0c227836522cf018e13b9dfb537331baa2 (diff)
gst/rtpmanager/gstrtpbin.c: Ref caps when inserting into the cache.
Original commit message from CVS: Patch by: Olivier Crete <tester at tester dot ca> * gst/rtpmanager/gstrtpbin.c: (create_session), (get_pt_map), (new_ssrc_pad_found): Ref caps when inserting into the cache. Don't leak pads. * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_get_clock_rate), (gst_rtp_jitter_buffer_query): Avoid a caps leak. Don't leak refcount in query. * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_get_caps), (gst_rtp_pt_demux_chain): Avoid caps leaks. * gst/rtpmanager/gstrtpsession.c: (source_get_sdes_structure), (gst_rtp_session_init), (return_true), (gst_rtp_session_clear_pt_map), (gst_rtp_session_cache_caps), (gst_rtp_session_clock_rate): Ref caps when inserting into the cache. Fix some more caps leaks. Fixes #528245.
Diffstat (limited to 'gst/rtpmanager/gstrtpbin.c')
-rw-r--r--gst/rtpmanager/gstrtpbin.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c
index cf1983d7..76b806bc 100644
--- a/gst/rtpmanager/gstrtpbin.c
+++ b/gst/rtpmanager/gstrtpbin.c
@@ -460,7 +460,8 @@ create_session (GstRtpBin * rtpbin, gint id)
sess->bin = rtpbin;
sess->session = session;
sess->demux = demux;
- sess->ptmap = g_hash_table_new (NULL, NULL);
+ sess->ptmap = g_hash_table_new_full (NULL, NULL, NULL,
+ (GDestroyNotify) gst_caps_unref);
rtpbin->sessions = g_slist_prepend (rtpbin->sessions, sess);
/* set NTP base or new session */
@@ -584,8 +585,10 @@ get_pt_map (GstRtpBinSession * session, guint pt)
/* first look in the cache */
caps = g_hash_table_lookup (session->ptmap, GINT_TO_POINTER (pt));
- if (caps)
+ if (caps) {
+ gst_caps_ref (caps);
goto done;
+ }
bin = session->bin;
@@ -614,11 +617,11 @@ get_pt_map (GstRtpBinSession * session, guint pt)
GST_DEBUG ("caching pt %d as %" GST_PTR_FORMAT, pt, caps);
- /* store in cache */
- g_hash_table_insert (session->ptmap, GINT_TO_POINTER (pt), caps);
+ /* store in cache, take additional ref */
+ g_hash_table_insert (session->ptmap, GINT_TO_POINTER (pt),
+ gst_caps_ref (caps));
done:
- gst_caps_ref (caps);
GST_RTP_SESSION_UNLOCK (session);
return caps;
@@ -1780,16 +1783,17 @@ new_ssrc_pad_found (GstElement * element, guint ssrc, GstPad * pad,
/* get pad and link */
GST_DEBUG_OBJECT (session->bin, "linking jitterbuffer");
padname = g_strdup_printf ("src_%d", ssrc);
- srcpad = gst_element_get_pad (element, padname);
+ srcpad = gst_element_get_static_pad (element, padname);
g_free (padname);
sinkpad = gst_element_get_static_pad (stream->buffer, "sink");
gst_pad_link (srcpad, sinkpad);
gst_object_unref (sinkpad);
+ gst_object_unref (srcpad);
/* get the RTCP sync pad */
GST_DEBUG_OBJECT (session->bin, "linking sync pad");
padname = g_strdup_printf ("rtcp_src_%d", ssrc);
- srcpad = gst_element_get_pad (element, padname);
+ srcpad = gst_element_get_static_pad (element, padname);
g_free (padname);
gst_pad_link (srcpad, stream->sync_pad);
gst_object_unref (srcpad);