+2005-11-15 Andy Wingo <wingo@pobox.com>
+
+ * check/gst/gstpipeline.c (test_base_time): Punt around the
+ problem of the probe not being called, because that's not the
+ issue I'm looking at...
+
2005-11-15 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
GST_END_TEST;
-static void
-memory_barrier (void)
-{
- gint foo = 1;
- volatile gint bar;
-
- /* make sure the other thread sees the update */
- bar = g_atomic_int_get (&foo);
-}
+static GMutex *probe_lock;
+static GCond *probe_cond;
static gboolean
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
*first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
}
- memory_barrier ();
+ g_mutex_lock (probe_lock);
+ g_cond_signal (probe_cond);
+ g_mutex_unlock (probe_lock);
return TRUE;
}
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (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 */
{
GST_CLOCK_TIME_NONE)
== GST_STATE_CHANGE_SUCCESS, "failed state change");
+ g_mutex_lock (probe_lock);
+ while (observed == GST_CLOCK_TIME_NONE)
+ 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
*/
lower = gst_clock_get_time (clock);
observed = GST_CLOCK_TIME_NONE;
- memory_barrier ();
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
GST_CLOCK_TIME_NONE)
== GST_STATE_CHANGE_SUCCESS, "failed state change");
+ g_mutex_lock (probe_lock);
+ while (observed == GST_CLOCK_TIME_NONE)
+ g_cond_wait (probe_cond, probe_lock);
+ g_mutex_unlock (probe_lock);
+
/* now the base time should have advanced by more than GST_SECOND compared
* to what it was. The buffer will be timestamped between the last stream
* time and upper minus base.
GST_END_TEST;
-static void
-memory_barrier (void)
-{
- gint foo = 1;
- volatile gint bar;
-
- /* make sure the other thread sees the update */
- bar = g_atomic_int_get (&foo);
-}
+static GMutex *probe_lock;
+static GCond *probe_cond;
static gboolean
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
*first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
}
- memory_barrier ();
+ g_mutex_lock (probe_lock);
+ g_cond_signal (probe_cond);
+ g_mutex_unlock (probe_lock);
return TRUE;
}
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (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 */
{
GST_CLOCK_TIME_NONE)
== GST_STATE_CHANGE_SUCCESS, "failed state change");
+ g_mutex_lock (probe_lock);
+ while (observed == GST_CLOCK_TIME_NONE)
+ 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
*/
lower = gst_clock_get_time (clock);
observed = GST_CLOCK_TIME_NONE;
- memory_barrier ();
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
GST_CLOCK_TIME_NONE)
== GST_STATE_CHANGE_SUCCESS, "failed state change");
+ g_mutex_lock (probe_lock);
+ while (observed == GST_CLOCK_TIME_NONE)
+ g_cond_wait (probe_cond, probe_lock);
+ g_mutex_unlock (probe_lock);
+
/* now the base time should have advanced by more than GST_SECOND compared
* to what it was. The buffer will be timestamped between the last stream
* time and upper minus base.