Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX(client): Prevent endless loop when disconnecting PipeWire stream #5648

Merged
merged 1 commit into from May 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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