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

R.L. Horn lists at eastcheap.org
Tue Sep 12 06:14:51 PDT 2006


On Mon, 11 Sep 2006, Aleksey Surkov wrote:

>> Are you sure the .wav files being produced at the intermediate step are
>> valid?

> Yes, they are valid. I can play it.

That's not a sufficient test of validity.

> More, after converting (changing frequency) by CDex the files can be
> compressed again correctly.

That tends to support the "bad wav file" (or at least something your code
isn't handling) theory.

> For example, I have a test wav file (88 kb), the described bug occurs
> with it:
> http://rapidshare.de/files/32738670/0008.wav.html

Yuck.  And (apparently) host-targeted advertising to boot.

Oh well, I had a look at the file, and it appears to be perfectly valid... 
*however*:

Following the data chunk are 'bext', 'minf', 'elm1', 'regn', 'ovwf', and
'umid' chunks.  These will cause problems if your code isn't skipping
unrecognized chunks.  In particular:

     while( bytesRead = wavFile.ReadData( readBuffer, ReadBufferSize ) ) {

looks like something that reads to EOF (i.e. a method that calls fread()).
You need to read in just the data chunk bytes and start parsing again.  In
fact, it's entirely possible, albeit uncommon, for the audio to be
fragmented into more than one data chunk.



More information about the Vorbis-dev mailing list