diff options
author | Torbjörn Andersson | 2004-03-21 16:59:10 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-03-21 16:59:10 +0000 |
commit | 3f997234230a0c960015b8e3a1cefb2e6c1674f4 (patch) | |
tree | e02d440fd4bbaa832570debeb29ef1981de27748 | |
parent | d2bab3e980997a5c77fe7c750c1ab274dd19dfb0 (diff) | |
download | scummvm-rg350-3f997234230a0c960015b8e3a1cefb2e6c1674f4.tar.gz scummvm-rg350-3f997234230a0c960015b8e3a1cefb2e6c1674f4.tar.bz2 scummvm-rg350-3f997234230a0c960015b8e3a1cefb2e6c1674f4.zip |
When I played an Ogg Vorbis-encoded FotAQ I noticed that whenever a sound
effect happened during a line of speech there was a chance - not a
certainty - that the speech would get cut off prematurely.
As far as I can tell, this is because the Vorbis decoder isn't the only one
who's accessing the same file. Now the Vorbis decoder will explicitly seek
to the position where it expects the file to be at before reading from it.
I hope this is the correct fix. It does fix the problem for me, at least.
I don't know if any of the other decoders needs a similar patch. I couldn't
reproduce the problem with my MP3-encoded FotAQ, but there are other
possible explanations for that, e.g. the bug gets harder to trigger the
more sound data that is decoded in each pass.
svn-id: r13353
-rw-r--r-- | sound/vorbis.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 6f2cd53463..370accccc9 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -71,6 +71,9 @@ static size_t read_wrap(void *ptr, size_t size, size_t nmemb, void *datasource) nmemb = 0; else if (nmemb > f->len - f->curr_pos) nmemb = f->len - f->curr_pos; + // There is no guarantee that the Vorbis stream is alone in accessing + // the file, so make sure the current position is what we think it is. + f->file->seek(f->start + f->curr_pos); result = f->file->read(ptr, nmemb); if (result == -1) { f->curr_pos = f->file->pos() - f->start; |