Due to recent changes to filter_chain.c, the convert functions of all
activated filters are called even if there is no output availabe since
the ogg vorbis decoder needs this.
However, this change broke the wav filter: wav_convert() is now called
even if the previous filter (e.g. oggdec) has not yet determined the
format of the input stream.
This caused the wav filter to write out an invalid wav header with 0
channels. Fix it by not doing anything unless wav_convert() gets called
with non-empty input.
int bytespersec = channels * samplerate * BITS / 8;
int align = channels * BITS / 8;
+ assert(channels);
PARA_DEBUG_LOG("writing wave header: %d channels, %d KHz\n", channels, samplerate);
memset(headbuf, 0, WAV_HEADER_LEN);
memcpy(headbuf, "RIFF", 4);
int *bof = fn->private_data;
if (*bof) {
+ if (!len)
+ return 0;
make_wav_header(fn->fc->channels, fn->fc->samplerate, fn);
fn->loaded = WAV_HEADER_LEN;
*bof = 0;