[Ffmpeg-devel] Bug: wav decoder decodes garbage at end of file

Ulrich von Zadow coder
Mon Jun 26 16:56:36 CEST 2006

Michael Niedermayer wrote:

>>Ok. Does this sound about right?
>>- Define a WAVContext struct in wav.c that contains a single member
>>  wave_chunk_len.
>>- Change wav_iformat so memory for the WAVContext is allocated.
>>- In wav_read_header, set wave_chunk_len
>>- In wav_read_packet, compare s->data_offset+wave_chunk_len to s->pb->pos to
> wrong, url_ftell() is want you want

Ah, cool. I hadn't seen that.

>>  determine how many bytes are left to read. When none are left, set
>>  s->eof_reached=1.
> no, messing with eof_reached is unaceptable

Ok, so what is the correct way?

> also the correct behavior is to parse the chunks afterwards too, even if you
> just skip over them, after all there could in principle be another WAVE chunk

Ok, granted. But unless there's an easy way to do this: Would you accept a patch 
that just stopped parsing after the first wave chunk? Wouldn't that be a lot 
easier to code? There's a definite limit to the time I can spend on this, and I 
assume that there are very few wav files with more than one WAVE chunk.



More information about the ffmpeg-devel mailing list