Comment 7 for bug 235984

Revision history for this message
olo (zulumantee) wrote :

hi there, here are the two earlier mentioned versions of the patch.
what I have done in general is

soundsourceoggvorbis.h

- add a "char* pRead" member to the class "SoundSourceOggVorbis"

soundsourceoggvorbis.cpp

- initialised pointer members with zero in constructor
- used "pRead" pointer to read from the ogg vorbis file instead of the "dest" pointer
- the read loop now also stops when ov_read returns an error code. according to the documentation, ov_read
  can return three error codes which have all a negative number
- in the original version, problems could occure when an error code is returned by ov_read because that return value
  gets added and substracted to "index" and "needed". negative return values could cause infinte loops as "needed"
  would never reach zero. that is fixed by interchanging the order of the ov_read and the variable increment/decrement calls

only in version 1 of the patch

- removed the code that fills the "destination" buffer with zeros

only in version 2 of the patch

- the buffer gets filled with zeros when the end of the file is reached by using the pRead pointer instead of the dest pointer

feel free to check this out and tell me if I missed something or could hve done something in a different way.

greetzz, olo