From 820cf44f7d1b8b82f02f08af965cf41ef2fd19fb Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Sun, 10 Sep 2017 20:55:07 +0200 Subject: [PATCH] tests: simplify audiomixer test Use _link_many() and reuse a helper to reduce the test code. --- tests/check/elements/audiomixer.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/check/elements/audiomixer.c b/tests/check/elements/audiomixer.c index f0f16f393c..4abddda386 100644 --- a/tests/check/elements/audiomixer.c +++ b/tests/check/elements/audiomixer.c @@ -570,7 +570,6 @@ GST_START_TEST (test_live_seeking) GstPad *srcpad; GstPad *sinkpad; gint i; - GstStateChangeReturn state_res; GstStreamConsistency *consist; /* don't use autoaudiosrc, as then we can't set anything here */ const gchar *audio_src_factories[] = { @@ -591,6 +590,7 @@ GST_START_TEST (test_live_seeking) } if (!src1) { /* normal audiosources behave differently than audiotestsrc */ + GST_WARNING ("no real audiosrc found, using audiotestsrc is-live"); src1 = gst_element_factory_make ("audiotestsrc", "src1"); g_object_set (src1, "wave", 4, "is-live", TRUE, NULL); /* silence */ } else { @@ -605,19 +605,11 @@ GST_START_TEST (test_live_seeking) sink = gst_element_factory_make ("fakesink", "sink"); gst_bin_add_many (GST_BIN (bin), src1, cf, audiomixer, sink, NULL); - res = gst_element_link (src1, cf); - fail_unless (res == TRUE, NULL); - res = gst_element_link (cf, audiomixer); - fail_unless (res == TRUE, NULL); - res = gst_element_link (audiomixer, sink); + res = gst_element_link_many (src1, cf, audiomixer, sink, NULL); fail_unless (res == TRUE, NULL); - gst_element_set_state (bin, GST_STATE_PLAYING); - /* wait for completion */ - state_res = - gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, - GST_CLOCK_TIME_NONE); - ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE); + /* get the caps for the livesrc, we'll reuse this for the non-live source */ + set_state_and_wait (bin, GST_STATE_PLAYING); sinkpad = gst_element_get_static_pad (sink, "sink"); fail_unless (sinkpad != NULL);