diff options
-rw-r--r-- | gst/rtsp-server/rtsp-client.c | 28 | ||||
-rw-r--r-- | gst/rtsp-server/rtsp-session.c | 2 | ||||
-rw-r--r-- | tests/check/gst/client.c | 6 |
3 files changed, 21 insertions, 15 deletions
diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 47c9657..46da780 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -1770,6 +1770,7 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) GstRTSPClientClass *klass; gchar *path, *control; gint matched; + gboolean new_session = FALSE; if (!ctx->uri) goto no_uri; @@ -1842,6 +1843,7 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) /* make sure this client is closed when the session is closed */ client_watch_session (client, session); + new_session = TRUE; /* signal new session */ g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_NEW_SESSION], 0, session); @@ -1849,18 +1851,6 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) ctx->session = session; } - if (sessmedia == NULL) { - /* manage the media in our session now, if not done already */ - sessmedia = gst_rtsp_session_manage_media (session, path, media); - /* if we stil have no media, error */ - if (sessmedia == NULL) - goto sessmedia_unavailable; - } else { - g_object_unref (media); - } - - ctx->sessmedia = sessmedia; - if (!klass->configure_client_media (client, media, stream, ctx)) goto configure_media_failed_no_reply; @@ -1881,6 +1871,18 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) goto keymgmt_error; } + if (sessmedia == NULL) { + /* manage the media in our session now, if not done already */ + sessmedia = gst_rtsp_session_manage_media (session, path, media); + /* if we stil have no media, error */ + if (sessmedia == NULL) + goto sessmedia_unavailable; + } else { + g_object_unref (media); + } + + ctx->sessmedia = sessmedia; + /* set in the session media transport */ trans = gst_rtsp_session_media_set_transport (sessmedia, stream, ct); @@ -2014,6 +2016,8 @@ keymgmt_error: cleanup_transport: gst_rtsp_transport_free (ct); cleanup_session: + if (new_session) + gst_rtsp_session_pool_remove (priv->session_pool, session); g_object_unref (session); cleanup_path: g_free (path); diff --git a/gst/rtsp-server/rtsp-session.c b/gst/rtsp-server/rtsp-session.c index 9beb8ab..3463b32 100644 --- a/gst/rtsp-server/rtsp-session.c +++ b/gst/rtsp-server/rtsp-session.c @@ -128,6 +128,8 @@ gst_rtsp_session_init (GstRTSPSession * session) session->priv = priv; + GST_INFO ("init session %p", session); + g_mutex_init (&priv->lock); priv->timeout = DEFAULT_TIMEOUT; g_get_current_time (&priv->create_time); diff --git a/tests/check/gst/client.c b/tests/check/gst/client.c index 896a6cc..6d8df97 100644 --- a/tests/check/gst/client.c +++ b/tests/check/gst/client.c @@ -602,7 +602,7 @@ GST_START_TEST (test_client_multicast_invalid_transport_specific) session_pool = gst_rtsp_client_get_session_pool (client); fail_unless (session_pool != NULL); /* FIXME: There seems to be a leak of a session here ! */ - /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */ + fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); g_object_unref (session_pool); @@ -623,7 +623,7 @@ GST_START_TEST (test_client_multicast_invalid_transport_specific) session_pool = gst_rtsp_client_get_session_pool (client); fail_unless (session_pool != NULL); /* FIXME: There seems to be a leak of a session here ! */ - /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */ + fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); g_object_unref (session_pool); @@ -644,7 +644,7 @@ GST_START_TEST (test_client_multicast_invalid_transport_specific) session_pool = gst_rtsp_client_get_session_pool (client); fail_unless (session_pool != NULL); /* FIXME: There seems to be a leak of a session here ! */ - /* fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); */ + fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0); g_object_unref (session_pool); |