summaryrefslogtreecommitdiffstats
path: root/tests/check
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-04-21 13:54:39 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-04-21 13:54:39 +0000
commit2821ae6e8c95a15138f200660ba11b2665a54226 (patch)
treec79d52ad53a83919b3c87f6a2f13783da187746d /tests/check
parentd437aba4c4daf9276cd6c263288e1a7a5767d763 (diff)
downloadgst-plugins-bad-2821ae6e8c95a15138f200660ba11b2665a54226.tar.gz
gst-plugins-bad-2821ae6e8c95a15138f200660ba11b2665a54226.tar.bz2
gst-plugins-bad-2821ae6e8c95a15138f200660ba11b2665a54226.zip
tests/check/elements/audioresample.c: Add unit test for audioresample shutdown crasher (#420106).
Original commit message from CVS: * tests/check/elements/audioresample.c: Add unit test for audioresample shutdown crasher (#420106).
Diffstat (limited to 'tests/check')
-rw-r--r--tests/check/elements/audioresample.c65
1 files changed, 48 insertions, 17 deletions
diff --git a/tests/check/elements/audioresample.c b/tests/check/elements/audioresample.c
index 78e46540..4fc18636 100644
--- a/tests/check/elements/audioresample.c
+++ b/tests/check/elements/audioresample.c
@@ -371,7 +371,52 @@ GST_START_TEST (test_reuse)
GST_END_TEST;
-Suite *
+GST_START_TEST (test_shutdown)
+{
+ GstElement *pipeline, *src, *cf1, *ar, *cf2, *sink;
+ GstCaps *caps;
+ guint i;
+
+ /* create pipeline, force audioresample to actually resample */
+ pipeline = gst_pipeline_new (NULL);
+
+ src = gst_check_setup_element ("audiotestsrc");
+ cf1 = gst_check_setup_element ("capsfilter");
+ ar = gst_check_setup_element ("audioresample");
+ cf2 = gst_check_setup_element ("capsfilter");
+ g_object_set (cf2, "name", "capsfilter2", NULL);
+ sink = gst_check_setup_element ("fakesink");
+
+ caps =
+ gst_caps_new_simple ("audio/x-raw-int", "rate", G_TYPE_INT, 11025, NULL);
+ g_object_set (cf1, "caps", caps, NULL);
+ gst_caps_unref (caps);
+
+ caps =
+ gst_caps_new_simple ("audio/x-raw-int", "rate", G_TYPE_INT, 48000, NULL);
+ g_object_set (cf2, "caps", caps, NULL);
+ gst_caps_unref (caps);
+
+ /* don't want to sync against the clock, the more throughput the better */
+ g_object_set (src, "is-live", FALSE, NULL);
+ g_object_set (sink, "sync", FALSE, NULL);
+
+ gst_bin_add_many (GST_BIN (pipeline), src, cf1, ar, cf2, sink, NULL);
+ fail_if (!gst_element_link_many (src, cf1, ar, cf2, sink, NULL));
+
+ /* now, wait until pipeline is running and then shut it down again; repeat */
+ for (i = 0; i < 20; ++i) {
+ gst_element_set_state (pipeline, GST_STATE_PAUSED);
+ gst_element_get_state (pipeline, NULL, NULL, -1);
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ g_usleep (100);
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ }
+
+ gst_object_unref (pipeline);
+}
+
+GST_END_TEST static Suite *
audioresample_suite (void)
{
Suite *s = suite_create ("audioresample");
@@ -381,23 +426,9 @@ audioresample_suite (void)
tcase_add_test (tc_chain, test_perfect_stream);
tcase_add_test (tc_chain, test_discont_stream);
tcase_add_test (tc_chain, test_reuse);
+ tcase_add_test (tc_chain, test_shutdown);
return s;
}
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = audioresample_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
+GST_CHECK_MAIN (audioresample);