Commit e3fbfa1e authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

rtspsrc: Create send/recv mutexes once, not on every connect()

Also fixes a crash caused by freeing an uninitialized mutex in an error
case.

https://bugzilla.gnome.org//show_bug.cgi?id=784282
parent 6be5331e
......@@ -913,6 +913,9 @@ gst_rtspsrc_init (GstRTSPSrc * src)
src->state = GST_RTSP_STATE_INVALID;
g_mutex_init (&src->conninfo.send_lock);
g_mutex_init (&src->conninfo.recv_lock);
GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_SOURCE);
gst_bin_set_suppressed_flags (GST_BIN (src),
GST_ELEMENT_FLAG_SOURCE | GST_ELEMENT_FLAG_SINK);
......@@ -954,6 +957,9 @@ gst_rtspsrc_finalize (GObject * object)
g_rec_mutex_clear (&rtspsrc->stream_rec_lock);
g_rec_mutex_clear (&rtspsrc->state_rec_lock);
g_mutex_clear (&rtspsrc->conninfo.send_lock);
g_mutex_clear (&rtspsrc->conninfo.recv_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -1652,6 +1658,8 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx,
stream->profile = GST_RTSP_PROFILE_AVP;
stream->ptmap = g_array_new (FALSE, FALSE, sizeof (PtMapItem));
stream->mikey = NULL;
g_mutex_init (&stream->conninfo.send_lock);
g_mutex_init (&stream->conninfo.recv_lock);
g_array_set_clear_func (stream->ptmap, (GDestroyNotify) clear_ptmap_item);
/* collect bandwidth information for this steam. FIXME, configure in the RTP
......@@ -1774,6 +1782,10 @@ gst_rtspsrc_stream_free (GstRTSPSrc * src, GstRTSPStream * stream)
g_object_unref (stream->session);
if (stream->rtx_pt_map)
gst_structure_free (stream->rtx_pt_map);
g_mutex_clear (&stream->conninfo.send_lock);
g_mutex_clear (&stream->conninfo.recv_lock);
g_free (stream);
}
......@@ -4170,9 +4182,6 @@ gst_rtsp_conninfo_connect (GstRTSPSrc * src, GstRTSPConnInfo * info,
}
} while (!info->connected && retry);
g_mutex_init (&info->send_lock);
g_mutex_init (&info->recv_lock);
gst_rtsp_message_unset (&response);
return GST_RTSP_OK;
......@@ -4217,9 +4226,6 @@ gst_rtsp_conninfo_close (GstRTSPSrc * src, GstRTSPConnInfo * info,
gst_rtsp_connection_free (info->connection);
info->connection = NULL;
info->flushing = FALSE;
g_mutex_clear (&info->send_lock);
g_mutex_clear (&info->recv_lock);
}
GST_RTSP_STATE_UNLOCK (src);
return GST_RTSP_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment