From: Wim Taymans Date: Thu, 8 Jan 2009 15:28:24 +0000 (+0100) Subject: Check if return value of gst_rtsp_session_get_media is not NULL X-Git-Tag: 1.19.3~495^2~1629 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a76656ad8d032afe3cad4e377fd89df5e63364d6;p=platform%2Fupstream%2Fgstreamer.git Check if return value of gst_rtsp_session_get_media is not NULL --- diff --git a/gst/rtsp-server/Makefile.am b/gst/rtsp-server/Makefile.am index 8fe6b19..f073cde 100644 --- a/gst/rtsp-server/Makefile.am +++ b/gst/rtsp-server/Makefile.am @@ -3,7 +3,7 @@ public_headers = \ rtsp-client.h \ rtsp-media.h \ rtsp-session-pool.h \ - rtsp-session.h \ + rtsp-session.h c_sources = \ rtsp-server.c \ diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 9bfb6f8..9195084 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -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 */ media = gst_rtsp_session_get_media (session, client->media); + if (!media) + goto not_found; gst_rtsp_session_media_stop (media); @@ -116,6 +118,11 @@ service_unavailable: { return FALSE; } +not_found: + { + handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request); + return FALSE; + } } 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 */ media = gst_rtsp_session_get_media (session, client->media); + if (!media) + goto not_found; gst_rtsp_session_media_pause (media); g_object_unref (session); @@ -161,6 +170,11 @@ service_unavailable: { return FALSE; } +not_found: + { + handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request); + return FALSE; + } } 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 */ media = gst_rtsp_session_get_media (session, client->media); + if (!media) + goto not_found; /* wait for paused to get the caps */ ret = gst_rtsp_session_media_pause (media); @@ -246,6 +262,11 @@ service_unavailable: handle_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, request); return FALSE; } +not_found: + { + handle_generic_response (client, GST_RTSP_STS_NOT_FOUND, request); + return FALSE; + } } 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 */ media = gst_rtsp_session_get_media (session, client->media); + if (!media) + goto not_found; /* parse the stream we need to configure */ if (!(pos = strstr (uri, "stream=")))