mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -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;
|
SoundsPlaying sounds_finished;
|
||||||
|
|
||||||
double rtc = TrueClock::get_global_ptr()->get_short_time();
|
double rtc = TrueClock::get_global_ptr()->get_short_time();
|
||||||
SoundsPlaying::iterator i=_sounds_playing.begin();
|
SoundsPlaying::iterator it = _sounds_playing.begin();
|
||||||
for (; i!=_sounds_playing.end(); ++i) {
|
while (it != _sounds_playing.end()) {
|
||||||
OpenALAudioSound *sound = (*i);
|
PT(OpenALAudioSound) sound = *(it++);
|
||||||
sound->pull_used_buffers();
|
sound->pull_used_buffers();
|
||||||
sound->push_fresh_buffers();
|
sound->push_fresh_buffers();
|
||||||
sound->restart_stalled_audio();
|
sound->restart_stalled_audio();
|
||||||
sound->cache_time(rtc);
|
sound->cache_time(rtc);
|
||||||
if ((sound->_source == 0)||
|
if (sound->_source == 0 ||
|
||||||
((sound->_stream_queued.size() == 0)&&
|
(sound->_stream_queued.empty() &&
|
||||||
(sound->_loops_completed >= sound->_playing_loops))) {
|
(sound->_loops_completed >= sound->_playing_loops))) {
|
||||||
sounds_finished.insert(*i);
|
sounds_finished.insert(std::move(sound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i=sounds_finished.begin();
|
for (OpenALAudioSound *sound : sounds_finished) {
|
||||||
for (; i!=sounds_finished.end(); ++i) {
|
sound->finished();
|
||||||
(**i).finished();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user