Index: gstbasertppayload.c
===================================================================
--- gstbasertppayload.c	(revision 5644)
+++ gstbasertppayload.c	(working copy)
@@ -375,19 +375,55 @@
 gst_basertppayload_set_outcaps (GstBaseRTPPayload * payload, gchar * fieldname,
     ...)
 {
+  GstCaps *peercaps;
+  const GstCaps *ourcaps;
   GstCaps *srccaps;
   GstStructure *s;
+  const GValue *value;
 
-  srccaps = gst_caps_new_simple ("application/x-rtp",
-      "media", G_TYPE_STRING, payload->media,
-      "payload", G_TYPE_INT, GST_BASE_RTP_PAYLOAD_PT (payload),
-      "clock-rate", G_TYPE_INT, payload->clock_rate,
-      "encoding-name", G_TYPE_STRING, payload->encoding_name,
-      "ssrc", G_TYPE_UINT, payload->current_ssrc,
-      "clock-base", G_TYPE_UINT, payload->ts_base,
-      "seqnum-base", G_TYPE_UINT, payload->seqnum_base, NULL);
+  peercaps = gst_pad_peer_get_caps (payload->srcpad);
+  ourcaps = gst_pad_get_pad_template_caps (payload->srcpad);
+
+  srccaps = gst_caps_intersect(ourcaps, peercaps);
+
+  gst_caps_unref(peercaps);
+
+  if (gst_caps_is_empty (srccaps)) {
+    gst_caps_unref (srccaps);
+    return FALSE;
+  }
+
   s = gst_caps_get_structure (srccaps, 0);
 
+  if (!gst_structure_get_int (s,
+          "payload", &GST_BASE_RTP_PAYLOAD_PT (payload))) {
+    gst_structure_set (s,
+        "payload", G_TYPE_INT, GST_BASE_RTP_PAYLOAD_PT (payload), NULL);
+  }
+
+  if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) {
+    value = gst_structure_get_value (s, "ssrc");
+    payload->current_ssrc = g_value_get_uint (value);
+  } else {
+    gst_structure_set (s, "ssrc", G_TYPE_UINT, payload->current_ssrc, NULL);
+  }
+
+  if (gst_structure_has_field_typed (s, "clock-base", G_TYPE_UINT)) {
+    value = gst_structure_get_value (s, "clock-base");
+    payload->ts_base = g_value_get_uint (value);
+  } else {
+    gst_structure_set (s, "clock-base", G_TYPE_UINT, payload->ts_base, NULL);
+  }
+
+  if (gst_structure_has_field_typed (s, "seqnum-base", G_TYPE_UINT)) {
+    value = gst_structure_get_value (s, "seqnum-base");
+    payload->seqnum_base = g_value_get_uint (value);
+  } else {
+    gst_structure_set (s, "seqnum-base", G_TYPE_UINT, payload->seqnum_base,
+        NULL);
+  }
+
+
   if (fieldname) {
     va_list varargs;
 
