Check if return value of gst_rtsp_session_get_media is not NULL

This commit is contained in:
Wim Taymans 2009-01-08 16:28:24 +01:00 committed by Wim Taymans
parent b6e7986f45
commit a76656ad8d
2 changed files with 24 additions and 1 deletions

View file

@ -3,7 +3,7 @@ public_headers = \
rtsp-client.h \ rtsp-client.h \
rtsp-media.h \ rtsp-media.h \
rtsp-session-pool.h \ rtsp-session-pool.h \
rtsp-session.h \ rtsp-session.h
c_sources = \ c_sources = \
rtsp-server.c \ rtsp-server.c \

View file

@ -88,6 +88,8 @@ handle_teardown_response (GstRTSPClient *client, const gchar *uri, GstRTSPMessag
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
media = gst_rtsp_session_get_media (session, client->media); media = gst_rtsp_session_get_media (session, client->media);
if (!media)
goto not_found;
gst_rtsp_session_media_stop (media); gst_rtsp_session_media_stop (media);
@ -116,6 +118,11 @@ service_unavailable:
{ {
return FALSE; return FALSE;
} }
not_found:
{
handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request);
return FALSE;
}
} }
static gboolean static gboolean
@ -139,6 +146,8 @@ handle_pause_response (GstRTSPClient *client, const gchar *uri, GstRTSPMessage *
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
media = gst_rtsp_session_get_media (session, client->media); media = gst_rtsp_session_get_media (session, client->media);
if (!media)
goto not_found;
gst_rtsp_session_media_pause (media); gst_rtsp_session_media_pause (media);
g_object_unref (session); g_object_unref (session);
@ -161,6 +170,11 @@ service_unavailable:
{ {
return FALSE; return FALSE;
} }
not_found:
{
handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request);
return FALSE;
}
} }
static gboolean static gboolean
@ -188,6 +202,8 @@ handle_play_response (GstRTSPClient *client, const gchar *uri, GstRTSPMessage *r
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
media = gst_rtsp_session_get_media (session, client->media); media = gst_rtsp_session_get_media (session, client->media);
if (!media)
goto not_found;
/* wait for paused to get the caps */ /* wait for paused to get the caps */
ret = gst_rtsp_session_media_pause (media); ret = gst_rtsp_session_media_pause (media);
@ -246,6 +262,11 @@ service_unavailable:
handle_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, request); handle_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, request);
return FALSE; return FALSE;
} }
not_found:
{
handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request);
return FALSE;
}
} }
static gboolean static gboolean
@ -330,6 +351,8 @@ handle_setup_response (GstRTSPClient *client, const gchar *uri, GstRTSPMessage *
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
media = gst_rtsp_session_get_media (session, client->media); media = gst_rtsp_session_get_media (session, client->media);
if (!media)
goto not_found;
/* parse the stream we need to configure */ /* parse the stream we need to configure */
if (!(pos = strstr (uri, "stream="))) if (!(pos = strstr (uri, "stream=")))