From 48706beb701de0414dc1f828a2641adc043ceed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 6 Jul 2012 09:07:41 +0100 Subject: [PATCH] rtph263ppay: accept any h263 input unless downstream forces specific requirements rtph263ppay should accept any input compatible with its sink template caps if it just outputs to e.g. udpsink or fakesink. rtph263ppay ! rtph263pdepay should also work with any compatible input. This would fail before with not-negotiated errors because the get_caps function would see the encoding-name in the depayloader's template caps and default to baseline H.263 because there's no profile/level information in those caps, which is the right thing to do if downstream has filtercaps from an SDP, but not if those fields are absent because they can be anything like with the depayloader's template caps. Makes videotestsrc ! avenc_h263p ! rtph263ppay ! rtph263pdepay ! fakesink work. --- gst/rtp/gstrtph263ppay.c | 17 +++++++++++++++-- tests/check/elements/rtp-payloading.c | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c index bb10cda42b..c944a0fe48 100644 --- a/gst/rtp/gstrtph263ppay.c +++ b/gst/rtp/gstrtph263ppay.c @@ -63,7 +63,7 @@ static GstStaticPadTemplate gst_rtp_h263p_pay_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-h263, " "variant = (string) \"itu\"") + GST_STATIC_CAPS ("video/x-h263, variant = (string) itu") ); /* @@ -244,7 +244,20 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad, peercaps = gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), filter); - if (!peercaps) + + /* if we're just outputting to udpsink or fakesink or so, we should also + * accept any input compatible with our sink template caps */ + if (!peercaps || gst_caps_is_any (peercaps)) + return + gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload)); + + /* We basically need to differentiate two use-cases here: One where there's + * a capsfilter after the payloader with caps created from an SDP; in this + * case the filter caps are fixed and we want to signal to an encoder what + * we want it to produce. The second case is simply payloader ! depayloader + * where we are dealing with the depayloader's template caps. In this case + * we should accept any input compatible with our sink template caps. */ + if (!gst_caps_is_fixed (peercaps)) return gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload)); diff --git a/tests/check/elements/rtp-payloading.c b/tests/check/elements/rtp-payloading.c index 6e096c6f0c..7b045022e6 100644 --- a/tests/check/elements/rtp-payloading.c +++ b/tests/check/elements/rtp-payloading.c @@ -480,6 +480,26 @@ GST_START_TEST (rtp_h263p) rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size, rtp_h263p_frame_count, "video/x-h263,variant=(string)itu," "h263version=(string)h263", "rtph263ppay", "rtph263pdepay", 0, 0, FALSE); + + /* payloader should accept any input that matches the template caps + * if there's just a udpsink or fakesink downstream */ + rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size, + rtp_h263p_frame_count, "video/x-h263,variant=(string)itu," + "h263version=(string)h263", "rtph263ppay", "identity", 0, 0, FALSE); + + /* default output of avenc_h263p */ + rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size, + rtp_h263p_frame_count, "video/x-h263,variant=(string)itu," + "h263version=(string)h263p, annex-f=(boolean)true, " + "annex-j=(boolean)true, annex-i=(boolean)true, annex-t=(boolean)true", + "rtph263ppay", "identity", 0, 0, FALSE); + + /* pay ! depay should also work with any input */ + rtp_pipeline_test (rtp_h263p_frame_data, rtp_h263p_frame_data_size, + rtp_h263p_frame_count, "video/x-h263,variant=(string)itu," + "h263version=(string)h263p, annex-f=(boolean)true, " + "annex-j=(boolean)true, annex-i=(boolean)true, annex-t=(boolean)true", + "rtph263ppay", "rtph263pdepay", 0, 0, FALSE); } GST_END_TEST;