tests/check/pipelines/simple-launch-lines.c: Improve the tests by allowing to set a target state.

Original commit message from CVS:
* tests/check/pipelines/simple-launch-lines.c:
Improve the tests by allowing to set a target state.
This commit is contained in:
Stefan Kost 2007-11-26 09:13:48 +00:00
parent 859e8028ab
commit 07fc6b7f49
2 changed files with 32 additions and 24 deletions

View file

@ -1,3 +1,8 @@
2007-11-26 Stefan Kost <ensonic@users.sf.net>
* tests/check/pipelines/simple-launch-lines.c:
Improve the tests by allowing to set a target state.
2007-11-26 Sebastian Dröge <slomo@circular-chaos.org> 2007-11-26 Sebastian Dröge <slomo@circular-chaos.org>
* tests/check/elements/wavpackenc.c: (GST_START_TEST): * tests/check/elements/wavpackenc.c: (GST_START_TEST):

View file

@ -44,7 +44,7 @@ setup_pipeline (const gchar * pipe_descr)
*/ */
static void static void
run_pipeline (GstElement * pipe, const gchar * descr, run_pipeline (GstElement * pipe, const gchar * descr,
GstMessageType events, GstMessageType tevent) GstMessageType events, GstMessageType tevent, GstState target_state)
{ {
GstBus *bus; GstBus *bus;
GstMessage *message; GstMessage *message;
@ -55,8 +55,7 @@ run_pipeline (GstElement * pipe, const gchar * descr,
bus = gst_element_get_bus (pipe); bus = gst_element_get_bus (pipe);
g_assert (bus); g_assert (bus);
/* FIXME: going to playing would be nice, but thet leads to lot of failure */ fail_if (gst_element_set_state (pipe, target_state) ==
fail_if (gst_element_set_state (pipe, GST_STATE_PAUSED) ==
GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to playing", descr); GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to playing", descr);
ret = gst_element_get_state (pipe, NULL, NULL, 10 * GST_SECOND); ret = gst_element_get_state (pipe, NULL, NULL, 10 * GST_SECOND);
if (ret == GST_STATE_CHANGE_ASYNC) { if (ret == GST_STATE_CHANGE_ASYNC) {
@ -104,10 +103,13 @@ done:
gst_object_unref (bus); gst_object_unref (bus);
} }
GST_START_TEST (test_rtppayloaders) GST_START_TEST (test_rtp_payloaders)
{ {
gchar *s; gchar *s;
/* FIXME: going to playing would be nice, but thet leads to lot of failure */
GstState target_state = GST_STATE_PAUSED;
/* we use is-live here to avoid preroll */ /* we use is-live here to avoid preroll */
#define PIPELINE_STRING(bufcount, bufsize, pl, dpl) "fakesrc is-live=true num-buffers=" bufcount " filltype=2 sizetype=2 sizemax=" bufsize " ! " pl " ! " dpl " ! fakesink" #define PIPELINE_STRING(bufcount, bufsize, pl, dpl) "fakesrc is-live=true num-buffers=" bufcount " filltype=2 sizetype=2 sizemax=" bufsize " ! " pl " ! " dpl " ! fakesink"
#define DEFAULT_BUFCOUNT "5" #define DEFAULT_BUFCOUNT "5"
@ -117,99 +119,99 @@ GST_START_TEST (test_rtppayloaders)
"rtpilbcdepay"); "rtpilbcdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpgsmpay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpgsmpay",
"rtpgsmdepay"); "rtpgsmdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
/* This one needs a bit different buffer size than others or it doesn't work. */ /* This one needs a bit different buffer size than others or it doesn't work. */
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, "52", "rtpamrpay", "rtpamrdepay"); s = PIPELINE_STRING (DEFAULT_BUFCOUNT, "52", "rtpamrpay", "rtpamrdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtppcmapay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtppcmapay",
"rtppcmadepay"); "rtppcmadepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtppcmupay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtppcmupay",
"rtppcmudepay"); "rtppcmudepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmpapay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmpapay",
"rtpmpadepay"); "rtpmpadepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph263ppay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph263ppay",
"rtph263pdepay"); "rtph263pdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph263pay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph263pay",
"rtph263depay"); "rtph263depay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph264pay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtph264pay",
"rtph264depay"); "rtph264depay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpL16pay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpL16pay",
"rtpL16depay"); "rtpL16depay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp2tpay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp2tpay",
"rtpmp2tdepay"); "rtpmp2tdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp4vpay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp4vpay",
"rtpmp4vdepay"); "rtpmp4vdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp4gpay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpmp4gpay",
"rtpmp4gdepay"); "rtpmp4gdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
/* Cannot be tested with fakesrc becouse speex payloader requires a valid header?! */ /* Cannot be tested with fakesrc becouse speex payloader requires a valid header?! */
/* /*
s = PIPELINE_STRING(DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpspeexpay", "rtpspeexdepay"); s = PIPELINE_STRING(DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpspeexpay", "rtpspeexdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
*/ */
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtptheorapay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtptheorapay",
"rtptheoradepay"); "rtptheoradepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpvorbispay", s = PIPELINE_STRING (DEFAULT_BUFCOUNT, DEFAULT_BUFSIZE, "rtpvorbispay",
"rtpvorbisdepay"); "rtpvorbisdepay");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
/*s = FAKESRC " ! ! rtpac3depay ! " FAKESINK */ /*s = FAKESRC " ! ! rtpac3depay ! " FAKESINK */
/*s = FAKESRC " ! ! asteriskh263 ! " FAKESINK; */ /*s = FAKESRC " ! ! asteriskh263 ! " FAKESINK; */
@ -222,6 +224,7 @@ GST_END_TEST
GST_START_TEST (test_video_encoders_decoders) GST_START_TEST (test_video_encoders_decoders)
{ {
gchar *s; gchar *s;
GstState target_state = GST_STATE_PLAYING;
/* no is-live on the source because we actually want to preroll since /* no is-live on the source because we actually want to preroll since
* run_pipeline only goes into PAUSED */ * run_pipeline only goes into PAUSED */
@ -231,17 +234,17 @@ GST_START_TEST (test_video_encoders_decoders)
s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "jpegenc", "jpegdec"); s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "jpegenc", "jpegdec");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "pngenc", "pngdec"); s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "pngenc", "pngdec");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "smokeenc", "smokedec"); s = ENC_DEC_PIPELINE_STRING (DEFAULT_BUFCOUNT, "smokeenc", "smokedec");
run_pipeline (setup_pipeline (s), s, run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN); GST_MESSAGE_UNKNOWN, target_state);
} }
GST_END_TEST GST_END_TEST
@ -256,7 +259,7 @@ GST_END_TEST
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
#ifndef GST_DISABLE_PARSE #ifndef GST_DISABLE_PARSE
tcase_add_test (tc_chain, test_rtppayloaders); tcase_add_test (tc_chain, test_rtp_payloaders);
tcase_add_test (tc_chain, test_video_encoders_decoders); tcase_add_test (tc_chain, test_video_encoders_decoders);
#endif #endif
return s; return s;