avfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()

av_gettime_relative() is using the monotonic clock therefore more suitable for
relative time calculations.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2021-02-06 10:17:30 +01:00
parent b69c91bbee
commit 84094f017e

View File

@ -1133,11 +1133,11 @@ static int plot_cqt(AVFilterContext *ctx, AVFrame **frameout)
int64_t last_time, cur_time; int64_t last_time, cur_time;
#define UPDATE_TIME(t) \ #define UPDATE_TIME(t) \
cur_time = av_gettime(); \ cur_time = av_gettime_relative(); \
t += cur_time - last_time; \ t += cur_time - last_time; \
last_time = cur_time last_time = cur_time
last_time = av_gettime(); last_time = av_gettime_relative();
memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data)); memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data));
if (s->attack_data) { if (s->attack_data) {