mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 08:41:07 +00:00
srtpdec: Cleaner stream cleanup
This commit is contained in:
parent
4b89870a58
commit
3bf994eb3b
1 changed files with 10 additions and 7 deletions
|
@ -563,6 +563,12 @@ clear_stream (GstSrtpDecSsrcStream * stream)
|
||||||
g_slice_free (GstSrtpDecSsrcStream, stream);
|
g_slice_free (GstSrtpDecSsrcStream, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
remove_yes (gpointer key, gpointer value, gpointer user_data)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear the policy list
|
/* Clear the policy list
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -575,10 +581,9 @@ gst_srtp_dec_clear_streams (GstSrtpDec * filter)
|
||||||
if (!filter->first_session)
|
if (!filter->first_session)
|
||||||
srtp_dealloc (filter->session);
|
srtp_dealloc (filter->session);
|
||||||
|
|
||||||
nb = g_hash_table_size (filter->streams);
|
if (filter->streams)
|
||||||
g_hash_table_destroy (filter->streams);
|
nb = g_hash_table_foreach_remove (filter->streams, remove_yes, NULL);
|
||||||
|
|
||||||
filter->streams = NULL;
|
|
||||||
filter->first_session = TRUE;
|
filter->first_session = TRUE;
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (filter);
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
@ -940,10 +945,6 @@ gst_srtp_dec_change_state (GstElement * element, GstStateChange transition)
|
||||||
GST_OBJECT_LOCK (filter);
|
GST_OBJECT_LOCK (filter);
|
||||||
|
|
||||||
switch (transition) {
|
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:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
filter->streams = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
filter->streams = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||||
NULL, (GDestroyNotify) clear_stream);
|
NULL, (GDestroyNotify) clear_stream);
|
||||||
|
@ -966,6 +967,8 @@ gst_srtp_dec_change_state (GstElement * element, GstStateChange transition)
|
||||||
gst_srtp_dec_clear_streams (filter);
|
gst_srtp_dec_clear_streams (filter);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
|
g_hash_table_unref (filter->streams);
|
||||||
|
filter->streams = NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue