spa: add spa_ratelimit

This commit is contained in:
Wim Taymans 2023-07-11 19:25:13 +02:00
parent 17bc9d520e
commit dc07c2321b
8 changed files with 76 additions and 69 deletions

View file

@ -216,10 +216,11 @@ int stream_send_underflow(struct stream *stream, int64_t offset)
struct client *client = stream->client;
struct impl *impl = client->impl;
struct message *reply;
int missed;
if (ratelimit_test(&impl->rate_limit, stream->timestamp, SPA_LOG_LEVEL_INFO)) {
pw_log_info("[%s]: UNDERFLOW channel:%u offset:%" PRIi64,
client->name, stream->channel, offset);
if ((missed = spa_ratelimit_test(&impl->rate_limit, stream->timestamp)) >= 0) {
pw_log_info("[%s]: UNDERFLOW channel:%u offset:%" PRIi64" (%d missed)",
client->name, stream->channel, offset, missed);
}
reply = message_alloc(impl, -1, 0);