mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
audiotraits: Fix crash when encountering corruption in OpenAL stream
Partial backport of #1452
This commit is contained in:
parent
a20996d2aa
commit
718bac1c69
@ -968,23 +968,22 @@ update() {
|
||||
SoundsPlaying sounds_finished;
|
||||
|
||||
double rtc = TrueClock::get_global_ptr()->get_short_time();
|
||||
SoundsPlaying::iterator i=_sounds_playing.begin();
|
||||
for (; i!=_sounds_playing.end(); ++i) {
|
||||
OpenALAudioSound *sound = (*i);
|
||||
SoundsPlaying::iterator it = _sounds_playing.begin();
|
||||
while (it != _sounds_playing.end()) {
|
||||
PT(OpenALAudioSound) sound = *(it++);
|
||||
sound->pull_used_buffers();
|
||||
sound->push_fresh_buffers();
|
||||
sound->restart_stalled_audio();
|
||||
sound->cache_time(rtc);
|
||||
if ((sound->_source == 0)||
|
||||
((sound->_stream_queued.size() == 0)&&
|
||||
if (sound->_source == 0 ||
|
||||
(sound->_stream_queued.empty() &&
|
||||
(sound->_loops_completed >= sound->_playing_loops))) {
|
||||
sounds_finished.insert(*i);
|
||||
sounds_finished.insert(std::move(sound));
|
||||
}
|
||||
}
|
||||
|
||||
i=sounds_finished.begin();
|
||||
for (; i!=sounds_finished.end(); ++i) {
|
||||
(**i).finished();
|
||||
for (OpenALAudioSound *sound : sounds_finished) {
|
||||
sound->finished();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user