fix: stream stops and dies on underflow

This commit is contained in:
MihailRis 2025-10-30 19:56:07 +03:00
parent ab7bf9c709
commit cf561e78a8
6 changed files with 60 additions and 27 deletions

View file

@ -464,8 +464,15 @@ void audio::update(double delta) {
speaker->update(channel);
}
if (speaker->isStopped()) {
streams.erase(it->first);
it = speakers.erase(it);
auto foundStream = streams.find(it->first);
if (foundStream == streams.end() ||
(!speaker->isManuallyStopped() &&
foundStream->second->isStopOnEnd())) {
streams.erase(it->first);
it = speakers.erase(it);
} else {
it++;
}
} else {
it++;
}