Unerstanding Capsfilter test 'test_unfixed_downstream_caps' from gst/tests/check
Krzysztof Konopko
krzysztof.konopko at youview.com
Mon Dec 3 00:58:37 PST 2012
Hi,
fakesrc element can provide ANY capabilities, the sink pad expects the
following capibilities:
#define CAPS_TEMPLATE_STRING \
"audio/x-raw, " \
"channels = (int) [ 1, 2], " \
"rate = (int) [ 1, MAX ]"
while only two of them are provided by the capsfilter:
"audio/x-raw, rate=(int)44100"
The resulting capabilities are unfixed/not
negotiated/unconstrained/ambiguous.
The purpose of this test is to make sure that the pipeline will fail to
play in such situation.
Kris
On 03/12/12 07:23, deepthips wrote:
> Hi I couldnt fully understand the test test_unfixed_downstream_caps from
> tests/check/elements/capsfilter.c. From the code flow, I couldnt get a
> picture of the test done.
>
> If some one could help, it would be really helpful.
>
>
> GST_START_TEST (test_unfixed_downstream_caps)
> {
> GstElement *pipe, *src, *filter;
> GstCaps *filter_caps;
> GstPad *mysinkpad;
> GstMessage *msg;
>
> pipe = gst_check_setup_element ("pipeline");
>
> src = gst_check_setup_element ("fakesrc");
> g_object_set (src, "sizetype", 2, "sizemax", 1024, "num-buffers", 1,
> NULL);
>
> filter = gst_check_setup_element ("capsfilter");
> filter_caps = gst_caps_from_string ("audio/x-raw-int, rate=(int)44100");
> fail_unless (filter_caps != NULL);
> g_object_set (filter, "caps", filter_caps, NULL);
>
> gst_bin_add_many (GST_BIN (pipe), src, filter, NULL);
> fail_unless (gst_element_link (src, filter));
>
> mysinkpad = gst_check_setup_sink_pad (filter, &sinktemplate, NULL);
> gst_pad_set_active (mysinkpad, TRUE);
>
> fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PLAYING),
> GST_STATE_CHANGE_SUCCESS);
>
> /* wait for error on bus */
> msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),
> GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
>
> fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ERROR,
> "Expected ERROR message, got EOS message");
> gst_message_unref (msg);
>
> /* We don't expect any output buffers unless the check fails */
> fail_unless (buffers == NULL);
>
> /* cleanup */
> GST_DEBUG ("cleanup");
>
> gst_pad_set_active (mysinkpad, FALSE);
> gst_check_teardown_sink_pad (filter);
> gst_check_teardown_element (pipe);
> gst_caps_unref (filter_caps);
> }
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Unerstanding-Capsfilter-test-test-unfixed-downstream-caps-from-gst-tests-check-tp4657172.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
More information about the gstreamer-devel
mailing list