X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=wav_filter.c;h=1c0da1811847e958cdde408ba277edce20701c42;hp=b7329c48bce647b113638a5609b39de698ef81fd;hb=74361f472d6d1a75a313cb3a6b4528cfeacfff0a;hpb=00e4d4da1b2c00da139b09d3ed4ab9ad9fba2691;ds=sidebyside diff --git a/wav_filter.c b/wav_filter.c index b7329c48..1c0da181 100644 --- a/wav_filter.c +++ b/wav_filter.c @@ -7,6 +7,7 @@ /** \file wav_filter.c A filter that inserts a wave header. */ #include "para.h" +#include "error.h" #include "list.h" #include "sched.h" @@ -31,7 +32,6 @@ static void make_wav_header(unsigned int channels, unsigned int samplerate, 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); @@ -57,6 +57,10 @@ static ssize_t wav_convert(char *inbuf, size_t len, struct filter_node *fn) if (*bof) { if (!len) return 0; + if (!fn->fc->channels || !fn->fc->samplerate) { + PARA_ERROR_LOG("%s\n", para_strerror(E_WAV_BAD_FC)); + return -E_WAV_BAD_FC; + } make_wav_header(fn->fc->channels, fn->fc->samplerate, fn); fn->loaded = WAV_HEADER_LEN; *bof = 0;