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/fbdev_dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavdevice/fbdev_dec.c') diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c index 6a51816868..586caeef88 100644 --- a/libavdevice/fbdev_dec.c +++ b/libavdevice/fbdev_dec.c @@ -157,11 +157,11 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt) uint8_t *pin, *pout; if (fbdev->time_frame == AV_NOPTS_VALUE) - fbdev->time_frame = av_gettime(); + fbdev->time_frame = av_gettime_relative(); /* wait based on the frame rate */ while (1) { - curtime = av_gettime(); + curtime = av_gettime_relative(); delay = fbdev->time_frame - curtime; av_log(avctx, AV_LOG_TRACE, "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n", @@ -186,7 +186,7 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt) "Error refreshing variable info: %s\n", av_err2str(AVERROR(errno))); } - pkt->pts = curtime; + pkt->pts = av_gettime(); /* compute visible data offset */ pin = fbdev->data + fbdev->bytes_per_pixel * fbdev->varinfo.xoffset + -- cgit v1.2.3