[Vorbis-dev] RE: encode, decode and encode again

R.L. Horn lists at eastcheap.org
Sun Sep 17 01:14:10 PDT 2006


On Fri, 15 Sep 2006, Aleksey Surkov wrote:

>> That's not a sufficient test of validity.
>
> How can I check them sufficiently?

The simplest thing is just to do a hex dump and compare the file contents 
against the standard.  The RIFF file structure is pretty simple and 
there's lots of information available...Google for "wav file format" or 
something similar.  One good place to look is:

   http://www.saettler.com/RIFFMCI/riffmci.html

which covers the RIFF format generally.

Of course, you can always write code to automate the process.

When examining your wave files, pay special attention to the file- and 
chunk sizes to be certain they match the file contents.

Be aware that the file size and/or the data chunk size may be (hopefully 
deliberately) invalid in the case of files written to nonseekable streams. 
For example, ogg123 will produce values that correspond to a total file 
size of 2GB (0x7ffffff7 for the file size and 0x7fffffd3 for the data 
chunk size (maybe 4 GB on some architectures).

Also look for data fragmentation and/or chunks like 'slnt' or 'wavl' 
(neither of which I've ever actually encountered in the wild, but you 
never know).

Once the wave files are vetted you can, if necessary, move on to the 
coder.  Your problem sounds sort of like a memory leak and, hopefully, it 
will simply turn out that your code is allocating ridiculously large data 
buffers due to a misinterpretation of the data chunk lengths.


More information about the Vorbis-dev mailing list