Remove deprecated GTimeVal

GTimeVal won't work past 2038
This commit is contained in:
Olivier Crête 2019-12-10 17:06:02 -05:00
parent e79def14a5
commit 0a8d14acc9
3 changed files with 10 additions and 13 deletions

View file

@ -589,11 +589,11 @@ gst_system_clock_get_internal_time (GstClock * clock)
#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
{

View file

@ -171,16 +171,13 @@ static gboolean gst_collect_pads_query_default_internal (GstCollectPads *
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

View file

@ -265,7 +265,7 @@ final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
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"));
@ -288,10 +288,10 @@ final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
/* 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);