Reduce chance for overflows in VorbisTrackInfo::play

svn-id: r25793
This commit is contained in:
Max Horn 2007-02-22 18:33:01 +00:00
parent 8ce7566c8d
commit 82ae8daccf

View File

@ -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);