mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
echo-cancel: drop if playback is not streaming
capture and sink streams may start before playback stream so process() may fail to dequeue a playback buffer. In that case advance the read pointers to avoid building up latency in the ringbuffers.
This commit is contained in:
parent
019b53ace8
commit
a0beb30ba8
1 changed files with 10 additions and 5 deletions
|
|
@ -309,11 +309,6 @@ static void process(struct impl *impl)
|
|||
uint32_t i, size;
|
||||
uint32_t rindex, pindex, oindex, pdindex, avail;
|
||||
|
||||
if (impl->playback != NULL && (pout = pw_stream_dequeue_buffer(impl->playback)) == NULL) {
|
||||
pw_log_debug("out of playback buffers: %m");
|
||||
goto done;
|
||||
}
|
||||
|
||||
size = impl->aec_blocksize;
|
||||
|
||||
/* First read a block from the playback and capture ring buffers */
|
||||
|
|
@ -338,6 +333,16 @@ static void process(struct impl *impl)
|
|||
spa_ringbuffer_get_read_index(&impl->play_ring, &pindex);
|
||||
spa_ringbuffer_get_read_index(&impl->play_delayed_ring, &pdindex);
|
||||
|
||||
if (impl->playback != NULL && (pout = pw_stream_dequeue_buffer(impl->playback)) == NULL) {
|
||||
pw_log_debug("out of playback buffers: %m");
|
||||
|
||||
/* playback stream may not yet be in streaming state, drop play
|
||||
* data to avoid introducing additional playback latency */
|
||||
spa_ringbuffer_read_update(&impl->play_ring, pindex + size);
|
||||
spa_ringbuffer_read_update(&impl->play_delayed_ring, pdindex + size);
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < impl->play_info.channels; i++) {
|
||||
/* echo from sink */
|
||||
play[i] = &play_buf[i][0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue