rtph263ppay: Set H263-2000 if thats what the other side wants
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>
Wed, 4 Mar 2009 19:51:09 +0000 (14:51 -0500)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Mon, 5 Sep 2011 10:58:55 +0000 (12:58 +0200)
The static caps states this element supports H263-2000, but setcaps never
sets it, so it was lie.

See https://bugzilla.gnome.org/show_bug.cgi?id=577784

gst/rtp/gstrtph263ppay.c

index fff68ec..54a1991 100644 (file)
@@ -162,9 +162,31 @@ static gboolean
 gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
 {
   gboolean res;
+  GstCaps *peercaps;
+  gchar *encoding_name = NULL;
 
-  gst_basertppayload_set_options (payload, "video", TRUE, "H263-1998", 90000);
+  g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
+
+  peercaps = gst_pad_peer_get_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload));
+  if (peercaps) {
+    GstCaps *intersect = gst_caps_intersect (peercaps,
+        gst_pad_get_pad_template_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload)));
+
+    gst_caps_unref (peercaps);
+    if (!gst_caps_is_empty (intersect)) {
+      GstStructure *s = gst_caps_get_structure (intersect, 0);
+      encoding_name = g_strdup (gst_structure_get_string (s, "encoding-name"));
+    }
+    gst_caps_unref (intersect);
+  }
+
+  if (!encoding_name)
+    encoding_name = g_strdup ("H263-1998");
+
+  gst_basertppayload_set_options (payload, "video", TRUE,
+      (gchar *) encoding_name, 90000);
   res = gst_basertppayload_set_outcaps (payload, NULL);
+  g_free (encoding_name);
 
   return res;
 }