Loading hal/audio_extn/ext_hw_plugin.c +41 −36 Original line number Diff line number Diff line /* ext_hw_plugin.c Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of The Linux Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ /* * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define LOG_TAG "audio_ext_hw_plugin" #define LOG_NDEBUG 0 Loading Loading @@ -313,8 +314,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecas return 0; } if ((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->in_snd_device != SND_DEVICE_NONE)) { codec_enable.snd_dev = usecase->in_snd_device; /* TODO - below should be related with in_snd_dev */ codec_enable.sample_rate = 48000; Loading Loading @@ -383,8 +385,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecas } } if ((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { codec_enable.snd_dev = usecase->out_snd_device; /* TODO - below should be related with out_snd_dev */ codec_enable.sample_rate = 48000; Loading Loading @@ -450,8 +453,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase return -EINVAL; } if ((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { codec_disable.snd_dev = usecase->out_snd_device; ALOGD("%s: disable audio hal plugin output, %d, %d", Loading @@ -465,8 +469,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase } my_plugin->out_snd_dev[codec_disable.usecase] = 0; } if ((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->in_snd_device != SND_DEVICE_NONE)) { codec_disable.snd_dev = usecase->in_snd_device; ALOGD("%s: disable audio hal plugin input, %d, %d", Loading hal/audio_hw.c +8 −16 Original line number Diff line number Diff line Loading @@ -2513,10 +2513,8 @@ static int stop_input_stream(struct stream_in *in) return -EINVAL; } if (uc_info->in_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to stop ext hw plugin", __func__); } /* Close in-call recording streams */ voice_check_and_stop_incall_rec_usecase(adev, in); Loading Loading @@ -2613,10 +2611,8 @@ int start_input_stream(struct stream_in *in) adev->perf_lock_opts_size); select_devices(adev, in->usecase); if (uc_info->in_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to start ext hw plugin", __func__); } if (audio_extn_cin_attached_usecase(in->usecase)) { ret = audio_extn_cin_start_input_stream(in); Loading Loading @@ -3048,10 +3044,8 @@ static int stop_output_stream(struct stream_out *out) return -EINVAL; } if (uc_info->out_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to stop ext hw plugin", __func__); } if (is_offload_usecase(out->usecase) && !(audio_extn_passthru_is_passthrough_stream(out))) { Loading Loading @@ -3251,10 +3245,8 @@ int start_output_stream(struct stream_out *out) if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, true); if (uc_info->out_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to start ext hw plugin", __func__); } ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)", __func__, adev->snd_card, out->pcm_device_id, out->config.format); Loading Loading
hal/audio_extn/ext_hw_plugin.c +41 −36 Original line number Diff line number Diff line /* ext_hw_plugin.c Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of The Linux Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ /* * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define LOG_TAG "audio_ext_hw_plugin" #define LOG_NDEBUG 0 Loading Loading @@ -313,8 +314,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecas return 0; } if ((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->in_snd_device != SND_DEVICE_NONE)) { codec_enable.snd_dev = usecase->in_snd_device; /* TODO - below should be related with in_snd_dev */ codec_enable.sample_rate = 48000; Loading Loading @@ -383,8 +385,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_start(void *plugin, struct audio_usecas } } if ((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { codec_enable.snd_dev = usecase->out_snd_device; /* TODO - below should be related with out_snd_dev */ codec_enable.sample_rate = 48000; Loading Loading @@ -450,8 +453,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase return -EINVAL; } if ((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_PLAYBACK) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { codec_disable.snd_dev = usecase->out_snd_device; ALOGD("%s: disable audio hal plugin output, %d, %d", Loading @@ -465,8 +469,9 @@ int32_t audio_extn_ext_hw_plugin_usecase_stop(void *plugin, struct audio_usecase } my_plugin->out_snd_dev[codec_disable.usecase] = 0; } if ((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) { if (((usecase->type == PCM_CAPTURE) || (usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL) || (usecase->type == PCM_HFP_CALL)) && (usecase->in_snd_device != SND_DEVICE_NONE)) { codec_disable.snd_dev = usecase->in_snd_device; ALOGD("%s: disable audio hal plugin input, %d, %d", Loading
hal/audio_hw.c +8 −16 Original line number Diff line number Diff line Loading @@ -2513,10 +2513,8 @@ static int stop_input_stream(struct stream_in *in) return -EINVAL; } if (uc_info->in_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to stop ext hw plugin", __func__); } /* Close in-call recording streams */ voice_check_and_stop_incall_rec_usecase(adev, in); Loading Loading @@ -2613,10 +2611,8 @@ int start_input_stream(struct stream_in *in) adev->perf_lock_opts_size); select_devices(adev, in->usecase); if (uc_info->in_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to start ext hw plugin", __func__); } if (audio_extn_cin_attached_usecase(in->usecase)) { ret = audio_extn_cin_start_input_stream(in); Loading Loading @@ -3048,10 +3044,8 @@ static int stop_output_stream(struct stream_out *out) return -EINVAL; } if (uc_info->out_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_stop(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to stop ext hw plugin", __func__); } if (is_offload_usecase(out->usecase) && !(audio_extn_passthru_is_passthrough_stream(out))) { Loading Loading @@ -3251,10 +3245,8 @@ int start_output_stream(struct stream_out *out) if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, true); if (uc_info->out_snd_device != SND_DEVICE_NONE) { if (audio_extn_ext_hw_plugin_usecase_start(adev->ext_hw_plugin, uc_info)) ALOGE("%s: failed to start ext hw plugin", __func__); } ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)", __func__, adev->snd_card, out->pcm_device_id, out->config.format); Loading