Use FCC_2 and FCC_8 to highlight channel count assumptions
Bug: 21656069
Change-Id: I3486b9e48856d703d1ff37f509ab7f1140a6a146
diff --git a/audio_utils/tinysndfile.c b/audio_utils/tinysndfile.c
index ca03a72..9c20862 100644
--- a/audio_utils/tinysndfile.c
+++ b/audio_utils/tinysndfile.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <system/audio.h>
#include <audio_utils/sndfile.h>
#include <audio_utils/primitives.h>
#ifdef HAVE_STDERR
@@ -181,8 +182,7 @@
fseek(stream, (long) (chunkSize - minSize), SEEK_CUR);
}
unsigned channels = little2u(&fmt[2]);
- // FIXME FCC_8
- if (channels != 1 && channels != 2 && channels != 4 && channels != 6 && channels != 8) {
+ if ((channels < 1) || (channels > FCC_8)) {
#ifdef HAVE_STDERR
fprintf(stderr, "unsupported channels %u\n", channels);
#endif
@@ -299,8 +299,7 @@
int sub = info->format & SF_FORMAT_SUBMASK;
if (!(
(info->samplerate > 0) &&
- // FIXME FCC_8
- (info->channels > 0 && info->channels <= 8) &&
+ (info->channels > 0 && info->channels <= FCC_8) &&
((info->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) &&
(sub == SF_FORMAT_PCM_16 || sub == SF_FORMAT_PCM_U8 || sub == SF_FORMAT_FLOAT ||
sub == SF_FORMAT_PCM_24 || sub == SF_FORMAT_PCM_32)