Check if return value of gst_rtsp_session_get_media is not NULL
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 8 Jan 2009 15:28:24 +0000 (16:28 +0100)
committerWim Taymans <wim@wtay.(none)>
Thu, 8 Jan 2009 15:28:24 +0000 (16:28 +0100)
gst/rtsp-server/Makefile.am
gst/rtsp-server/rtsp-client.c

index 8fe6b19..f073cde 100644 (file)
@@ -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 \
index 9bfb6f8..9195084 100644 (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 */
   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=")))