Skip to content

Commit

Permalink
AUDIO: Fix assertion triggered by SubSeekableAudioStream constructor.
Browse files Browse the repository at this point in the history
This assertion was introduced with 633b8ed. 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.
  • Loading branch information
Johannes Schickel committed Feb 13, 2011
1 parent 4e6c025 commit 87c8156
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions audio/audiostream.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 87c8156

Please sign in to comment.