aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2007-02-22 18:33:01 +0000
committerMax Horn2007-02-22 18:33:01 +0000
commit82ae8daccfd3684f277e0ea2e22e8a4288694d47 (patch)
treeca1a5db3d13db5fb1345771e5eb344fcfa786595
parent8ce7566c8d3ffb2e87624a34da971e4513fea103 (diff)
downloadscummvm-rg350-82ae8daccfd3684f277e0ea2e22e8a4288694d47.tar.gz
scummvm-rg350-82ae8daccfd3684f277e0ea2e22e8a4288694d47.tar.bz2
scummvm-rg350-82ae8daccfd3684f277e0ea2e22e8a4288694d47.zip
Reduce chance for overflows in VorbisTrackInfo::play
svn-id: r25793
-rw-r--r--sound/vorbis.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp
index 283050fff2..898730909a 100644
--- a/sound/vorbis.cpp
+++ b/sound/vorbis.cpp
@@ -341,9 +341,10 @@ void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int
return;
}
- // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s)
- uint start = startFrame * 1000 / 75;
- uint end = duration ? ((startFrame + duration) * 1000 / 75) : 0;
+ // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s),
+ // i.e. multiple with a factor of 1000/75 = 40/3
+ uint start = startFrame * 40 / 3;
+ uint end = duration ? ((startFrame + duration) * 40 / 3) : 0;
// ... create an AudioStream ...
VorbisInputStream *input = new VorbisInputStream(file, true, start, end);