OSDN Git Service

AudioFlinger: do not cache audio device when 0.
authorEric Laurent <elaurent@google.com>
Fri, 7 Jun 2013 01:29:01 +0000 (18:29 -0700)
committerEric Laurent <elaurent@google.com>
Fri, 7 Jun 2013 01:33:08 +0000 (18:33 -0700)
AudioFlinger should not cache the audio device
passed to the audio HAL when it is AUDIO_DEVICE_NONE
but keep previous valid selection instead.

Bug: 9323399.
Change-Id: I6f9480e55a21be4115453e6a5eebc5cf2536c476

services/audioflinger/Effects.cpp
services/audioflinger/Threads.cpp

index d66294c..942ea35 100644 (file)
@@ -680,7 +680,7 @@ status_t AudioFlinger::EffectModule::setDevice(audio_devices_t device)
         return mStatus;
     }
     status_t status = NO_ERROR;
-    if (device && (mDescriptor.flags & EFFECT_FLAG_DEVICE_MASK) == EFFECT_FLAG_DEVICE_IND) {
+    if ((mDescriptor.flags & EFFECT_FLAG_DEVICE_MASK) == EFFECT_FLAG_DEVICE_IND) {
         status_t cmdStatus;
         uint32_t size = sizeof(status_t);
         uint32_t cmd = audio_is_output_devices(device) ? EFFECT_CMD_SET_DEVICE :
index 539bb4f..6422b23 100644 (file)
@@ -2992,9 +2992,11 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l()
 
             // forward device change to effects that have requested to be
             // aware of attached audio device.
-            mOutDevice = value;
-            for (size_t i = 0; i < mEffectChains.size(); i++) {
-                mEffectChains[i]->setDevice_l(mOutDevice);
+            if (value != AUDIO_DEVICE_NONE) {
+                mOutDevice = value;
+                for (size_t i = 0; i < mEffectChains.size(); i++) {
+                    mEffectChains[i]->setDevice_l(mOutDevice);
+                }
             }
         }