mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
module-echo-cancel: drop samples when source not ready
When we can't dequeue a buffer from the source stream, drop the samples instead of leaving them queued in the ringbuffer.
This commit is contained in:
parent
f70b0892ea
commit
fb49759d1f
1 changed files with 13 additions and 14 deletions
|
|
@ -431,11 +431,7 @@ static void process(struct impl *impl)
|
||||||
|
|
||||||
avail = spa_ringbuffer_get_read_index(&impl->out_ring, &oindex);
|
avail = spa_ringbuffer_get_read_index(&impl->out_ring, &oindex);
|
||||||
while (avail >= size) {
|
while (avail >= size) {
|
||||||
if ((cout = pw_stream_dequeue_buffer(impl->source)) == NULL) {
|
if ((cout = pw_stream_dequeue_buffer(impl->source)) != NULL) {
|
||||||
pw_log_debug("out of source buffers: %m");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < impl->out_info.channels; i++) {
|
for (i = 0; i < impl->out_info.channels; i++) {
|
||||||
dd = &cout->buffer->datas[i];
|
dd = &cout->buffer->datas[i];
|
||||||
spa_ringbuffer_read_data(&impl->out_ring, impl->out_buffer[i],
|
spa_ringbuffer_read_data(&impl->out_ring, impl->out_buffer[i],
|
||||||
|
|
@ -445,8 +441,11 @@ static void process(struct impl *impl)
|
||||||
dd->chunk->size = size;
|
dd->chunk->size = size;
|
||||||
dd->chunk->stride = sizeof(float);
|
dd->chunk->stride = sizeof(float);
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_stream_queue_buffer(impl->source, cout);
|
pw_stream_queue_buffer(impl->source, cout);
|
||||||
|
} else {
|
||||||
|
/* drop data as to not cause delay */
|
||||||
|
pw_log_debug("out of source buffers: %m");
|
||||||
|
}
|
||||||
|
|
||||||
oindex += size;
|
oindex += size;
|
||||||
spa_ringbuffer_read_update(&impl->out_ring, oindex);
|
spa_ringbuffer_read_update(&impl->out_ring, oindex);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue