diff options
Diffstat (limited to 'tests/check/gst/gstpipeline.c')
-rw-r--r-- | tests/check/gst/gstpipeline.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/tests/check/gst/gstpipeline.c b/tests/check/gst/gstpipeline.c index 4e34eea..038f340 100644 --- a/tests/check/gst/gstpipeline.c +++ b/tests/check/gst/gstpipeline.c @@ -38,6 +38,7 @@ GST_START_TEST (test_async_state_change_empty) fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING), GST_STATE_CHANGE_SUCCESS); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); gst_object_unref (pipeline); } @@ -60,6 +61,7 @@ GST_START_TEST (test_async_state_change_fake_ready) fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY), GST_STATE_CHANGE_SUCCESS); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); gst_object_unref (pipeline); } @@ -237,13 +239,22 @@ GST_START_TEST (test_bus) GST_END_TEST; -static GMutex *probe_lock; -static GCond *probe_cond; +static GMutex probe_lock; +static GCond probe_cond; -static gboolean -sink_pad_probe (GstPad * pad, GstPadProbeType type, GstBuffer * buffer, - GstClockTime * first_timestamp) +static GstPadProbeReturn +sink_pad_probe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { + GstClockTime *first_timestamp = user_data; + GstBuffer *buffer; + + fail_unless ((GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER)); + + buffer = GST_BUFFER (info->data); + + GST_LOG_OBJECT (pad, "buffer with timestamp %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); + fail_if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE, "testing if buffer timestamps are right, but got CLOCK_TIME_NONE"); @@ -251,11 +262,11 @@ sink_pad_probe (GstPad * pad, GstPadProbeType type, GstBuffer * buffer, *first_timestamp = GST_BUFFER_TIMESTAMP (buffer); } - g_mutex_lock (probe_lock); - g_cond_signal (probe_cond); - g_mutex_unlock (probe_lock); + g_mutex_lock (&probe_lock); + g_cond_signal (&probe_cond); + g_mutex_unlock (&probe_lock); - return TRUE; + return GST_PAD_PROBE_OK; } GST_START_TEST (test_base_time) @@ -277,8 +288,8 @@ GST_START_TEST (test_base_time) gst_element_link (fakesrc, fakesink); sink = gst_element_get_static_pad (fakesink, "sink"); - gst_pad_add_probe (sink, GST_PAD_PROBE_TYPE_BUFFER, - (GstPadProbeCallback) sink_pad_probe, &observed, NULL); + gst_pad_add_probe (sink, GST_PAD_PROBE_TYPE_BUFFER, sink_pad_probe, + &observed, NULL); fail_unless (gst_element_set_state (pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL, "expected no-preroll from live pipeline"); @@ -290,9 +301,6 @@ GST_START_TEST (test_base_time) fail_unless (gst_element_get_start_time (pipeline) == 0, "stream time doesn't start off at 0"); - probe_lock = g_mutex_new (); - probe_cond = g_cond_new (); - /* test the first: that base time is being distributed correctly, timestamps are correct relative to the running clock and base time */ { @@ -305,10 +313,10 @@ GST_START_TEST (test_base_time) GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS, "failed state change"); - g_mutex_lock (probe_lock); + g_mutex_lock (&probe_lock); while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); + g_cond_wait (&probe_cond, &probe_lock); + g_mutex_unlock (&probe_lock); /* now something a little more than lower was distributed as the base time, * and the buffer was timestamped between 0 and upper-base @@ -378,10 +386,10 @@ GST_START_TEST (test_base_time) GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS, "failed state change"); - g_mutex_lock (probe_lock); + g_mutex_lock (&probe_lock); while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); + g_cond_wait (&probe_cond, &probe_lock); + g_mutex_unlock (&probe_lock); /* now the base time should have advanced by more than WAIT_TIME compared * to what it was. The buffer will be timestamped between the last stream @@ -450,10 +458,10 @@ GST_START_TEST (test_base_time) GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS, "failed state change"); - g_mutex_lock (probe_lock); + g_mutex_lock (&probe_lock); while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); + g_cond_wait (&probe_cond, &probe_lock); + g_mutex_unlock (&probe_lock); /* now the base time should be the same as it was, and the timestamp should * be more than WAIT_TIME past what it was. @@ -489,6 +497,8 @@ GST_START_TEST (test_base_time) GST_TIME_ARGS (observed), GST_TIME_ARGS (oldobserved)); } + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (sink); gst_object_unref (clock); gst_object_unref (pipeline); @@ -522,7 +532,7 @@ GST_START_TEST (test_concurrent_create) int i; for (i = 0; i < G_N_ELEMENTS (threads); ++i) { - threads[i] = g_thread_create (pipeline_thread, NULL, TRUE, NULL); + threads[i] = g_thread_try_new ("gst-check", pipeline_thread, NULL, NULL); } for (i = 0; i < G_N_ELEMENTS (threads); ++i) { if (threads[i]) |