#endif /* G_OS_WIN32 */
#if !defined HAVE_POSIX_TIMERS || !defined HAVE_CLOCK_GETTIME
{
- GTimeVal timeval;
+ gint64 monotime;
- g_get_current_time (&timeval);
+ monotime = g_get_monotonic_time ();
- return GST_TIMEVAL_TO_TIME (timeval);
+ return monotime * 1000;
}
#else
{
g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
#define GST_COLLECT_PADS_EVT_WAIT_TIMED(pads, cookie, timeout) G_STMT_START { \
- GTimeVal __tv; \
- \
- g_get_current_time (&tv); \
- g_time_val_add (&tv, timeout); \
+ gint64 end_time = g_get_monotonic_time () + timeout; \
\
g_mutex_lock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
/* should work unless a lot of event'ing and thread starvation */\
while (cookie == ((GstCollectPads *) pads)->priv->evt_cookie) \
- g_cond_timed_wait (GST_COLLECT_PADS_GET_EVT_COND (pads), \
- GST_COLLECT_PADS_GET_EVT_LOCK (pads), &tv); \
+ g_cond_wait_until (GST_COLLECT_PADS_GET_EVT_COND (pads), \
+ GST_COLLECT_PADS_GET_EVT_LOCK (pads), end_time); \
cookie = ((GstCollectPads *) pads)->priv->evt_cookie; \
g_mutex_unlock (GST_COLLECT_PADS_GET_EVT_LOCK (pads)); \
} G_STMT_END
GstCaps * caps, GstBuffer ** buf)
{
BufferAllocHarness *h;
- GTimeVal deadline;
+ gint64 deadline;
h = g_object_get_qdata (G_OBJECT (pad),
g_quark_from_static_string ("buffer-alloc-harness"));
/* Now wait for it to do that within a second, to avoid deadlocking
* in the event of future changes to the locking semantics. */
g_mutex_lock (&check_mutex);
- g_get_current_time (&deadline);
- deadline.tv_sec += 1;
+ deadline = g_get_monotonic_time ();
+ deadline += G_USEC_PER_SEC;
while (h->bufferalloc_blocked) {
- if (!g_cond_timed_wait (&check_cond, &check_mutex, &deadline))
+ if (!g_cond_wait_until (&check_cond, &check_mutex, deadline))
break;
}
g_mutex_unlock (&check_mutex);