hal: NULL pointer check before using audio_usecase
- Add check for NULL pointer before using audio_usecase Change-Id: Iaedd7b1dfbcf727957f6b19a54199d29afa25703
This commit is contained in:
parent
ba9527948a
commit
2d8aa2e3dc
|
@ -673,23 +673,23 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
|
|||
if (adev->voice.in_call && adev->mode == AUDIO_MODE_IN_CALL) {
|
||||
vc_usecase = get_usecase_from_list(adev,
|
||||
get_voice_usecase_id_from_list(adev));
|
||||
if ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
|
||||
(usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL)) {
|
||||
if ((vc_usecase) && ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
|
||||
(usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL))) {
|
||||
in_snd_device = vc_usecase->in_snd_device;
|
||||
out_snd_device = vc_usecase->out_snd_device;
|
||||
}
|
||||
} else if (voice_extn_compress_voip_is_active(adev)) {
|
||||
voip_usecase = get_usecase_from_list(adev, USECASE_COMPRESS_VOIP_CALL);
|
||||
if ((voip_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
|
||||
if ((voip_usecase) && ((voip_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
|
||||
(usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
|
||||
(voip_usecase->stream.out != adev->primary_output)) {
|
||||
(voip_usecase->stream.out != adev->primary_output))) {
|
||||
in_snd_device = voip_usecase->in_snd_device;
|
||||
out_snd_device = voip_usecase->out_snd_device;
|
||||
}
|
||||
} else if (audio_extn_hfp_is_active(adev)) {
|
||||
hfp_ucid = audio_extn_hfp_get_usecase();
|
||||
hfp_usecase = get_usecase_from_list(adev, hfp_ucid);
|
||||
if (hfp_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) {
|
||||
if ((hfp_usecase) && (hfp_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND)) {
|
||||
in_snd_device = hfp_usecase->in_snd_device;
|
||||
out_snd_device = hfp_usecase->out_snd_device;
|
||||
}
|
||||
|
|
|
@ -580,8 +580,14 @@ int voice_extn_compress_voip_start_output_stream(struct stream_out *out)
|
|||
ret = voip_start_call(adev, &out->config);
|
||||
out->pcm = voip_data.pcm_rx;
|
||||
uc_info = get_usecase_from_list(adev, USECASE_COMPRESS_VOIP_CALL);
|
||||
uc_info->stream.out = out;
|
||||
uc_info->devices = out->devices;
|
||||
if (uc_info) {
|
||||
uc_info->stream.out = out;
|
||||
uc_info->devices = out->devices;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
ALOGE("%s: exit(%d): failed to get use case info", __func__, ret);
|
||||
goto error;
|
||||
}
|
||||
|
||||
error:
|
||||
ALOGV("%s: exit: status(%d)", __func__, ret);
|
||||
|
|
Loading…
Reference in New Issue