mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
check/gst/gstpipeline.c (test_base_time): Punt around the problem of the probe not being called, because that's not t...
Original commit message from CVS: 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...
This commit is contained in:
parent
eb29555a92
commit
87e4af77a1
3 changed files with 42 additions and 22 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
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>
|
2005-11-15 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
|
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
|
||||||
|
|
|
@ -226,15 +226,8 @@ GST_START_TEST (test_bus)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static void
|
static GMutex *probe_lock;
|
||||||
memory_barrier (void)
|
static GCond *probe_cond;
|
||||||
{
|
|
||||||
gint foo = 1;
|
|
||||||
volatile gint bar;
|
|
||||||
|
|
||||||
/* make sure the other thread sees the update */
|
|
||||||
bar = g_atomic_int_get (&foo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
|
@ -247,7 +240,9 @@ sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
*first_timestamp = GST_BUFFER_TIMESTAMP (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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -283,6 +278,9 @@ GST_START_TEST (test_base_time)
|
||||||
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0,
|
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0,
|
||||||
"stream time doesn't start off at 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
|
/* test the first: that base time is being distributed correctly, timestamps
|
||||||
are correct relative to the running clock and base time */
|
are correct relative to the running clock and base time */
|
||||||
{
|
{
|
||||||
|
@ -295,6 +293,11 @@ GST_START_TEST (test_base_time)
|
||||||
GST_CLOCK_TIME_NONE)
|
GST_CLOCK_TIME_NONE)
|
||||||
== GST_STATE_CHANGE_SUCCESS, "failed state change");
|
== 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,
|
/* now something a little more than lower was distributed as the base time,
|
||||||
* and the buffer was timestamped between 0 and upper-base
|
* and the buffer was timestamped between 0 and upper-base
|
||||||
*/
|
*/
|
||||||
|
@ -352,7 +355,6 @@ GST_START_TEST (test_base_time)
|
||||||
lower = gst_clock_get_time (clock);
|
lower = gst_clock_get_time (clock);
|
||||||
|
|
||||||
observed = GST_CLOCK_TIME_NONE;
|
observed = GST_CLOCK_TIME_NONE;
|
||||||
memory_barrier ();
|
|
||||||
|
|
||||||
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
|
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
|
||||||
|
|
||||||
|
@ -361,6 +363,11 @@ GST_START_TEST (test_base_time)
|
||||||
GST_CLOCK_TIME_NONE)
|
GST_CLOCK_TIME_NONE)
|
||||||
== GST_STATE_CHANGE_SUCCESS, "failed state change");
|
== 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
|
/* 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
|
* to what it was. The buffer will be timestamped between the last stream
|
||||||
* time and upper minus base.
|
* time and upper minus base.
|
||||||
|
|
|
@ -226,15 +226,8 @@ GST_START_TEST (test_bus)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static void
|
static GMutex *probe_lock;
|
||||||
memory_barrier (void)
|
static GCond *probe_cond;
|
||||||
{
|
|
||||||
gint foo = 1;
|
|
||||||
volatile gint bar;
|
|
||||||
|
|
||||||
/* make sure the other thread sees the update */
|
|
||||||
bar = g_atomic_int_get (&foo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
|
@ -247,7 +240,9 @@ sink_pad_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
*first_timestamp = GST_BUFFER_TIMESTAMP (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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -283,6 +278,9 @@ GST_START_TEST (test_base_time)
|
||||||
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0,
|
fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0,
|
||||||
"stream time doesn't start off at 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
|
/* test the first: that base time is being distributed correctly, timestamps
|
||||||
are correct relative to the running clock and base time */
|
are correct relative to the running clock and base time */
|
||||||
{
|
{
|
||||||
|
@ -295,6 +293,11 @@ GST_START_TEST (test_base_time)
|
||||||
GST_CLOCK_TIME_NONE)
|
GST_CLOCK_TIME_NONE)
|
||||||
== GST_STATE_CHANGE_SUCCESS, "failed state change");
|
== 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,
|
/* now something a little more than lower was distributed as the base time,
|
||||||
* and the buffer was timestamped between 0 and upper-base
|
* and the buffer was timestamped between 0 and upper-base
|
||||||
*/
|
*/
|
||||||
|
@ -352,7 +355,6 @@ GST_START_TEST (test_base_time)
|
||||||
lower = gst_clock_get_time (clock);
|
lower = gst_clock_get_time (clock);
|
||||||
|
|
||||||
observed = GST_CLOCK_TIME_NONE;
|
observed = GST_CLOCK_TIME_NONE;
|
||||||
memory_barrier ();
|
|
||||||
|
|
||||||
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
|
fail_unless (lower >= upper + GST_SECOND, "clock did not advance?");
|
||||||
|
|
||||||
|
@ -361,6 +363,11 @@ GST_START_TEST (test_base_time)
|
||||||
GST_CLOCK_TIME_NONE)
|
GST_CLOCK_TIME_NONE)
|
||||||
== GST_STATE_CHANGE_SUCCESS, "failed state change");
|
== 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
|
/* 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
|
* to what it was. The buffer will be timestamped between the last stream
|
||||||
* time and upper minus base.
|
* time and upper minus base.
|
||||||
|
|
Loading…
Reference in a new issue