aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-13 22:07:34 +0100
committerJohannes Schickel2011-02-13 22:07:34 +0100
commit87c81566b429693d96ef7da7196d5503c33cde91 (patch)
tree5299f4908bcf4223e374c0a0f4e09284625f6848
parent4e6c02563341184c98f231db95c5d1972b59d03b (diff)
downloadscummvm-rg350-87c81566b429693d96ef7da7196d5503c33cde91.tar.gz
scummvm-rg350-87c81566b429693d96ef7da7196d5503c33cde91.tar.bz2
scummvm-rg350-87c81566b429693d96ef7da7196d5503c33cde91.zip
AUDIO: Fix assertion triggered by SubSeekableAudioStream constructor.
This assertion was introduced with 633b8ed27784. I change the code to first convert all parameters to the audio stream's framerate to avoid a possible use of operator- on two AudioTimestamps with different framerates.
-rw-r--r--audio/audiostream.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 46b2846137..0c41a38254 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -228,8 +228,8 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, DisposeAfterUse::Flag disposeAfterUse)
: _parent(parent), _disposeAfterUse(disposeAfterUse),
_start(convertTimeToStreamPos(start, getRate(), isStereo())),
- _pos(0, getRate() * (isStereo() ? 2 : 1)),
- _length(convertTimeToStreamPos(end - start, getRate(), isStereo())) {
+ _pos(0, getRate() * (isStereo() ? 2 : 1)),
+ _length(convertTimeToStreamPos(end, getRate(), isStereo()) - _start) {
assert(_length.totalNumberOfFrames() % (isStereo() ? 2 : 1) == 0);
_parent->seek(_start);