rtp: improve basertpdepayload's error message when no input caps were set
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 6 Sep 2010 17:17:10 +0000 (18:17 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 6 Sep 2010 17:19:44 +0000 (18:19 +0100)
This is pretty much an FAQ, so try to make the error message a bit
more helpful. Also, don't tell people to file a bug in bugzilla
about this (which is what happens if the default error message for
CORE_NEGOTIATION is used).

gst-libs/gst/rtp/gstbasertpdepayload.c

index 1bdf523..3bee2ab 100644 (file)
@@ -240,10 +240,15 @@ gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps)
   else
     priv->play_scale = 1.0;
 
-  if (bclass->set_caps)
+  if (bclass->set_caps) {
     res = bclass->set_caps (filter, caps);
-  else
+    if (!res) {
+      GST_WARNING_OBJECT (filter, "Subclass rejected caps %" GST_PTR_FORMAT,
+          caps);
+    }
+  } else {
     res = TRUE;
+  }
 
   priv->negotiated = res;
 
@@ -357,8 +362,22 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
 not_negotiated:
   {
     /* this is not fatal but should be filtered earlier */
-    GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
-        ("Not RTP format was negotiated"));
+    if (GST_BUFFER_CAPS (in) == NULL) {
+      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
+          ("No RTP format was negotiated."),
+          ("Input buffers need to have RTP caps set on them. This is usually "
+              "achieved by setting the 'caps' property of the upstream source "
+              "element (often udpsrc or appsrc), or by putting a capsfilter "
+              "element before the depayloader and setting the 'caps' property "
+              "on that. Also see http://cgit.freedesktop.org/gstreamer/"
+              "gst-plugins-good/tree/gst/rtp/README"));
+    } else {
+      GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION,
+          ("No RTP format was negotiated."),
+          ("RTP caps on input buffer were rejected, most likely because they "
+              "were incomplete or contained wrong values. Check the debug log "
+              "for more information."));
+    }
     gst_buffer_unref (in);
     return GST_FLOW_NOT_NEGOTIATED;
   }