pcm_utils: support any number of channels in pcm_sizeOfConvBuffer()
When calculating the conversion buffer size, don't hard-code the formulas for only mono<->stereo.
This commit is contained in:
parent
c0ecce5498
commit
9b0693d8ef
@ -568,17 +568,8 @@ size_t pcm_sizeOfConvBuffer(const struct audio_format *inFormat, size_t inSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inFormat->channels != outFormat->channels) {
|
if (inFormat->channels != outFormat->channels) {
|
||||||
switch (inFormat->channels) {
|
outSize /= inFormat->channels;
|
||||||
case 1:
|
outSize *= outFormat->channels;
|
||||||
outSize = (outSize >> 1) << 2;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
outSize >>= 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
FATAL("only 1 or 2 channels are supported "
|
|
||||||
"for conversion!\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outSize /= shift;
|
outSize /= shift;
|
||||||
|
Loading…
Reference in New Issue
Block a user