From 487a2202d399b910f93c4d384ba81619b969f8ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Tue, 10 Dec 2019 17:09:57 -0500 Subject: [PATCH] tests: Remove deprecated GTimeVal GTimeVal won't work past 2038 --- tests/examples/gl/qt/mousevideooverlay/pipeline.cpp | 10 +++++----- tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp index 28d8cf8..bca4862 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp @@ -175,8 +175,8 @@ gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guin //client draw callback gboolean Pipeline::drawCallback (void * sink, void *context, GstSample * sample, gpointer data) { - static GTimeVal current_time; - static glong last_sec = current_time.tv_sec; + static gint64 current_time; + static glong last_sec = 0; static gint nbFrames = 0; GstVideoFrame v_frame; @@ -194,14 +194,14 @@ gboolean Pipeline::drawCallback (void * sink, void *context, GstSample * sample, texture = *(guint *) v_frame.data[0]; - g_get_current_time (¤t_time); + current_time = g_get_monotonic_time (); nbFrames++ ; - if ((current_time.tv_sec - last_sec) >= 1) + if ((current_time / G_USEC_PER_SEC - last_sec) >= 1) { qDebug ("GRAPHIC FPS = %d", nbFrames); nbFrames = 0; - last_sec = current_time.tv_sec; + last_sec = current_time / G_USEC_PER_SEC; } glEnable(GL_DEPTH_TEST); diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp index 301d3b6..21e38f2 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp @@ -160,8 +160,8 @@ gboolean Pipeline::drawCallback (GstElement * gl_sink, void *context, GstSample static GLfloat xrot = 0; static GLfloat yrot = 0; static GLfloat zrot = 0; - static GTimeVal current_time; - static glong last_sec = current_time.tv_sec; + static gint64 current_time; + static glong last_sec = 0; static gint nbFrames = 0; GstVideoFrame v_frame; @@ -179,14 +179,14 @@ gboolean Pipeline::drawCallback (GstElement * gl_sink, void *context, GstSample texture = *(guint *) v_frame.data[0]; - g_get_current_time (¤t_time); + current_time = g_get_monotonic_time (); nbFrames++ ; - if ((current_time.tv_sec - last_sec) >= 1) + if ((current_time / G_USEC_PER_SEC - last_sec) >= 1) { qDebug ("GRPHIC FPS = %d", nbFrames); nbFrames = 0; - last_sec = current_time.tv_sec; + last_sec = current_time / G_USEC_PER_SEC; } glEnable(GL_DEPTH_TEST); -- 2.7.4