mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
gst/rtpmanager/: Various leak fixes.
Original commit message from CVS: * gst/rtpmanager/gstrtpbin.c: (create_session), (free_session), (get_client), (free_client), (gst_rtp_bin_associate), (free_stream), (gst_rtp_bin_class_init), (gst_rtp_bin_dispose), (gst_rtp_bin_finalize): * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_class_init), (gst_rtp_jitter_buffer_finalize): * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_release): * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_finalize), (gst_rtp_session_set_property), (gst_rtp_session_chain_recv_rtp), (gst_rtp_session_chain_send_rtp): * gst/rtpmanager/gstrtpssrcdemux.c: (gst_rtp_ssrc_demux_class_init), (gst_rtp_ssrc_demux_dispose): * gst/rtpmanager/rtpsession.c: (rtp_session_finalize): * gst/rtpmanager/rtpsession.h: Various leak fixes.
This commit is contained in:
parent
919deb4490
commit
a93348cc6d
7 changed files with 108 additions and 12 deletions
|
@ -245,6 +245,8 @@ static guint gst_rtp_bin_signals[LAST_SIGNAL] = { 0 };
|
||||||
static GstCaps *pt_map_requested (GstElement * element, guint pt,
|
static GstCaps *pt_map_requested (GstElement * element, guint pt,
|
||||||
GstRtpBinSession * session);
|
GstRtpBinSession * session);
|
||||||
|
|
||||||
|
static void free_stream (GstRtpBinStream * stream);
|
||||||
|
|
||||||
/* Manages the RTP stream for one SSRC.
|
/* Manages the RTP stream for one SSRC.
|
||||||
*
|
*
|
||||||
* We pipe the stream (comming from the SSRC demuxer) into a jitterbuffer.
|
* We pipe the stream (comming from the SSRC demuxer) into a jitterbuffer.
|
||||||
|
@ -462,6 +464,30 @@ no_demux:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_session (GstRtpBinSession * sess)
|
||||||
|
{
|
||||||
|
GstRtpBin *bin;
|
||||||
|
|
||||||
|
bin = sess->bin;
|
||||||
|
|
||||||
|
gst_element_set_state (sess->session, GST_STATE_NULL);
|
||||||
|
gst_element_set_state (sess->demux, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_bin_remove (GST_BIN_CAST (bin), sess->session);
|
||||||
|
gst_bin_remove (GST_BIN_CAST (bin), sess->demux);
|
||||||
|
|
||||||
|
g_slist_foreach (sess->streams, (GFunc) free_stream, NULL);
|
||||||
|
g_slist_free (sess->streams);
|
||||||
|
|
||||||
|
g_mutex_free (sess->lock);
|
||||||
|
g_hash_table_destroy (sess->ptmap);
|
||||||
|
|
||||||
|
bin->sessions = g_slist_remove (bin->sessions, sess);
|
||||||
|
|
||||||
|
g_free (sess);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static GstRtpBinStream *
|
static GstRtpBinStream *
|
||||||
find_stream_by_ssrc (GstRtpBinSession * session, guint32 ssrc)
|
find_stream_by_ssrc (GstRtpBinSession * session, guint32 ssrc)
|
||||||
|
@ -565,8 +591,7 @@ gst_rtp_bin_clear_pt_map (GstRtpBin * bin)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstRtpBinClient *
|
static GstRtpBinClient *
|
||||||
gst_rtp_bin_get_client (GstRtpBin * bin, guint8 len, guint8 * data,
|
get_client (GstRtpBin * bin, guint8 len, guint8 * data, gboolean * created)
|
||||||
gboolean * created)
|
|
||||||
{
|
{
|
||||||
GstRtpBinClient *result = NULL;
|
GstRtpBinClient *result = NULL;
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
@ -598,6 +623,14 @@ gst_rtp_bin_get_client (GstRtpBin * bin, guint8 len, guint8 * data,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_client (GstRtpBinClient * client, GstRtpBin * bin)
|
||||||
|
{
|
||||||
|
bin->clients = g_slist_remove (bin->clients, client);
|
||||||
|
g_free (client->cname);
|
||||||
|
g_free (client);
|
||||||
|
}
|
||||||
|
|
||||||
/* associate a stream to the given CNAME. This will make sure all streams for
|
/* associate a stream to the given CNAME. This will make sure all streams for
|
||||||
* that CNAME are synchronized together. */
|
* that CNAME are synchronized together. */
|
||||||
static void
|
static void
|
||||||
|
@ -609,7 +642,7 @@ gst_rtp_bin_associate (GstRtpBin * bin, GstRtpBinStream * stream, guint8 len,
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
/* first find or create the CNAME */
|
/* first find or create the CNAME */
|
||||||
client = gst_rtp_bin_get_client (bin, len, data, &created);
|
client = get_client (bin, len, data, &created);
|
||||||
|
|
||||||
/* find stream in the client */
|
/* find stream in the client */
|
||||||
for (walk = client->streams; walk; walk = g_slist_next (walk)) {
|
for (walk = client->streams; walk; walk = g_slist_next (walk)) {
|
||||||
|
@ -898,7 +931,28 @@ no_demux:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_stream (GstRtpBinStream * stream)
|
||||||
|
{
|
||||||
|
GstRtpBinSession *session;
|
||||||
|
|
||||||
|
session = stream->session;
|
||||||
|
|
||||||
|
gst_element_set_state (stream->buffer, GST_STATE_NULL);
|
||||||
|
gst_element_set_state (stream->demux, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_bin_remove (GST_BIN_CAST (session->bin), stream->buffer);
|
||||||
|
gst_bin_remove (GST_BIN_CAST (session->bin), stream->demux);
|
||||||
|
|
||||||
|
gst_object_unref (stream->sync_pad);
|
||||||
|
|
||||||
|
session->streams = g_slist_remove (session->streams, stream);
|
||||||
|
|
||||||
|
g_free (stream);
|
||||||
|
}
|
||||||
|
|
||||||
/* GObject vmethods */
|
/* GObject vmethods */
|
||||||
|
static void gst_rtp_bin_dispose (GObject * object);
|
||||||
static void gst_rtp_bin_finalize (GObject * object);
|
static void gst_rtp_bin_finalize (GObject * object);
|
||||||
static void gst_rtp_bin_set_property (GObject * object, guint prop_id,
|
static void gst_rtp_bin_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
|
@ -951,6 +1005,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GstRtpBinPrivate));
|
g_type_class_add_private (klass, sizeof (GstRtpBinPrivate));
|
||||||
|
|
||||||
|
gobject_class->dispose = gst_rtp_bin_dispose;
|
||||||
gobject_class->finalize = gst_rtp_bin_finalize;
|
gobject_class->finalize = gst_rtp_bin_finalize;
|
||||||
gobject_class->set_property = gst_rtp_bin_set_property;
|
gobject_class->set_property = gst_rtp_bin_set_property;
|
||||||
gobject_class->get_property = gst_rtp_bin_get_property;
|
gobject_class->get_property = gst_rtp_bin_get_property;
|
||||||
|
@ -1086,6 +1141,21 @@ gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass)
|
||||||
rtpbin->latency = DEFAULT_LATENCY_MS;
|
rtpbin->latency = DEFAULT_LATENCY_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtp_bin_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
GstRtpBin *rtpbin;
|
||||||
|
|
||||||
|
rtpbin = GST_RTP_BIN (object);
|
||||||
|
|
||||||
|
g_slist_foreach (rtpbin->sessions, (GFunc) free_session, NULL);
|
||||||
|
g_slist_foreach (rtpbin->clients, (GFunc) free_client, NULL);
|
||||||
|
g_slist_free (rtpbin->sessions);
|
||||||
|
rtpbin->sessions = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_bin_finalize (GObject * object)
|
gst_rtp_bin_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
@ -1094,6 +1164,8 @@ gst_rtp_bin_finalize (GObject * object)
|
||||||
rtpbin = GST_RTP_BIN (object);
|
rtpbin = GST_RTP_BIN (object);
|
||||||
|
|
||||||
g_mutex_free (rtpbin->priv->bin_lock);
|
g_mutex_free (rtpbin->priv->bin_lock);
|
||||||
|
gst_object_unref (rtpbin->provided_clock);
|
||||||
|
g_slist_free (rtpbin->sessions);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void gst_rtp_jitter_buffer_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_rtp_jitter_buffer_get_property (GObject * object,
|
static void gst_rtp_jitter_buffer_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||||
static void gst_rtp_jitter_buffer_dispose (GObject * object);
|
static void gst_rtp_jitter_buffer_finalize (GObject * object);
|
||||||
|
|
||||||
/* element overrides */
|
/* element overrides */
|
||||||
static GstStateChangeReturn gst_rtp_jitter_buffer_change_state (GstElement
|
static GstStateChangeReturn gst_rtp_jitter_buffer_change_state (GstElement
|
||||||
|
@ -256,7 +256,7 @@ gst_rtp_jitter_buffer_class_init (GstRtpJitterBufferClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GstRtpJitterBufferPrivate));
|
g_type_class_add_private (klass, sizeof (GstRtpJitterBufferPrivate));
|
||||||
|
|
||||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_dispose);
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_finalize);
|
||||||
|
|
||||||
gobject_class->set_property = gst_rtp_jitter_buffer_set_property;
|
gobject_class->set_property = gst_rtp_jitter_buffer_set_property;
|
||||||
gobject_class->get_property = gst_rtp_jitter_buffer_get_property;
|
gobject_class->get_property = gst_rtp_jitter_buffer_get_property;
|
||||||
|
@ -370,17 +370,18 @@ gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_jitter_buffer_dispose (GObject * object)
|
gst_rtp_jitter_buffer_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstRtpJitterBuffer *jitterbuffer;
|
GstRtpJitterBuffer *jitterbuffer;
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (object);
|
jitterbuffer = GST_RTP_JITTER_BUFFER (object);
|
||||||
if (jitterbuffer->priv->jbuf) {
|
|
||||||
g_object_unref (jitterbuffer->priv->jbuf);
|
|
||||||
jitterbuffer->priv->jbuf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
g_mutex_free (jitterbuffer->priv->jbuf_lock);
|
||||||
|
g_cond_free (jitterbuffer->priv->jbuf_cond);
|
||||||
|
|
||||||
|
g_object_unref (jitterbuffer->priv->jbuf);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -415,6 +415,7 @@ gst_rtp_pt_demux_release (GstElement * element)
|
||||||
|
|
||||||
if (ptdemux) {
|
if (ptdemux) {
|
||||||
/* note: GstElement's dispose() will handle the pads */
|
/* note: GstElement's dispose() will handle the pads */
|
||||||
|
g_slist_foreach (ptdemux->srcpads, (GFunc) g_free, NULL);
|
||||||
g_slist_free (ptdemux->srcpads);
|
g_slist_free (ptdemux->srcpads);
|
||||||
ptdemux->srcpads = NULL;
|
ptdemux->srcpads = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,6 +515,8 @@ gst_rtp_session_finalize (GObject * object)
|
||||||
GstRtpSession *rtpsession;
|
GstRtpSession *rtpsession;
|
||||||
|
|
||||||
rtpsession = GST_RTP_SESSION (object);
|
rtpsession = GST_RTP_SESSION (object);
|
||||||
|
|
||||||
|
g_hash_table_destroy (rtpsession->priv->ptmap);
|
||||||
g_mutex_free (rtpsession->priv->lock);
|
g_mutex_free (rtpsession->priv->lock);
|
||||||
g_object_unref (rtpsession->priv->session);
|
g_object_unref (rtpsession->priv->session);
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ GST_BOILERPLATE (GstRtpSsrcDemux, gst_rtp_ssrc_demux, GstElement,
|
||||||
|
|
||||||
|
|
||||||
/* GObject vmethods */
|
/* GObject vmethods */
|
||||||
|
static void gst_rtp_ssrc_demux_dispose (GObject * object);
|
||||||
static void gst_rtp_ssrc_demux_finalize (GObject * object);
|
static void gst_rtp_ssrc_demux_finalize (GObject * object);
|
||||||
|
|
||||||
/* GstElement vmethods */
|
/* GstElement vmethods */
|
||||||
|
@ -257,6 +258,7 @@ gst_rtp_ssrc_demux_class_init (GstRtpSsrcDemuxClass * klass)
|
||||||
gobject_klass = (GObjectClass *) klass;
|
gobject_klass = (GObjectClass *) klass;
|
||||||
gstelement_klass = (GstElementClass *) klass;
|
gstelement_klass = (GstElementClass *) klass;
|
||||||
|
|
||||||
|
gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_dispose);
|
||||||
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_finalize);
|
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_rtp_ssrc_demux_finalize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,6 +307,20 @@ gst_rtp_ssrc_demux_init (GstRtpSsrcDemux * demux,
|
||||||
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
|
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtp_ssrc_demux_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
GstRtpSsrcDemux *demux;
|
||||||
|
|
||||||
|
demux = GST_RTP_SSRC_DEMUX (object);
|
||||||
|
|
||||||
|
g_slist_foreach (demux->srcpads, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free (demux->srcpads);
|
||||||
|
demux->srcpads = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_ssrc_demux_finalize (GObject * object)
|
gst_rtp_ssrc_demux_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,7 +214,12 @@ rtp_session_finalize (GObject * object)
|
||||||
g_object_unref (sess->source);
|
g_object_unref (sess->source);
|
||||||
|
|
||||||
g_free (sess->cname);
|
g_free (sess->cname);
|
||||||
|
g_free (sess->name);
|
||||||
|
g_free (sess->email);
|
||||||
|
g_free (sess->phone);
|
||||||
|
g_free (sess->location);
|
||||||
g_free (sess->tool);
|
g_free (sess->tool);
|
||||||
|
g_free (sess->note);
|
||||||
g_free (sess->bye_reason);
|
g_free (sess->bye_reason);
|
||||||
|
|
||||||
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
||||||
|
|
|
@ -183,7 +183,6 @@ struct _RTPSession {
|
||||||
GstClockTime last_rtcp_send_time;
|
GstClockTime last_rtcp_send_time;
|
||||||
gboolean first_rtcp;
|
gboolean first_rtcp;
|
||||||
|
|
||||||
GstBuffer *bye_packet;
|
|
||||||
gchar *bye_reason;
|
gchar *bye_reason;
|
||||||
gboolean sent_bye;
|
gboolean sent_bye;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue