mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 12:15:19 +00:00
testclock: minor cleanups, add since markers for gtk-doc
https://bugzilla.gnome.org/show_bug.cgi?id=683012
This commit is contained in:
parent
4eeb471e11
commit
c6cc50e6de
3 changed files with 73 additions and 40 deletions
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/* GstTestClock - A deterministic clock for GStreamer unit tests
|
||||||
* A deterministic clock for GStreamer unit tests
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
* Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
||||||
* Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
|
* Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
|
||||||
|
@ -173,12 +172,16 @@
|
||||||
* arguments. This will highlight any issues with the unit test code itself.
|
* arguments. This will highlight any issues with the unit test code itself.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gsttestclock.h"
|
#include "gsttestclock.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_START_TIME,
|
PROP_START_TIME
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GstClockEntryContext GstClockEntryContext;
|
typedef struct _GstClockEntryContext GstClockEntryContext;
|
||||||
|
@ -238,8 +241,8 @@ static void gst_test_clock_add_entry (GstTestClock * test_clock,
|
||||||
GstClockEntry * entry, GstClockTimeDiff * jitter);
|
GstClockEntry * entry, GstClockTimeDiff * jitter);
|
||||||
static void gst_test_clock_remove_entry (GstTestClock * test_clock,
|
static void gst_test_clock_remove_entry (GstTestClock * test_clock,
|
||||||
GstClockEntry * entry);
|
GstClockEntry * entry);
|
||||||
static GstClockEntryContext *gst_test_clock_lookup_entry_context (
|
static GstClockEntryContext *gst_test_clock_lookup_entry_context (GstTestClock *
|
||||||
GstTestClock * test_clock, GstClockEntry * clock_entry);
|
test_clock, GstClockEntry * clock_entry);
|
||||||
|
|
||||||
static gint gst_clock_entry_context_compare_func (gconstpointer a,
|
static gint gst_clock_entry_context_compare_func (gconstpointer a,
|
||||||
gconstpointer b);
|
gconstpointer b);
|
||||||
|
@ -261,10 +264,10 @@ gst_test_clock_class_init (GstTestClockClass * klass)
|
||||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_test_clock_get_property);
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_test_clock_get_property);
|
||||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_test_clock_set_property);
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_test_clock_set_property);
|
||||||
|
|
||||||
gstclock_class->get_resolution = GST_DEBUG_FUNCPTR (
|
gstclock_class->get_resolution =
|
||||||
gst_test_clock_get_resolution);
|
GST_DEBUG_FUNCPTR (gst_test_clock_get_resolution);
|
||||||
gstclock_class->get_internal_time = GST_DEBUG_FUNCPTR (
|
gstclock_class->get_internal_time =
|
||||||
gst_test_clock_get_internal_time);
|
GST_DEBUG_FUNCPTR (gst_test_clock_get_internal_time);
|
||||||
gstclock_class->wait = GST_DEBUG_FUNCPTR (gst_test_clock_wait);
|
gstclock_class->wait = GST_DEBUG_FUNCPTR (gst_test_clock_wait);
|
||||||
gstclock_class->wait_async = GST_DEBUG_FUNCPTR (gst_test_clock_wait_async);
|
gstclock_class->wait_async = GST_DEBUG_FUNCPTR (gst_test_clock_wait_async);
|
||||||
gstclock_class->unschedule = GST_DEBUG_FUNCPTR (gst_test_clock_unschedule);
|
gstclock_class->unschedule = GST_DEBUG_FUNCPTR (gst_test_clock_unschedule);
|
||||||
|
@ -357,8 +360,7 @@ gst_test_clock_get_property (GObject * object, guint property_id,
|
||||||
g_value_set_uint64 (value, priv->start_time);
|
g_value_set_uint64 (value, priv->start_time);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_CLASS (parent_class)->set_property (object, property_id, value,
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
pspec);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,8 +380,7 @@ gst_test_clock_set_property (GObject * object, guint property_id,
|
||||||
GST_TIME_ARGS (priv->start_time));
|
GST_TIME_ARGS (priv->start_time));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_CLASS (parent_class)->set_property (object, property_id, value,
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
pspec);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,8 +429,7 @@ gst_test_clock_wait (GstClock * clock,
|
||||||
GST_CLOCK_ENTRY_STATUS (entry) = GST_CLOCK_BUSY;
|
GST_CLOCK_ENTRY_STATUS (entry) = GST_CLOCK_BUSY;
|
||||||
|
|
||||||
while (GST_CLOCK_ENTRY_STATUS (entry) == GST_CLOCK_BUSY)
|
while (GST_CLOCK_ENTRY_STATUS (entry) == GST_CLOCK_BUSY)
|
||||||
g_cond_wait (priv->entry_processed_cond,
|
g_cond_wait (priv->entry_processed_cond, GST_OBJECT_GET_LOCK (test_clock));
|
||||||
GST_OBJECT_GET_LOCK (test_clock));
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (test_clock);
|
GST_OBJECT_UNLOCK (test_clock);
|
||||||
|
|
||||||
|
@ -508,8 +508,7 @@ gst_test_clock_add_entry (GstTestClock * test_clock,
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
GstClockEntryContext *ctx;
|
GstClockEntryContext *ctx;
|
||||||
|
|
||||||
now = gst_clock_adjust_unlocked (GST_CLOCK (test_clock),
|
now = gst_clock_adjust_unlocked (GST_CLOCK (test_clock), priv->internal_time);
|
||||||
priv->internal_time);
|
|
||||||
|
|
||||||
if (jitter != NULL)
|
if (jitter != NULL)
|
||||||
*jitter = GST_CLOCK_DIFF (GST_CLOCK_ENTRY_TIME (entry), now);
|
*jitter = GST_CLOCK_DIFF (GST_CLOCK_ENTRY_TIME (entry), now);
|
||||||
|
@ -577,6 +576,8 @@ gst_clock_entry_context_compare_func (gconstpointer a, gconstpointer b)
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a #GstTestClock cast to #GstClock.
|
* Returns: (transfer full): a #GstTestClock cast to #GstClock.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
GstClock *
|
GstClock *
|
||||||
gst_test_clock_new (void)
|
gst_test_clock_new (void)
|
||||||
|
@ -593,6 +594,8 @@ gst_test_clock_new (void)
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a #GstTestClock cast to #GstClock.
|
* Returns: (transfer full): a #GstTestClock cast to #GstClock.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
GstClock *
|
GstClock *
|
||||||
gst_test_clock_new_with_start_time (GstClockTime start_time)
|
gst_test_clock_new_with_start_time (GstClockTime start_time)
|
||||||
|
@ -612,6 +615,8 @@ gst_test_clock_new_with_start_time (GstClockTime start_time)
|
||||||
* gst_clock_get_time() is a programming error.
|
* gst_clock_get_time() is a programming error.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time)
|
gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time)
|
||||||
|
@ -642,10 +647,11 @@ gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time)
|
||||||
* @delta which is negative or zero is a programming error.
|
* @delta which is negative or zero is a programming error.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_test_clock_advance_time (GstTestClock * test_clock,
|
gst_test_clock_advance_time (GstTestClock * test_clock, GstClockTimeDiff delta)
|
||||||
GstClockTimeDiff delta)
|
|
||||||
{
|
{
|
||||||
GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock);
|
GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock);
|
||||||
|
|
||||||
|
@ -673,6 +679,8 @@ gst_test_clock_advance_time (GstTestClock * test_clock,
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*
|
*
|
||||||
* Returns: the number of pending clock notifications.
|
* Returns: the number of pending clock notifications.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
gst_test_clock_peek_id_count (GstTestClock * test_clock)
|
gst_test_clock_peek_id_count (GstTestClock * test_clock)
|
||||||
|
@ -700,6 +708,8 @@ gst_test_clock_peek_id_count (GstTestClock * test_clock)
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the clock has been asked to provide the given clock
|
* Returns: %TRUE if the clock has been asked to provide the given clock
|
||||||
* notification, %FALSE otherwise.
|
* notification, %FALSE otherwise.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id)
|
gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id)
|
||||||
|
@ -729,6 +739,8 @@ gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id)
|
||||||
*
|
*
|
||||||
* Return: %TRUE if @pending_id is the next clock notification to be
|
* Return: %TRUE if @pending_id is the next clock notification to be
|
||||||
* triggered, %FALSE otherwise.
|
* triggered, %FALSE otherwise.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
|
gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
|
||||||
|
@ -757,6 +769,8 @@ gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
|
||||||
* to the pending clock notification is stored in @pending_id.
|
* to the pending clock notification is stored in @pending_id.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
||||||
|
@ -771,7 +785,8 @@ gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
||||||
while (priv->entry_contexts == NULL)
|
while (priv->entry_contexts == NULL)
|
||||||
g_cond_wait (priv->entry_added_cond, GST_OBJECT_GET_LOCK (test_clock));
|
g_cond_wait (priv->entry_added_cond, GST_OBJECT_GET_LOCK (test_clock));
|
||||||
|
|
||||||
g_assert (gst_test_clock_peek_next_pending_id_unlocked (test_clock, pending_id));
|
g_assert (gst_test_clock_peek_next_pending_id_unlocked (test_clock,
|
||||||
|
pending_id));
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (test_clock);
|
GST_OBJECT_UNLOCK (test_clock);
|
||||||
}
|
}
|
||||||
|
@ -786,9 +801,12 @@ gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
||||||
* #GstTestClock.
|
* #GstTestClock.
|
||||||
*
|
*
|
||||||
* MT safe.
|
* MT safe.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, guint count)
|
gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
|
||||||
|
guint count)
|
||||||
{
|
{
|
||||||
GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock);
|
GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock);
|
||||||
|
|
||||||
|
@ -811,6 +829,8 @@ gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, guint count
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a #GstClockID containing the next pending clock
|
* Returns: (transfer full): a #GstClockID containing the next pending clock
|
||||||
* notification.
|
* notification.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
GstClockID
|
GstClockID
|
||||||
gst_test_clock_process_next_clock_id (GstTestClock * test_clock)
|
gst_test_clock_process_next_clock_id (GstTestClock * test_clock)
|
||||||
|
@ -873,6 +893,8 @@ gst_test_clock_process_next_clock_id (GstTestClock * test_clock)
|
||||||
* Returns: a #GstClockTime set to the time of the next pending clock
|
* Returns: a #GstClockTime set to the time of the next pending clock
|
||||||
* notification. If no clock notifications have been requested
|
* notification. If no clock notifications have been requested
|
||||||
* %GST_CLOCK_TIME_NONE will be returned.
|
* %GST_CLOCK_TIME_NONE will be returned.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
GstClockTime
|
GstClockTime
|
||||||
gst_test_clock_get_next_entry_time (GstTestClock * test_clock)
|
gst_test_clock_get_next_entry_time (GstTestClock * test_clock)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/* GstTestClock - A deterministic clock for GStreamer unit tests
|
||||||
* A deterministic clock for GStreamer unit tests
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
* Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
||||||
* Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
|
* Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
|
||||||
|
@ -27,7 +26,6 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* --- standard type macros --- */
|
|
||||||
#define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
|
#define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
|
||||||
#define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
|
#define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
|
||||||
GST_TYPE_TEST_CLOCK, GstTestClock))
|
GST_TYPE_TEST_CLOCK, GstTestClock))
|
||||||
|
@ -50,6 +48,8 @@ typedef struct _GstTestClockPrivate GstTestClockPrivate;
|
||||||
*
|
*
|
||||||
* A #GstTestClock structure which is based on a #GstClock along with some
|
* A #GstTestClock structure which is based on a #GstClock along with some
|
||||||
* private data.
|
* private data.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
struct _GstTestClock
|
struct _GstTestClock
|
||||||
{
|
{
|
||||||
|
@ -64,32 +64,42 @@ struct _GstTestClock
|
||||||
* @parent_class: the parent class structure
|
* @parent_class: the parent class structure
|
||||||
*
|
*
|
||||||
* The class of a #GstTestClock, which has no virtual methods to override.
|
* The class of a #GstTestClock, which has no virtual methods to override.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
struct _GstTestClockClass
|
struct _GstTestClockClass
|
||||||
{
|
{
|
||||||
GstClockClass parent_class;
|
GstClockClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_test_clock_get_type (void);
|
GType gst_test_clock_get_type (void);
|
||||||
|
|
||||||
GstClock *gst_test_clock_new (void);
|
GstClock * gst_test_clock_new (void);
|
||||||
GstClock *gst_test_clock_new_with_start_time (GstClockTime start_time);
|
|
||||||
|
|
||||||
void gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time);
|
GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time);
|
||||||
void gst_test_clock_advance_time (GstTestClock * test_clock,
|
|
||||||
GstClockTimeDiff delta);
|
|
||||||
|
|
||||||
guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
|
void gst_test_clock_set_time (GstTestClock * test_clock,
|
||||||
gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
|
GstClockTime new_time);
|
||||||
gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
|
|
||||||
GstClockID * pending_id);
|
|
||||||
void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
|
||||||
GstClockID * pending_id);
|
|
||||||
void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
|
|
||||||
guint count);
|
|
||||||
|
|
||||||
GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
|
void gst_test_clock_advance_time (GstTestClock * test_clock,
|
||||||
GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
|
GstClockTimeDiff delta);
|
||||||
|
|
||||||
|
guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
|
||||||
|
|
||||||
|
gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
|
||||||
|
|
||||||
|
gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
|
||||||
|
GstClockID * pending_id);
|
||||||
|
|
||||||
|
void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
|
||||||
|
GstClockID * pending_id);
|
||||||
|
|
||||||
|
void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
|
||||||
|
guint count);
|
||||||
|
|
||||||
|
GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
|
||||||
|
|
||||||
|
GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
1
tests/check/libs/.gitignore
vendored
1
tests/check/libs/.gitignore
vendored
|
@ -11,6 +11,7 @@ controller
|
||||||
gstlibscpp
|
gstlibscpp
|
||||||
gstnetclientclock
|
gstnetclientclock
|
||||||
gstnettimeprovider
|
gstnettimeprovider
|
||||||
|
gsttestclock
|
||||||
libsabi
|
libsabi
|
||||||
transform1
|
transform1
|
||||||
typefindhelper
|
typefindhelper
|
||||||
|
|
Loading…
Reference in a new issue