diff options
author | Mingming Yin <mingming@codeaurora.org> | 2016-01-06 18:02:42 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-01-13 12:06:28 -0800 |
commit | 8abf4f4ff62643bc39a5b6ef08ce2683af6c9a19 (patch) | |
tree | 81acb09372193004b38c5d142a8ca4ad3b916bc7 | |
parent | 7eaaf12f02321e5559aa577166b998fb8cfb683b (diff) | |
download | android_hardware_qcom_audio-8abf4f4ff62643bc39a5b6ef08ce2683af6c9a19.tar.gz android_hardware_qcom_audio-8abf4f4ff62643bc39a5b6ef08ce2683af6c9a19.tar.bz2 android_hardware_qcom_audio-8abf4f4ff62643bc39a5b6ef08ce2683af6c9a19.zip |
policy_hal: fix for FM playback without active music stream
- Increase primary output ref count before getting new device
- This prevents to use NULL device for FM playback.
Change-Id: Idd2b36dab1990cdc1c1f603c5bdfd53b53c5c311
CRs-Fixed: 957807
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 250c4f79..f2cdf360 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -280,12 +280,13 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d #ifdef FM_POWER_OPT // handle FM device connection state to trigger FM AFE loopback if (device == AUDIO_DEVICE_OUT_FM && hasPrimaryOutput()) { - audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, false /*fromCache*/); + audio_devices_t newDevice = AUDIO_DEVICE_NONE; if (state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE) { mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, 1); - newDevice = newDevice | AUDIO_DEVICE_OUT_FM; + newDevice = (audio_devices_t)(getNewOutputDevice(mPrimaryOutput, false)|AUDIO_DEVICE_OUT_FM); mFMIsActive = true; } else { + newDevice = (audio_devices_t)(getNewOutputDevice(mPrimaryOutput, false)); mFMIsActive = false; mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, -1); } |