Skip to content
Snippets Groups Projects
Commit 26694c15 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

ringbufferpool: do not return a frame if nothing is mixed

This avoid an infinite loop in pulselayer cause during a short
moment the ringbufferpool will contains two binding mixed together
with nothing being mixed. So AudioLayer::getToPlay will just
lock forever and the pulselayer will not be able to stop the
mainloop

Change-Id: Ic6e316308de6ec37f9c7525e1601e14593fd17d1
parent 66574802
No related branches found
No related tags found
No related merge requests found
......@@ -267,20 +267,22 @@ RingBufferPool::getData(const std::string& call_id)
const auto bindings = getReadBindings(call_id);
if (not bindings)
return 0;
return {};
// No mixing
if (bindings->size() == 1)
return (*bindings->cbegin())->get(call_id);
auto mixBuffer = std::make_shared<AudioFrame>(internalAudioFormat_);
auto mixed = false;
for (const auto& rbuf : *bindings) {
if (auto b = rbuf->get(call_id)) {
mixed = true;
mixBuffer->mix(*b);
}
}
return mixBuffer;
return mixed ? mixBuffer : nullptr;
}
bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment