[FFmpeg-cvslog] lavd: Use av_gettime_relative()

Olivier Langlois git at videolan.org
Sun May 18 16:15:38 CEST 2014


ffmpeg | branch: master | Olivier Langlois <olivier at trillion01.com> | Mon May 12 16:26:36 2014 -0400| [0a150670476bc8c38df7add4c59826bff73c204e] | committer: Michael Niedermayer

lavd: Use av_gettime_relative()

Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.

Since v4l2 is compiled only on Linux where av_gettime_relative()
is monotonic, a small wrapper function av_gettime_monotonic() is used
(should be inlined the compiler) to put emphasis on that fact.

Signed-off-by: Olivier Langlois <olivier at trillion01.com>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a150670476bc8c38df7add4c59826bff73c204e
---

 libavdevice/v4l2.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 4b3f6a8..bbd4892 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -427,10 +427,7 @@ static void mmap_release_buffer(void *opaque, uint8_t *data)
 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
 static int64_t av_gettime_monotonic(void)
 {
-    struct timespec tv;
-
-    clock_gettime(CLOCK_MONOTONIC, &tv);
-    return (int64_t)tv.tv_sec * 1000000 + tv.tv_nsec / 1000;
+    return av_gettime_relative();
 }
 #endif
 



More information about the ffmpeg-cvslog mailing list