[Scummvm-cvs-logs] CVS: scummvm/graphics animation.cpp,1.27,1.28

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun May 1 10:45:36 CEST 2005


Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3542

Modified Files:
	animation.cpp 
Log Message:
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.


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/animation.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- animation.cpp	26 Apr 2005 11:05:06 -0000	1.27
+++ animation.cpp	1 May 2005 17:44:54 -0000	1.28
@@ -184,10 +184,6 @@
 				 * 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 @@
 					}
 					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)





More information about the Scummvm-git-logs mailing list