Skip to content
Snippets Groups Projects
Commit 41120e6e authored by Olivier Langlois's avatar Olivier Langlois Committed by Michael Niedermayer
Browse files

tools: Use av_gettime_relative()


Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.

Signed-off-by: default avatarOlivier Langlois <olivier@trillion01.com>
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent b052bccb
No related branches found
No related tags found
No related merge requests found
...@@ -82,7 +82,7 @@ int main(int argc, char **argv) ...@@ -82,7 +82,7 @@ int main(int argc, char **argv)
goto fail; goto fail;
} }
start_time = av_gettime(); start_time = av_gettime_relative();
while (1) { while (1) {
uint8_t buf[1024]; uint8_t buf[1024];
int n; int n;
...@@ -93,7 +93,7 @@ int main(int argc, char **argv) ...@@ -93,7 +93,7 @@ int main(int argc, char **argv)
stream_pos += n; stream_pos += n;
if (bps) { if (bps) {
avio_flush(output); avio_flush(output);
while ((av_gettime() - start_time) * bps / AV_TIME_BASE < stream_pos) while ((av_gettime_relative() - start_time) * bps / AV_TIME_BASE < stream_pos)
av_usleep(50 * 1000); av_usleep(50 * 1000);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment