mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
tests/adder: Add stream consistency checking. Fixes #588748
This commit is contained in:
parent
196b38d4ef
commit
9819a3519d
1 changed files with 46 additions and 1 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/check/gstconsistencychecker.h>
|
||||||
|
|
||||||
static GMainLoop *main_loop;
|
static GMainLoop *main_loop;
|
||||||
|
|
||||||
|
@ -100,6 +101,8 @@ GST_START_TEST (test_event)
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstEvent *seek_event;
|
GstEvent *seek_event;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
GstPad *srcpad;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
|
||||||
|
@ -126,6 +129,10 @@ GST_START_TEST (test_event)
|
||||||
res = gst_element_link (adder, sink);
|
res = gst_element_link (adder, sink);
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
||||||
GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
|
GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
|
||||||
GST_SEEK_TYPE_SET, (GstClockTime) 0,
|
GST_SEEK_TYPE_SET, (GstClockTime) 0,
|
||||||
|
@ -167,6 +174,7 @@ GST_START_TEST (test_event)
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
|
gst_consistency_checker_free (consist);
|
||||||
gst_object_unref (G_OBJECT (bus));
|
gst_object_unref (G_OBJECT (bus));
|
||||||
gst_object_unref (G_OBJECT (bin));
|
gst_object_unref (G_OBJECT (bin));
|
||||||
}
|
}
|
||||||
|
@ -224,6 +232,8 @@ GST_START_TEST (test_play_twice)
|
||||||
GstElement *bin, *src1, *src2, *adder, *sink;
|
GstElement *bin, *src1, *src2, *adder, *sink;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
GstPad *srcpad;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
|
||||||
|
@ -247,6 +257,10 @@ GST_START_TEST (test_play_twice)
|
||||||
res = gst_element_link (adder, sink);
|
res = gst_element_link (adder, sink);
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
||||||
GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
|
GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
|
||||||
GST_SEEK_TYPE_SET, (GstClockTime) 0,
|
GST_SEEK_TYPE_SET, (GstClockTime) 0,
|
||||||
|
@ -291,6 +305,7 @@ GST_START_TEST (test_play_twice)
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
|
gst_consistency_checker_free (consist);
|
||||||
gst_event_ref (play_seek_event);
|
gst_event_ref (play_seek_event);
|
||||||
gst_object_unref (G_OBJECT (bus));
|
gst_object_unref (G_OBJECT (bus));
|
||||||
gst_object_unref (G_OBJECT (bin));
|
gst_object_unref (G_OBJECT (bin));
|
||||||
|
@ -304,6 +319,8 @@ GST_START_TEST (test_play_twice_then_add_and_play_again)
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
gint i;
|
gint i;
|
||||||
|
GstPad *srcpad;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
|
||||||
|
@ -320,6 +337,10 @@ GST_START_TEST (test_play_twice_then_add_and_play_again)
|
||||||
sink = gst_element_factory_make ("fakesink", "sink");
|
sink = gst_element_factory_make ("fakesink", "sink");
|
||||||
gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
|
gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
res = gst_element_link (src1, adder);
|
res = gst_element_link (src1, adder);
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
res = gst_element_link (src2, adder);
|
res = gst_element_link (src2, adder);
|
||||||
|
@ -380,6 +401,8 @@ GST_START_TEST (test_play_twice_then_add_and_play_again)
|
||||||
res = gst_element_link (src3, adder);
|
res = gst_element_link (src3, adder);
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_consistency_checker_reset (consist);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = gst_element_set_state (bin, GST_STATE_NULL);
|
res = gst_element_set_state (bin, GST_STATE_NULL);
|
||||||
|
@ -388,6 +411,7 @@ GST_START_TEST (test_play_twice_then_add_and_play_again)
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
gst_event_ref (play_seek_event);
|
gst_event_ref (play_seek_event);
|
||||||
|
gst_consistency_checker_free (consist);
|
||||||
gst_object_unref (G_OBJECT (bus));
|
gst_object_unref (G_OBJECT (bus));
|
||||||
gst_object_unref (G_OBJECT (bin));
|
gst_object_unref (G_OBJECT (bin));
|
||||||
}
|
}
|
||||||
|
@ -419,7 +443,9 @@ GST_START_TEST (test_live_seeking)
|
||||||
GstElement *bin, *src1, *src2, *ac1, *ac2, *adder, *sink;
|
GstElement *bin, *src1, *src2, *ac1, *ac2, *adder, *sink;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
GstPad *srcpad;
|
||||||
gint i;
|
gint i;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
|
@ -483,6 +509,12 @@ GST_START_TEST (test_live_seeking)
|
||||||
g_signal_connect (bus, "message::eos",
|
g_signal_connect (bus, "message::eos",
|
||||||
(GCallback) test_live_seeking_eos_message_received, bin);
|
(GCallback) test_live_seeking_eos_message_received, bin);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
|
GST_INFO ("starting test");
|
||||||
|
|
||||||
/* run it twice */
|
/* run it twice */
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
|
||||||
|
@ -518,6 +550,8 @@ GST_START_TEST (test_live_seeking)
|
||||||
|
|
||||||
res = gst_element_set_state (bin, GST_STATE_NULL);
|
res = gst_element_set_state (bin, GST_STATE_NULL);
|
||||||
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
|
fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
|
||||||
|
|
||||||
|
gst_consistency_checker_reset (consist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
@ -538,6 +572,8 @@ GST_START_TEST (test_add_pad)
|
||||||
{
|
{
|
||||||
GstElement *bin, *src1, *src2, *adder, *sink;
|
GstElement *bin, *src1, *src2, *adder, *sink;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
|
GstPad *srcpad;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
@ -563,6 +599,10 @@ GST_START_TEST (test_add_pad)
|
||||||
res = gst_element_link (adder, sink);
|
res = gst_element_link (adder, sink);
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
|
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
|
||||||
bin);
|
bin);
|
||||||
|
@ -614,8 +654,9 @@ GST_START_TEST (test_remove_pad)
|
||||||
{
|
{
|
||||||
GstElement *bin, *src, *adder, *sink;
|
GstElement *bin, *src, *adder, *sink;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstPad *pad;
|
GstPad *pad, *srcpad;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
GstStreamConsistency *consist;
|
||||||
|
|
||||||
GST_INFO ("preparing test");
|
GST_INFO ("preparing test");
|
||||||
|
|
||||||
|
@ -640,6 +681,10 @@ GST_START_TEST (test_remove_pad)
|
||||||
pad = gst_element_get_request_pad (adder, "sink%d");
|
pad = gst_element_get_request_pad (adder, "sink%d");
|
||||||
fail_if (pad == NULL, NULL);
|
fail_if (pad == NULL, NULL);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (adder, "src");
|
||||||
|
consist = gst_consistency_checker_new (srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
main_loop = g_main_loop_new (NULL, FALSE);
|
main_loop = g_main_loop_new (NULL, FALSE);
|
||||||
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
|
g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
|
||||||
bin);
|
bin);
|
||||||
|
|
Loading…
Reference in a new issue