From 2d32aed85c4874a2596202b6f0c08e6ce49e3bca Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Sun, 7 Feb 2021 00:55:25 +0100 Subject: avdevice: use av_gettime_relative() for elapsed time calculations av_gettime_relative() is using the monotonic clock therefore more suitable for elapsed time calculations. Packet timestamps are still kept absolute, although that should be configurable in the future. Related to ticket #9089. Signed-off-by: Marton Balint --- libavdevice/kmsgrab.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavdevice/kmsgrab.c') diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c index 94e32b9cae..6cc305b16f 100644 --- a/libavdevice/kmsgrab.c +++ b/libavdevice/kmsgrab.c @@ -268,7 +268,7 @@ static int kmsgrab_read_packet(AVFormatContext *avctx, AVPacket *pkt) int64_t now; int err; - now = av_gettime(); + now = av_gettime_relative(); if (ctx->frame_last) { int64_t delay; while (1) { @@ -276,10 +276,11 @@ static int kmsgrab_read_packet(AVFormatContext *avctx, AVPacket *pkt) if (delay <= 0) break; av_usleep(delay); - now = av_gettime(); + now = av_gettime_relative(); } } ctx->frame_last = now; + now = av_gettime(); plane = drmModeGetPlane(ctx->hwctx->fd, ctx->plane_id); if (!plane) { -- cgit v1.2.3