summaryrefslogtreecommitdiff
path: root/apps/codecs/libpcm/linear_pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libpcm/linear_pcm.c')
-rw-r--r--apps/codecs/libpcm/linear_pcm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/codecs/libpcm/linear_pcm.c b/apps/codecs/libpcm/linear_pcm.c
index 82c70eb3b6..e58856efe8 100644
--- a/apps/codecs/libpcm/linear_pcm.c
+++ b/apps/codecs/libpcm/linear_pcm.c
@@ -38,6 +38,18 @@ static bool set_format(struct pcm_format *format)
38{ 38{
39 fmt = format; 39 fmt = format;
40 40
41 if (fmt->channels == 0)
42 {
43 DEBUGF("CODEC_ERROR: channels is 0\n");
44 return false;
45 }
46
47 if (fmt->bitspersample == 0)
48 {
49 DEBUGF("CODEC_ERROR: bitspersample is 0\n");
50 return false;
51 }
52
41 if (fmt->bitspersample > 32) 53 if (fmt->bitspersample > 32)
42 { 54 {
43 DEBUGF("CODEC_ERROR: pcm with more than 32 bitspersample " 55 DEBUGF("CODEC_ERROR: pcm with more than 32 bitspersample "
@@ -47,8 +59,8 @@ static bool set_format(struct pcm_format *format)
47 59
48 fmt->bytespersample = fmt->bitspersample >> 3; 60 fmt->bytespersample = fmt->bitspersample >> 3;
49 61
50 if (fmt->totalsamples == 0) 62 if (fmt->blockalign == 0)
51 fmt->totalsamples = fmt->numbytes/fmt->bytespersample; 63 fmt->blockalign = fmt->bytespersample * fmt->channels;
52 64
53 fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels); 65 fmt->samplesperblock = fmt->blockalign / (fmt->bytespersample * fmt->channels);
54 66