From d4778dbe4341ddc13c1ce9214ae21a2e15cba25d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 4 Mar 2009 14:51:09 -0500 Subject: [PATCH] rtph263ppay: Set H263-2000 if thats what the other side wants 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 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c index fff68ec..54a1991 100644 --- a/gst/rtp/gstrtph263ppay.c +++ b/gst/rtp/gstrtph263ppay.c @@ -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; } -- 2.7.4