diff options
Diffstat (limited to 'apps/codecs/libpcm/ieee_float.c')
-rw-r--r-- | apps/codecs/libpcm/ieee_float.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/codecs/libpcm/ieee_float.c b/apps/codecs/libpcm/ieee_float.c index 0530993f31..7e3498edcb 100644 --- a/apps/codecs/libpcm/ieee_float.c +++ b/apps/codecs/libpcm/ieee_float.c | |||
@@ -32,6 +32,12 @@ static bool set_format(struct pcm_format *format) | |||
32 | { | 32 | { |
33 | fmt = format; | 33 | fmt = format; |
34 | 34 | ||
35 | if (fmt->channels == 0) | ||
36 | { | ||
37 | DEBUGF("CODEC_ERROR: channels is 0\n"); | ||
38 | return false; | ||
39 | } | ||
40 | |||
35 | if (fmt->bitspersample != 32 && fmt->bitspersample != 64) | 41 | if (fmt->bitspersample != 32 && fmt->bitspersample != 64) |
36 | { | 42 | { |
37 | DEBUGF("CODEC_ERROR: ieee float must be 32 or 64 bitspersample: %d\n", | 43 | DEBUGF("CODEC_ERROR: ieee float must be 32 or 64 bitspersample: %d\n", |
@@ -40,6 +46,10 @@ static bool set_format(struct pcm_format *format) | |||
40 | } | 46 | } |
41 | 47 | ||
42 | fmt->bytespersample = fmt->bitspersample >> 3; | 48 | fmt->bytespersample = fmt->bitspersample >> 3; |
49 | |||
50 | if (fmt->blockalign == 0) | ||
51 | fmt->blockalign = fmt->bytespersample * fmt->channels; | ||
52 | |||
43 | fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels); | 53 | fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels); |
44 | 54 | ||
45 | /* chunksize = about 1/50[sec] data */ | 55 | /* chunksize = about 1/50[sec] data */ |