Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2021-02-07 02:55:25 +0300
committerMarton Balint <cus@passwd.hu>2021-02-27 23:41:50 +0300
commit2d32aed85c4874a2596202b6f0c08e6ce49e3bca (patch)
tree3a59a78746a61ffa1bcf93774d6e4ef009bf3fc7 /libavdevice/gdigrab.c
parent529bf5daf2935fb87787d7f7a5263e1b254d59d2 (diff)
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/gdigrab.c')
-rw-r--r--libavdevice/gdigrab.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index f4444406fa..9b2c55fe90 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -394,7 +394,7 @@ gdigrab_read_header(AVFormatContext *s1)
gdigrab->header_size = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) +
(bpp <= 8 ? (1 << bpp) : 0) * sizeof(RGBQUAD) /* palette size */;
gdigrab->time_base = av_inv_q(gdigrab->framerate);
- gdigrab->time_frame = av_gettime() / av_q2d(gdigrab->time_base);
+ gdigrab->time_frame = av_gettime_relative() / av_q2d(gdigrab->time_base);
gdigrab->hwnd = hwnd;
gdigrab->source_hdc = source_hdc;
@@ -551,7 +551,7 @@ static int gdigrab_read_packet(AVFormatContext *s1, AVPacket *pkt)
/* wait based on the frame rate */
for (;;) {
- curtime = av_gettime();
+ curtime = av_gettime_relative();
delay = time_frame * av_q2d(time_base) - curtime;
if (delay <= 0) {
if (delay < INT64_C(-1000000) * av_q2d(time_base)) {
@@ -568,7 +568,7 @@ static int gdigrab_read_packet(AVFormatContext *s1, AVPacket *pkt)
if (av_new_packet(pkt, file_size) < 0)
return AVERROR(ENOMEM);
- pkt->pts = curtime;
+ pkt->pts = av_gettime();
/* Blit screen grab */
if (!BitBlt(dest_hdc, 0, 0,