Skip to content

Commit

Permalink
Merge PR #5648: FIX(client): Prevent endless loop when disconnecting …
Browse files Browse the repository at this point in the history
…PipeWire stream
  • Loading branch information
davidebeatrici committed May 6, 2022
2 parents a23a71b + f244b13 commit d60b861
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mumble/PipeWire.cpp
Expand Up @@ -415,10 +415,14 @@ void PipeWireOutput::processCallback(void *param) {

const uint32_t frames = std::min(data.maxsize / chunk->stride, pwo->iFrameSize);

if (pwo->mix(data.data, frames)) {
chunk->size = frames * chunk->stride;
} else {
chunk->size = 0;
chunk->size = frames * chunk->stride;
if (!pwo->mix(data.data, frames)) {
// When the mixer has no data available to write, we still need to push silence.
// This is to avoid an infinite loop when destroying the stream.
// In that infinite loop, Pipewire would wait until the stream starts draining.
// But this never happens, if we don't push new data.
// Thus pw_stream_destroy() would block forever.
memset(data.data, 0, sizeof(float) * chunk->size);
}

pwo->m_engine->queueBuffer(buffer);
Expand Down

0 comments on commit d60b861

Please sign in to comment.