mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
tests: capsfilter-renegotiation: New renegotiation use cases
Adds some new tests for renegotiation use cases that would use the new renegotiate event
This commit is contained in:
parent
081202b9d3
commit
213050e53c
1 changed files with 28 additions and 4 deletions
|
@ -88,7 +88,11 @@ buffer_probe (GstPad * pad, GstMiniObject * obj, gpointer data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_START_TEST (test_capsfilter_renegotiation)
|
/* launch line is a pipeline that must have a capsfilter named 'cf' that
|
||||||
|
* will be used to trigger the renegotiation */
|
||||||
|
static void
|
||||||
|
run_capsfilter_renegotiation (const gchar * launch_line,
|
||||||
|
gboolean reset_buffer_alloc)
|
||||||
{
|
{
|
||||||
GstElement *capsfilter;
|
GstElement *capsfilter;
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
|
@ -96,6 +100,7 @@ GST_START_TEST (test_capsfilter_renegotiation)
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstMessage *msg;
|
GstMessage *msg;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
GstPad *sinkpad;
|
||||||
|
|
||||||
caps_change = 0;
|
caps_change = 0;
|
||||||
buffer_count = 0;
|
buffer_count = 0;
|
||||||
|
@ -103,13 +108,18 @@ GST_START_TEST (test_capsfilter_renegotiation)
|
||||||
gst_caps_unref (current_caps);
|
gst_caps_unref (current_caps);
|
||||||
current_caps = NULL;
|
current_caps = NULL;
|
||||||
|
|
||||||
pipeline = gst_parse_launch ("videotestsrc num-buffers=200 ! capsfilter "
|
pipeline = gst_parse_launch (launch_line, NULL);
|
||||||
"caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink", NULL);
|
|
||||||
g_assert (pipeline);
|
g_assert (pipeline);
|
||||||
|
|
||||||
capsfilter = gst_bin_get_by_name (GST_BIN (pipeline), "cf");
|
capsfilter = gst_bin_get_by_name (GST_BIN (pipeline), "cf");
|
||||||
g_assert (capsfilter);
|
g_assert (capsfilter);
|
||||||
|
|
||||||
|
if (reset_buffer_alloc) {
|
||||||
|
sinkpad = gst_element_get_static_pad (capsfilter, "sink");
|
||||||
|
gst_pad_set_bufferalloc_function (sinkpad, NULL);
|
||||||
|
gst_object_unref (sinkpad);
|
||||||
|
}
|
||||||
|
|
||||||
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
||||||
g_assert (sink);
|
g_assert (sink);
|
||||||
|
|
||||||
|
@ -126,18 +136,32 @@ GST_START_TEST (test_capsfilter_renegotiation)
|
||||||
GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
|
GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
|
||||||
|
|
||||||
g_assert (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS);
|
g_assert (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS);
|
||||||
|
|
||||||
g_assert (caps_change == 4);
|
g_assert (caps_change == 4);
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
if (current_caps)
|
if (current_caps)
|
||||||
gst_caps_unref (current_caps);
|
gst_caps_unref (current_caps);
|
||||||
|
current_caps = NULL;
|
||||||
gst_message_unref (msg);
|
gst_message_unref (msg);
|
||||||
g_object_unref (bus);
|
g_object_unref (bus);
|
||||||
g_object_unref (G_OBJECT (pipeline));
|
g_object_unref (G_OBJECT (pipeline));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_START_TEST (test_capsfilter_renegotiation)
|
||||||
|
{
|
||||||
|
run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=true"
|
||||||
|
" ! capsfilter caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink",
|
||||||
|
FALSE);
|
||||||
|
run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
|
||||||
|
" ! capsfilter caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink",
|
||||||
|
FALSE);
|
||||||
|
run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
|
||||||
|
" ! capsfilter caps=\"video/x-raw-yuv, format=(fourcc)I420, width=(int)100, height=(int)100\" "
|
||||||
|
" ! ffmpegcolorspace ! videoscale ! capsfilter caps=\"" FIRST_CAPS
|
||||||
|
"\" name=cf " " ! fakesink name=sink", TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
|
|
Loading…
Reference in a new issue