av_gettime_relative() is using the monotonic clock therefore more suitable for relative time calculations.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -1133,11 +1133,11 @@ static int plot_cqt(AVFilterContext *ctx, AVFrame **frameout) · 1132 unmodified lines | |||
| 1133 | int64_t last_time, cur_time; | 1133 | int64_t last_time, cur_time; |
| 1134 | 1134 | ||
| 1135 | #define UPDATE_TIME(t) \ | 1135 | #define UPDATE_TIME(t) \ |
| 1136 | cur_time = av_gettime(); \ | 1136 | cur_time = av_gettime_relative(); \ |
| 1137 | t += cur_time - last_time; \ | 1137 | t += cur_time - last_time; \ |
| 1138 | last_time = cur_time | 1138 | last_time = cur_time |
| 1139 | 1139 | ||
| 1140 | last_time = av_gettime(); | 1140 | last_time = av_gettime_relative(); |
| 1141 | 1141 | ||
| 1142 | memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data)); | 1142 | memcpy(s->fft_result, s->fft_data, s->fft_len * sizeof(*s->fft_data)); |
| 1143 | if (s->attack_data) { | 1143 | if (s->attack_data) { |