media: warn and fail when gstrtpbin is not found
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 6 Dec 2010 18:29:53 +0000 (19:29 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 6 Dec 2010 18:29:53 +0000 (19:29 +0100)
gst/rtsp-server/rtsp-media.c

index af802e9..8a218ec 100644 (file)
@@ -1501,6 +1501,10 @@ gst_rtsp_media_prepare (GstRTSPMedia * media)
   if (!media->reusable && media->reused)
     goto is_reused;
 
+  media->rtpbin = gst_element_factory_make ("gstrtpbin", NULL);
+  if (media->rtpbin == NULL)
+    goto no_gstrtpbin;
+
   GST_INFO ("preparing media %p", media);
 
   /* reset some variables */
@@ -1520,8 +1524,6 @@ gst_rtsp_media_prepare (GstRTSPMedia * media)
   klass = GST_RTSP_MEDIA_GET_CLASS (media);
   media->id = g_source_attach (media->source, klass->context);
 
-  media->rtpbin = gst_element_factory_make ("gstrtpbin", NULL);
-
   /* add stuff to the bin */
   gst_bin_add (GST_BIN (media->pipeline), media->rtpbin);
 
@@ -1592,6 +1594,12 @@ is_reused:
     GST_WARNING ("can not reuse media %p", media);
     return FALSE;
   }
+no_gstrtpbin:
+  {
+    GST_WARNING ("no gstrtpbin element");
+    g_warning ("failed to create element 'gstrtpbin', check your installation");
+    return FALSE;
+  }
 state_failed:
   {
     GST_WARNING ("failed to preroll pipeline");