summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorHaynes Mathew George <hgeorge@codeaurora.org>2013-09-11 14:19:36 -0700
committerVineeta Srivastava <vsrivastava@google.com>2013-09-12 09:20:05 -0700
commit5191a856311c5bd5a1b48810032ccdbc35a7fdc7 (patch)
treede1c95fb46b107c0767dd3ecb0f8caf3fb4219d7 /hal
parent2ccd7babcde54a8073945dec69660cb60e66a931 (diff)
downloadandroid_hardware_qcom_audio-5191a856311c5bd5a1b48810032ccdbc35a7fdc7.tar.gz
android_hardware_qcom_audio-5191a856311c5bd5a1b48810032ccdbc35a7fdc7.tar.bz2
android_hardware_qcom_audio-5191a856311c5bd5a1b48810032ccdbc35a7fdc7.zip
audio: set cached volume before starting voice call
Apply cached voice volume before starting voice call. Change-Id: I6a86d5f104b6a19c13bffbdeafa7a7f325d5ad3b Bug: 10516515
Diffstat (limited to 'hal')
-rw-r--r--hal/audio_hw.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 404f17c8..2ad5c883 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -125,6 +125,8 @@ static const struct string_to_enum out_channels_name_to_enum_table[] = {
STRING_TO_ENUM(AUDIO_CHANNEL_OUT_7POINT1),
};
+static int set_voice_volume_l(struct audio_device *adev, float volume);
+
static bool is_supported_format(audio_format_t format)
{
if (format == AUDIO_FORMAT_MP3 /*||
@@ -963,6 +965,10 @@ static int start_voice_call(struct audio_device *adev)
ret = -EIO;
goto error_start_voice;
}
+
+ /* set cached volume */
+ set_voice_volume_l(adev, adev->voice_volume);
+
pcm_start(adev->voice_call_rx);
pcm_start(adev->voice_call_tx);
@@ -971,7 +977,6 @@ static int start_voice_call(struct audio_device *adev)
ALOGE("%s: platform_start_voice_call error %d\n", __func__, ret);
goto error_start_voice;
}
-
adev->in_call = true;
return 0;
@@ -1963,13 +1968,11 @@ static int adev_init_check(const struct audio_hw_device *dev)
return 0;
}
-static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
+/* always called with adev lock held */
+static int set_voice_volume_l(struct audio_device *adev, float volume)
{
- struct audio_device *adev = (struct audio_device *)dev;
int vol, err = 0;
- pthread_mutex_lock(&adev->lock);
- adev->voice_volume = volume;
if (adev->mode == AUDIO_MODE_IN_CALL) {
if (volume < 0.0) {
volume = 0.0;
@@ -1986,10 +1989,21 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
err = platform_set_voice_volume(adev->platform, vol);
}
- pthread_mutex_unlock(&adev->lock);
return err;
}
+static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
+{
+ int ret;
+ struct audio_device *adev = (struct audio_device *)dev;
+ pthread_mutex_lock(&adev->lock);
+ /* cache volume */
+ adev->voice_volume = volume;
+ ret = set_voice_volume_l(adev, adev->voice_volume);
+ pthread_mutex_unlock(&adev->lock);
+ return ret;
+}
+
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
{
return -ENOSYS;