diff options
author | Marton Balint <cus@passwd.hu> | 2021-02-07 00:55:25 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-02-27 21:41:50 +0100 |
commit | 2d32aed85c4874a2596202b6f0c08e6ce49e3bca (patch) | |
tree | 3a59a78746a61ffa1bcf93774d6e4ef009bf3fc7 /libavdevice/kmsgrab.c | |
parent | 529bf5daf2935fb87787d7f7a5263e1b254d59d2 (diff) | |
download | ffmpeg-2d32aed85c4874a2596202b6f0c08e6ce49e3bca.tar.gz |
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 <cus@passwd.hu>
Diffstat (limited to 'libavdevice/kmsgrab.c')
-rw-r--r-- | libavdevice/kmsgrab.c | 5 |
1 files changed, 3 insertions, 2 deletions
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) { |