aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2015-01-24 14:54:25 +0100
committerTorbjörn Andersson2015-01-24 14:57:47 +0100
commitca83ecd8c22c132da3f9b8963ffb76702692a272 (patch)
treeccafc96758e3aaaf11a41fc40453a148bcd3e35d
parentbf3e2bca07636afa307efc9e880548023f249e9b (diff)
downloadscummvm-rg350-ca83ecd8c22c132da3f9b8963ffb76702692a272.tar.gz
scummvm-rg350-ca83ecd8c22c132da3f9b8963ffb76702692a272.tar.bz2
scummvm-rg350-ca83ecd8c22c132da3f9b8963ffb76702692a272.zip
ZVISION: Fix lag at beginning of cutscenes
We have to update _curChunk when decoding audio, otherwise it will decode the entire audio track on the first frame. For the ZGI intro this would take 700-800 ms, and since the audio started playing before the video it looked to me as if it had to play the first bit faster to catch up. Thanks to fuzzie for setting me on the right track with an off-hand remark about the Zork AVI decoder (I was looking at the standard AVI decoder), and for finding the cause a few seconds before I did.
-rw-r--r--engines/zvision/video/zork_avi_decoder.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/zvision/video/zork_avi_decoder.cpp b/engines/zvision/video/zork_avi_decoder.cpp
index 5618250d79..abf48543c9 100644
--- a/engines/zvision/video/zork_avi_decoder.cpp
+++ b/engines/zvision/video/zork_avi_decoder.cpp
@@ -39,6 +39,7 @@ Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDec
}
void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
+ bool updateCurChunk = true;
if (_audStream) {
if (_wvInfo.tag == kWaveFormatZorkPCM) {
assert(_wvInfo.size == 8);
@@ -54,9 +55,17 @@ void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *s
_audStream->queueBuffer((byte *)chunk.data, chunk.size, DisposeAfterUse::YES, flags);
}
} else {
+ updateCurChunk = false;
AVIAudioTrack::queueSound(stream);
}
}
+
+ // The superclass always updates _curChunk, whether or not audio has
+ // been queued, so we should do that too. Unless the superclass already
+ // has done it for us.
+ if (updateCurChunk) {
+ _curChunk++;
+ }
}
void ZorkAVIDecoder::ZorkAVIAudioTrack::resetStream() {