diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-05-22 01:03:55 +0200 |
---|---|---|
committer | Wim Taymans <wim@metal.(none)> | 2009-05-22 01:03:55 +0200 |
commit | fb59348dbe0dfd5b6cb0596a031e5c437265e85d (patch) | |
tree | c628ab57708f3cedd0ff362b55b679d53f527f1d /gst | |
parent | 4424fd3c93ab2f2b9590a3b0c461c16d01f8a00a (diff) | |
download | gst-plugins-bad-fb59348dbe0dfd5b6cb0596a031e5c437265e85d.tar.gz gst-plugins-bad-fb59348dbe0dfd5b6cb0596a031e5c437265e85d.tar.bz2 gst-plugins-bad-fb59348dbe0dfd5b6cb0596a031e5c437265e85d.zip |
rtpbin: Free session if request pads are released
Free the session when all the request pads are released.
Don't mess with the session list in free_session as it is called from a foreach
on that list.
Set the state of the upstream element to NULL first.
See #561752
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtpmanager/gstrtpbin.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index 075776ee..11cc2dd9 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -554,8 +554,8 @@ free_session (GstRtpBinSession * sess) GST_DEBUG_OBJECT (bin, "freeing session %p", sess); - gst_element_set_state (sess->session, GST_STATE_NULL); gst_element_set_state (sess->demux, GST_STATE_NULL); + gst_element_set_state (sess->session, GST_STATE_NULL); if (sess->recv_rtp_sink != NULL) { gst_element_release_request_pad (sess->session, sess->recv_rtp_sink); @@ -589,8 +589,6 @@ free_session (GstRtpBinSession * sess) g_mutex_free (sess->lock); g_hash_table_destroy (sess->ptmap); - bin->sessions = g_slist_remove (bin->sessions, sess); - g_free (sess); } @@ -2512,6 +2510,13 @@ gst_rtp_bin_release_pad (GstElement * element, GstPad * pad) } else if (session->send_rtcp_src == target) { remove_rtcp (rtpbin, session, pad); } + + /* no more request pads, free the complete session */ + if (session->recv_rtp_sink == NULL && session->recv_rtcp_sink == NULL && + session->send_rtp_sink == NULL && session->send_rtcp_src == NULL) { + rtpbin->sessions = g_slist_remove (rtpbin->sessions, session); + free_session (session); + } GST_RTP_BIN_UNLOCK (rtpbin); gst_object_unref (target); |