2 * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #include <gst/check/gstcheck.h>
23 static int playing = 1;
27 change_state_timeout (gpointer data)
29 GstElement *pipeline = (GstElement *) data;
36 gst_element_set_state (pipeline, GST_STATE_NULL);
39 gst_element_set_state (pipeline, GST_STATE_PLAYING);
46 quit_timeout (gpointer data)
52 GST_START_TEST (test_stress_preroll)
54 GstElement *fakesrc, *fakesink;
57 fakesrc = gst_element_factory_make ("fakesrc", NULL);
58 fakesink = gst_element_factory_make ("fakesink", NULL);
59 pipeline = gst_element_factory_make ("pipeline", NULL);
61 g_return_if_fail (fakesrc && fakesink && pipeline);
63 g_object_set (G_OBJECT (fakesink), "preroll-queue-len", 4, NULL);
65 gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
66 gst_element_link (fakesrc, fakesink);
68 gst_element_set_state (pipeline, GST_STATE_PLAYING);
70 g_timeout_add (500, &change_state_timeout, pipeline);
71 g_timeout_add (10000, &quit_timeout, NULL);
74 g_main_context_iteration (NULL, TRUE);
77 gst_element_set_state (pipeline, GST_STATE_NULL);
78 gst_object_unref (pipeline);
83 GST_START_TEST (test_stress)
85 GstElement *fakesrc, *fakesink, *pipeline;
88 fakesrc = gst_element_factory_make ("fakesrc", NULL);
89 fakesink = gst_element_factory_make ("fakesink", NULL);
90 pipeline = gst_element_factory_make ("pipeline", NULL);
92 g_return_if_fail (fakesrc && fakesink && pipeline);
94 gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
95 gst_element_link (fakesrc, fakesink);
99 gst_element_set_state (pipeline, GST_STATE_PAUSED);
100 gst_element_set_state (pipeline, GST_STATE_PLAYING);
102 gst_element_set_state (pipeline, GST_STATE_PAUSED);
103 gst_element_set_state (pipeline, GST_STATE_PLAYING);
104 gst_element_set_state (pipeline, GST_STATE_PAUSED);
105 gst_element_set_state (pipeline, GST_STATE_READY);
106 gst_element_set_state (pipeline, GST_STATE_PLAYING);
107 gst_element_set_state (pipeline, GST_STATE_PAUSED);
108 gst_element_set_state (pipeline, GST_STATE_READY);
109 gst_element_set_state (pipeline, GST_STATE_PAUSED);
110 gst_element_set_state (pipeline, GST_STATE_NULL);
113 gst_object_unref (pipeline);
121 Suite *s = suite_create ("stress");
122 TCase *tc_chain = tcase_create ("linear");
124 /* Completely disable timeout for this test */
125 tcase_set_timeout (tc_chain, 0);
127 suite_add_tcase (s, tc_chain);
128 tcase_add_test (tc_chain, test_stress);
129 tcase_add_test (tc_chain, test_stress_preroll);
134 GST_CHECK_MAIN (stress);