aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-01 17:44:54 +0000
committerTorbjörn Andersson2005-05-01 17:44:54 +0000
commit81c84b683ebb9f107186b4f43847bc5a61fb60e8 (patch)
tree4e661f15c51a04c4d7a22cf65403c19ef4bf4c24
parent777618ddf9ca3f5151e0aa6bd57125930e2c75d0 (diff)
downloadscummvm-rg350-81c84b683ebb9f107186b4f43847bc5a61fb60e8.tar.gz
scummvm-rg350-81c84b683ebb9f107186b4f43847bc5a61fb60e8.tar.bz2
scummvm-rg350-81c84b683ebb9f107186b4f43847bc5a61fb60e8.zip
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
-rw-r--r--graphics/animation.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/graphics/animation.cpp b/graphics/animation.cpp
index 6dd98c7915..1401d642c9 100644
--- a/graphics/animation.cpp
+++ b/graphics/animation.cpp
@@ -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)