diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2017-01-11 12:29:54 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-01-18 16:30:22 +0100 |
commit | 7d0b2553cded9426da3f751ad626c632b1c7343f (patch) | |
tree | 5f5569ae7864d81ab196026f30223e3c795b818d | |
parent | 8c2eccc3d9dc1e1d0f2cbb9b5e38fc9d990bf71b (diff) | |
download | android_device_samsung_sltexx-7d0b2553cded9426da3f751ad626c632b1c7343f.tar.gz android_device_samsung_sltexx-7d0b2553cded9426da3f751ad626c632b1c7343f.tar.xz android_device_samsung_sltexx-7d0b2553cded9426da3f751ad626c632b1c7343f.zip |
audio: Initialize the modem before we setup routing
This way we have incall audio faster set up. The modem can setup its
routing while we configure the soundcard.
-rw-r--r-- | hal/audio/audio_hw.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/hal/audio/audio_hw.c b/hal/audio/audio_hw.c index 37fe705..c2a7032 100644 --- a/hal/audio/audio_hw.c +++ b/hal/audio/audio_hw.c @@ -355,6 +355,7 @@ static int get_input_source_id(audio_source_t source, bool wb_amr) static void do_out_standby(struct stream_out *out); static void adev_set_call_audio_path(struct audio_device *adev); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); +static void start_ril_call(struct audio_device *adev); /** * NOTE: when multiple mutexes have to be acquired, always respect the @@ -704,7 +705,13 @@ static void select_devices(struct audio_device *adev) input_devices_off(); } - /* TODO: Tell the modem what we plan to do */ + /* + * Already tell the modem that we are in a call. This should make it + * faster to accept an incoming call. + */ + if (adev->in_call) { + start_ril_call(adev); + } /* * Apply the new audio routes @@ -921,26 +928,8 @@ static void stop_voice_call(struct audio_device *adev) ALOGV("%s: Successfully closed %d active PCMs", __func__, status); } -static void start_call(struct audio_device *adev) +static void start_ril_call(struct audio_device *adev) { - if (adev->in_call) { - return; - } - - adev->in_call = true; - - if (adev->out_device == AUDIO_DEVICE_NONE && - adev->in_device == AUDIO_DEVICE_NONE) { - ALOGV("%s: No device selected, use earpiece as the default", - __func__); - adev->out_device = AUDIO_DEVICE_OUT_EARPIECE; - } - adev->input_source = AUDIO_SOURCE_VOICE_CALL; - - select_devices(adev); - start_voice_call(adev); - - /* FIXME: Turn on two mic control for earpiece and speaker */ switch (adev->out_device) { case AUDIO_DEVICE_OUT_EARPIECE: case AUDIO_DEVICE_OUT_SPEAKER: @@ -965,6 +954,26 @@ static void start_call(struct audio_device *adev) ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_START); } +static void start_call(struct audio_device *adev) +{ + if (adev->in_call) { + return; + } + + adev->in_call = true; + + if (adev->out_device == AUDIO_DEVICE_NONE && + adev->in_device == AUDIO_DEVICE_NONE) { + ALOGV("%s: No device selected, use earpiece as the default", + __func__); + adev->out_device = AUDIO_DEVICE_OUT_EARPIECE; + } + adev->input_source = AUDIO_SOURCE_VOICE_CALL; + + select_devices(adev); + start_voice_call(adev); +} + static void stop_call(struct audio_device *adev) { if (!adev->in_call) { @@ -988,6 +997,7 @@ static void stop_call(struct audio_device *adev) adev->out_device, adev->input_source); + adev->in_call = false; select_devices(adev); } |