diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2013-04-09 21:31:55 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2013-04-09 21:37:25 -0400 |
commit | 3bf994eb3bf068e48a21186be02f292ac5932c20 (patch) | |
tree | 7cc4c3a940a39cf4f303c323efbaa144d8bb114a /ext/srtp | |
parent | 4b89870a5865f59e6dc504dd51c996557ce02657 (diff) |
srtpdec: Cleaner stream cleanup
Diffstat (limited to 'ext/srtp')
-rw-r--r-- | ext/srtp/gstsrtpdec.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/srtp/gstsrtpdec.c b/ext/srtp/gstsrtpdec.c index e30d28a91..c9d0dc08e 100644 --- a/ext/srtp/gstsrtpdec.c +++ b/ext/srtp/gstsrtpdec.c @@ -563,6 +563,12 @@ clear_stream (GstSrtpDecSsrcStream * stream) g_slice_free (GstSrtpDecSsrcStream, stream); } +static gboolean +remove_yes (gpointer key, gpointer value, gpointer user_data) +{ + return TRUE; +} + /* Clear the policy list */ static void @@ -575,10 +581,9 @@ gst_srtp_dec_clear_streams (GstSrtpDec * filter) if (!filter->first_session) srtp_dealloc (filter->session); - nb = g_hash_table_size (filter->streams); - g_hash_table_destroy (filter->streams); + if (filter->streams) + nb = g_hash_table_foreach_remove (filter->streams, remove_yes, NULL); - filter->streams = NULL; filter->first_session = TRUE; GST_OBJECT_UNLOCK (filter); @@ -940,10 +945,6 @@ gst_srtp_dec_change_state (GstElement * element, GstStateChange transition) GST_OBJECT_LOCK (filter); switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - if (!filter->first_session) - gst_srtp_dec_clear_streams (filter); - break; case GST_STATE_CHANGE_READY_TO_PAUSED: filter->streams = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) clear_stream); @@ -966,6 +967,8 @@ gst_srtp_dec_change_state (GstElement * element, GstStateChange transition) gst_srtp_dec_clear_streams (filter); break; case GST_STATE_CHANGE_READY_TO_NULL: + g_hash_table_unref (filter->streams); + filter->streams = NULL; break; default: break; |