diff options
author | Stian Selnes <stian@pexip.com> | 2015-10-07 23:49:58 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-02-12 10:08:06 +0000 |
commit | e3f9e854f08e82bfab11182c5a2aa6f9a0c73cd5 (patch) | |
tree | dc328faabb84792da5a1b0ba9a79f125c7784584 /tests | |
parent | 88e21e6089bade0e2ddc5557c4ee41dce8b3ce24 (diff) | |
download | gstreamer-plugins-bad-e3f9e854f08e82bfab11182c5a2aa6f9a0c73cd5.tar.gz |
netsim: Add netsim element
Resurrected from the Farstream repository and given an
overhaul to fix races, deadlocks etc.
https://bugzilla.gnome.org/show_bug.cgi?id=756252
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/Makefile.am | 1 | ||||
-rw-r--r-- | tests/check/elements/netsim.c | 65 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 08be42829..ca0554914 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -284,6 +284,7 @@ check_PROGRAMS = \ $(check_mpg123) \ elements/mxfdemux \ elements/mxfmux \ + elements/netsim \ elements/pcapparse \ elements/rtponvifparse \ elements/rtponviftimestamp \ diff --git a/tests/check/elements/netsim.c b/tests/check/elements/netsim.c new file mode 100644 index 000000000..1de026c37 --- /dev/null +++ b/tests/check/elements/netsim.c @@ -0,0 +1,65 @@ +#include <gst/check/gstharness.h> +#include <gst/check/gstcheck.h> + +GST_START_TEST (netsim_stress) +{ + GstHarness *h = gst_harness_new ("netsim"); + GstCaps *caps = gst_caps_from_string ("mycaps"); + GstBuffer *buf = gst_harness_create_buffer (h, 100); + GstHarnessThread *state, *push; + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_TIME); + state = gst_harness_stress_statechange_start (h); + push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf); + + g_usleep (G_USEC_PER_SEC * 1); + + gst_harness_stress_thread_stop (state); + gst_harness_stress_thread_stop (push); + + gst_caps_unref (caps); + gst_buffer_unref (buf); + gst_harness_teardown (h); +} + +GST_END_TEST; + +GST_START_TEST (netsim_stress_delayed) +{ + GstHarness *h = gst_harness_new_parse ("netsim delay-probability=0.5"); + GstCaps *caps = gst_caps_from_string ("mycaps"); + GstBuffer *buf = gst_harness_create_buffer (h, 100); + GstHarnessThread *state, *push; + GstSegment segment; + + gst_segment_init (&segment, GST_FORMAT_TIME); + state = gst_harness_stress_statechange_start (h); + push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf); + + g_usleep (G_USEC_PER_SEC * 1); + + gst_harness_stress_thread_stop (state); + gst_harness_stress_thread_stop (push); + + gst_caps_unref (caps); + gst_buffer_unref (buf); + gst_harness_teardown (h); +} + +GST_END_TEST; + +static Suite * +netsim_suite (void) +{ + Suite *s = suite_create ("netsim"); + TCase *tc_chain; + + suite_add_tcase (s, (tc_chain = tcase_create ("general"))); + tcase_add_test (tc_chain, netsim_stress); + tcase_add_test (tc_chain, netsim_stress_delayed); + + return s; +} + +GST_CHECK_MAIN (netsim) |