Add enabling variable for extended precision audio

Set AudioFlinger::kEnableExtendedPrecision = true to enable
extended precision. Enabling will be required for devices (such as
USB) which report 24 bit or 32 bit sink formats.

Change-Id: I0dc1d7a4f7607086d7b536ea0e43aef0e696f2ee
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 6e73a14..ddc6afb 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -326,6 +326,24 @@
                                                 audio_devices_t devices);
     void                    purgeStaleEffects_l();
 
+    // Set kEnableExtendedPrecision to true to use extended precision in MixerThread
+    static const bool kEnableExtendedPrecision = false;
+
+    // Returns true if format is permitted for the PCM sink in the MixerThread
+    static inline bool isValidPcmSinkFormat(audio_format_t format) {
+        switch (format) {
+        case AUDIO_FORMAT_PCM_16_BIT:
+            return true;
+        case AUDIO_FORMAT_PCM_FLOAT:
+        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
+        case AUDIO_FORMAT_PCM_32_BIT:
+        case AUDIO_FORMAT_PCM_8_24_BIT:
+            return kEnableExtendedPrecision;
+        default:
+            return false;
+        }
+    }
+
     // standby delay for MIXER and DUPLICATING playback threads is read from property
     // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs
     static nsecs_t          mStandbyTimeInNsecs;