summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorAshish Jain <ashishj@codeaurora.org>2016-12-29 14:00:24 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-09 04:25:59 -0800
commitb8d55fdc0ecc3d4a8ab97b55ab5c64abaa4693ab (patch)
treec67e8dd910962a7a6309e67fcf722a4c8c85bc25 /hal
parentc5fefba2a066c282805b8bb2f842f60782fc3732 (diff)
downloadhardware_qcom_audio-b8d55fdc0ecc3d4a8ab97b55ab5c64abaa4693ab.tar.gz
hardware_qcom_audio-b8d55fdc0ecc3d4a8ab97b55ab5c64abaa4693ab.tar.bz2
hardware_qcom_audio-b8d55fdc0ecc3d4a8ab97b55ab5c64abaa4693ab.zip
hal: Fix crash during voice call
-Validate active_input before accessing it, it NULL use default value. -For voice call scenario it is not necessary to have an active input stream. Change-Id: I258b9e8c098d76f838bcca5b968d64369243885e
Diffstat (limited to 'hal')
-rw-r--r--hal/msm8916/platform.c3
-rw-r--r--hal/msm8974/platform.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 8902f63c..ac72862f 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -3456,7 +3456,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
snd_device_t snd_device = SND_DEVICE_NONE;
int channel_count = popcount(channel_mask);
- int str_bitwidth = adev->active_input->bit_width;
+ int str_bitwidth = (adev->active_input == NULL) ?
+ CODEC_BACKEND_DEFAULT_BIT_WIDTH : adev->active_input->bit_width;
ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
__func__, out_device, in_device, channel_count, channel_mask);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index c0d3ebeb..f9ee4b1b 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3098,7 +3098,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
snd_device_t snd_device = SND_DEVICE_NONE;
int channel_count = popcount(channel_mask);
- int str_bitwidth = adev->active_input->bit_width;
+ int str_bitwidth = (adev->active_input == NULL) ?
+ CODEC_BACKEND_DEFAULT_BIT_WIDTH : adev->active_input->bit_width;
ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
__func__, out_device, in_device, channel_count, channel_mask);