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.
This commit is contained in:
Tim-Philipp Müller 2012-07-06 09:07:41 +01:00 committed by Tim-Philipp Müller
parent 76625d20d7
commit 48706beb70
2 changed files with 35 additions and 2 deletions

View file

@ -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));

View file

@ -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;