module-pipe: warn underrun only once

This commit is contained in:
Wim Taymans 2024-02-01 15:57:23 +01:00
parent b147753554
commit 0b6d763ed5

View file

@ -203,6 +203,7 @@ struct impl {
uint64_t next_time; uint64_t next_time;
unsigned int have_sync:1; unsigned int have_sync:1;
unsigned int underrun:1;
}; };
static uint64_t get_time_ns(struct impl *impl) static uint64_t get_time_ns(struct impl *impl)
@ -407,7 +408,10 @@ static void capture_stream_process(void *data)
if (avail < (int32_t)size) { if (avail < (int32_t)size) {
memset(bd->data, 0, size); memset(bd->data, 0, size);
if (avail >= 0) { if (avail >= 0) {
pw_log_warn("underrun %d < %u", avail, size); if (!impl->underrun) {
pw_log_warn("underrun %d < %u", avail, size);
impl->underrun = true;
}
pause_stream(impl, true); pause_stream(impl, true);
} }
impl->have_sync = false; impl->have_sync = false;
@ -429,6 +433,7 @@ static void capture_stream_process(void *data)
index += avail; index += avail;
spa_ringbuffer_read_update(&impl->ring, index); spa_ringbuffer_read_update(&impl->ring, index);
impl->underrun = false;
} }
bd->chunk->offset = 0; bd->chunk->offset = 0;
bd->chunk->size = size; bd->chunk->size = size;