volume_listener: Fix MBDRC volume difference issue for combo use case

-change in MBDRC level based on volume is not getting applied on combo device
 usecase (speaker is one of the device) due to speaker only check.

-Modify logic to recompute and apply MBDRC level if one of the device in combo
 device is speaker

Change-Id: I18726af9d30c966fd04666305529a46cebee18c7
This commit is contained in:
Preetam Singh Ranawat 2017-05-04 11:35:06 +05:30 committed by Gerrit - the friendly Code Review server
parent 55293fa037
commit fc7acd72d5
1 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -462,7 +462,7 @@ static int vol_effect_command(effect_handle_t self,
// After changing the state and if device is speaker // After changing the state and if device is speaker
// recalculate gain dep cal level // recalculate gain dep cal level
if (context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) { if (context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) {
check_and_set_gain_dep_cal(); check_and_set_gain_dep_cal();
} }
@ -489,7 +489,7 @@ static int vol_effect_command(effect_handle_t self,
// After changing the state and if device is speaker // After changing the state and if device is speaker
// recalculate gain dep cal level // recalculate gain dep cal level
if (context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) { if (context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) {
check_and_set_gain_dep_cal(); check_and_set_gain_dep_cal();
} }
@ -520,8 +520,8 @@ static int vol_effect_command(effect_handle_t self,
__func__, context->dev_id, new_device); __func__, context->dev_id, new_device);
// check if old or new device is speaker // check if old or new device is speaker
if ((context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) || if ((context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) ||
(new_device == AUDIO_DEVICE_OUT_SPEAKER)) { (new_device & AUDIO_DEVICE_OUT_SPEAKER)) {
recompute_gain_dep_cal_Level = true; recompute_gain_dep_cal_Level = true;
} }
@ -546,7 +546,7 @@ static int vol_effect_command(effect_handle_t self,
goto exit; goto exit;
} }
if (context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) { if (context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) {
recompute_gain_dep_cal_Level = true; recompute_gain_dep_cal_Level = true;
} }
@ -771,7 +771,7 @@ static int vol_prc_lib_release(effect_handle_t handle)
ALOGV("--- Found something to remove ---"); ALOGV("--- Found something to remove ---");
list_remove(node); list_remove(node);
PRINT_STREAM_TYPE(context->stream_type); PRINT_STREAM_TYPE(context->stream_type);
if (context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) { if (context->dev_id & AUDIO_DEVICE_OUT_SPEAKER) {
recompute_flag = true; recompute_flag = true;
} }
list_remove(&context->effect_list_node); list_remove(&context->effect_list_node);