If the sound ends before the cutscene, fall back on same synchronizing
mechanism as in the no sound case. In particular, don't hang while waiting for the sound to play far enough to go to the next frame. This should fix bug #1192646. svn-id: r17889
This commit is contained in:
parent
777618ddf9
commit
81c84b683e
1 changed files with 7 additions and 6 deletions
|
@ -184,10 +184,6 @@ bool BaseAnimationState::decodeFrame() {
|
|||
* frames if we run behind and delaying if we are too fast
|
||||
*/
|
||||
|
||||
/* Avoid deadlock is sound was too far ahead */
|
||||
if (_bgSoundStream && !_snd->isSoundHandleActive(_bgSound))
|
||||
return false;
|
||||
|
||||
if (checkPaletteSwitch() || (_bgSoundStream == NULL) ||
|
||||
((_snd->getSoundElapsedTime(_bgSound) * 12) / 1000 < _frameNum + 1) ||
|
||||
_frameSkipped > 10) {
|
||||
|
@ -197,9 +193,14 @@ bool BaseAnimationState::decodeFrame() {
|
|||
}
|
||||
drawYUV(sequence_i->width, sequence_i->height, _mpegInfo->display_fbuf->buf);
|
||||
|
||||
if (_bgSoundStream) {
|
||||
while ((_snd->getSoundElapsedTime(_bgSound) * 12) / 1000 < _frameNum)
|
||||
if (_bgSoundStream && _snd->isSoundHandleActive(_bgSound)) {
|
||||
while (_snd->isSoundHandleActive(_bgSound) && (_snd->getSoundElapsedTime(_bgSound) * 12) / 1000 < _frameNum) {
|
||||
_sys->delayMillis(10);
|
||||
}
|
||||
// In case the background sound ends prematurely, update
|
||||
// _ticks so that we can still fall back on the no-sound
|
||||
// sync case for the subsequent frames.
|
||||
_ticks = _sys->getMillis();
|
||||
} else {
|
||||
_ticks += 83;
|
||||
while (_sys->getMillis() < _ticks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue