aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/xcbgrab.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2021-02-07 00:55:25 +0100
committerMarton Balint <cus@passwd.hu>2021-02-27 21:41:50 +0100
commit2d32aed85c4874a2596202b6f0c08e6ce49e3bca (patch)
tree3a59a78746a61ffa1bcf93774d6e4ef009bf3fc7 /libavdevice/xcbgrab.c
parent529bf5daf2935fb87787d7f7a5263e1b254d59d2 (diff)
downloadffmpeg-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/xcbgrab.c')
-rw-r--r--libavdevice/xcbgrab.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index be5d5ea2cf..9604a5aaf2 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -206,7 +206,7 @@ static int64_t wait_frame(AVFormatContext *s, AVPacket *pkt)
c->time_frame += c->frame_duration;
for (;;) {
- curtime = av_gettime();
+ curtime = av_gettime_relative();
delay = c->time_frame - curtime;
if (delay <= 0)
break;
@@ -422,7 +422,8 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret = 0;
int64_t pts;
- pts = wait_frame(s, pkt);
+ wait_frame(s, pkt);
+ pts = av_gettime();
if (c->follow_mouse || c->draw_mouse) {
pc = xcb_query_pointer(c->conn, c->screen->root);
@@ -596,7 +597,7 @@ static int create_stream(AVFormatContext *s)
c->time_base = (AVRational){ st->avg_frame_rate.den,
st->avg_frame_rate.num };
c->frame_duration = av_rescale_q(1, c->time_base, AV_TIME_BASE_Q);
- c->time_frame = av_gettime();
+ c->time_frame = av_gettime_relative();
ret = pixfmt_from_pixmap_format(s, geo->depth, &st->codecpar->format, &c->bpp);
free(geo);