Merge "Validation of Number of Channels on WAV files."
am: 8ec6ab3bfa

* commit '8ec6ab3bfa96316fabde6c23acb1e2630acac99b':
  Validation of Number of Channels on WAV files.
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index 51d639d..811929b 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -193,17 +193,17 @@
             }
 
             mNumChannels = U16_LE_AT(&formatSpec[2]);
+
+            if (mNumChannels < 1 || mNumChannels > 8) {
+                ALOGE("Unsupported number of channels (%d)", mNumChannels);
+                return ERROR_UNSUPPORTED;
+            }
+
             if (mWaveFormat != WAVE_FORMAT_EXTENSIBLE) {
-                if (mNumChannels == 0) {
-                    return ERROR_UNSUPPORTED;
-                } else if (mNumChannels != 1 && mNumChannels != 2) {
+                if (mNumChannels != 1 && mNumChannels != 2) {
                     ALOGW("More than 2 channels (%d) in non-WAVE_EXT, unknown channel mask",
                             mNumChannels);
                 }
-            } else {
-                if (mNumChannels < 1 || mNumChannels > 8) {
-                    return ERROR_UNSUPPORTED;
-                }
             }
 
             mSampleRate = U32_LE_AT(&formatSpec[4]);