Skip to content

Commit deb8a6a

Browse files
authored
stretch pacing if timer resolution is low (#249)
1 parent f6df97d commit deb8a6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/udx.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,8 @@ update_pacing_time (udx_stream_t *stream) {
15631563
uint64_t now = uv_now(stream->udx->loop); // 1ms granularity
15641564

15651565
if (now > stream->tb_last_refill_ms) {
1566-
stream->tb_available = UDX_PACING_BYTES_PER_MILLISECOND;
1566+
uint64_t factor = now - stream->tb_last_refill_ms;
1567+
stream->tb_available = factor * UDX_PACING_BYTES_PER_MILLISECOND;
15671568
stream->tb_last_refill_ms = now;
15681569
}
15691570
}

0 commit comments

Comments
 (0)