rtsp: Ref transports in hash table.

Also ref streams for transports.
This solves a crash when reciving a rtcp after teardown but before
client finalize.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740845
This commit is contained in:
Göran Jönsson 2014-11-28 12:45:14 +01:00 committed by Wim Taymans
parent 6ba01ef0ef
commit 058698c9cf
3 changed files with 13 additions and 2 deletions

View file

@ -284,7 +284,9 @@ gst_rtsp_client_init (GstRTSPClient * client)
g_mutex_init (&priv->watch_lock);
priv->close_seq = 0;
priv->drop_backlog = DEFAULT_DROP_BACKLOG;
priv->transports = g_hash_table_new (g_direct_hash, g_direct_equal);
priv->transports =
g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
g_object_unref);
}
static GstRTSPFilterResult
@ -1861,8 +1863,10 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
g_hash_table_insert (priv->transports,
GINT_TO_POINTER (ct->interleaved.min), trans);
g_object_ref (trans);
g_hash_table_insert (priv->transports,
GINT_TO_POINTER (ct->interleaved.max), trans);
g_object_ref (trans);
}
/* create and serialize the server transport */

View file

@ -118,6 +118,9 @@ gst_rtsp_stream_transport_finalize (GObject * obj)
gst_rtsp_stream_transport_set_callbacks (trans, NULL, NULL, NULL, NULL);
gst_rtsp_stream_transport_set_keepalive (trans, NULL, NULL, NULL);
if (priv->stream)
g_object_unref (priv->stream);
if (priv->transport)
gst_rtsp_transport_free (priv->transport);
@ -149,6 +152,7 @@ gst_rtsp_stream_transport_new (GstRTSPStream * stream, GstRTSPTransport * tr)
trans = g_object_new (GST_TYPE_RTSP_STREAM_TRANSPORT, NULL);
priv = trans->priv;
priv->stream = stream;
priv->stream = g_object_ref (priv->stream);
priv->transport = tr;
return trans;

View file

@ -2249,8 +2249,11 @@ gst_rtsp_stream_recv_rtcp (GstRTSPStream * stream, GstBuffer * buffer)
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), GST_FLOW_ERROR);
priv = stream->priv;
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
g_return_val_if_fail (priv->is_joined, FALSE);
if (!priv->is_joined) {
gst_buffer_unref (buffer);
return GST_FLOW_NOT_LINKED;
}
g_mutex_lock (&priv->lock);
if (priv->appsrc[1])
element = gst_object_ref (priv->appsrc[1]);