Loading hal/audio_hw.c +81 −64 Original line number Diff line number Diff line Loading @@ -606,11 +606,25 @@ static void disable_asrc_mode(struct audio_device *adev) * ASRC mode for incoming Headphone 44.1 or Native DSD use case. * e.g. Naitve DSD or Headphone 44.1 -> + 48 */ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_device) static void check_and_set_asrc_mode(struct audio_device *adev, struct audio_usecase *uc_info, snd_device_t snd_device) { ALOGV("%s snd device %d", __func__, snd_device); int i, num_new_devices = 0; snd_device_t split_new_snd_devices[SND_DEVICE_OUT_END]; /* *Split snd device for new combo use case *e.g. Headphopne 44.1-> + Ringtone (Headphone + Speaker) */ if (platform_split_snd_device(adev->platform, snd_device, &num_new_devices, split_new_snd_devices) == 0) { for (i = 0; i < num_new_devices; i++) check_and_set_asrc_mode(adev, uc_info, split_new_snd_devices[i]); } else { int new_backend_idx = platform_get_backend_index(snd_device); if (((new_backend_idx == HEADPHONE_BACKEND) || (new_backend_idx == HEADPHONE_44_1_BACKEND) || (new_backend_idx == DSD_NATIVE_BACKEND)) && Loading @@ -625,8 +639,11 @@ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_ list_for_each(node, &adev->usecase_list) { uc = node_to_item(node, struct audio_usecase, list); curr_out = (struct stream_out*) uc->stream.out; if (curr_out && PCM_PLAYBACK == uc->type) { if (curr_out && PCM_PLAYBACK == uc->type && uc != uc_info) { /* *Split snd device for existing combo use case *e.g. Ringtone (Headphone + Speaker) + Headphopne 44.1 */ ret = platform_split_snd_device(adev->platform, uc->out_snd_device, &num_devices, Loading Loading @@ -672,7 +689,7 @@ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_ } if (adev->asrc_mode_enabled) break; } } } } Loading Loading @@ -798,8 +815,6 @@ int enable_snd_device(struct audio_device *adev, } else { ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, device_name); if (platform_check_codec_asrc_support(adev->platform)) check_and_set_asrc_mode(adev, snd_device); if ((SND_DEVICE_OUT_BT_A2DP == snd_device) && (audio_extn_a2dp_start_playback() < 0)) { Loading Loading @@ -1620,6 +1635,8 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) /* Enable new sound devices */ if (out_snd_device != SND_DEVICE_NONE) { check_usecases_codec_backend(adev, usecase, out_snd_device); if (platform_check_codec_asrc_support(adev->platform)) check_and_set_asrc_mode(adev, usecase, out_snd_device); enable_snd_device(adev, out_snd_device); } Loading Loading
hal/audio_hw.c +81 −64 Original line number Diff line number Diff line Loading @@ -606,11 +606,25 @@ static void disable_asrc_mode(struct audio_device *adev) * ASRC mode for incoming Headphone 44.1 or Native DSD use case. * e.g. Naitve DSD or Headphone 44.1 -> + 48 */ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_device) static void check_and_set_asrc_mode(struct audio_device *adev, struct audio_usecase *uc_info, snd_device_t snd_device) { ALOGV("%s snd device %d", __func__, snd_device); int i, num_new_devices = 0; snd_device_t split_new_snd_devices[SND_DEVICE_OUT_END]; /* *Split snd device for new combo use case *e.g. Headphopne 44.1-> + Ringtone (Headphone + Speaker) */ if (platform_split_snd_device(adev->platform, snd_device, &num_new_devices, split_new_snd_devices) == 0) { for (i = 0; i < num_new_devices; i++) check_and_set_asrc_mode(adev, uc_info, split_new_snd_devices[i]); } else { int new_backend_idx = platform_get_backend_index(snd_device); if (((new_backend_idx == HEADPHONE_BACKEND) || (new_backend_idx == HEADPHONE_44_1_BACKEND) || (new_backend_idx == DSD_NATIVE_BACKEND)) && Loading @@ -625,8 +639,11 @@ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_ list_for_each(node, &adev->usecase_list) { uc = node_to_item(node, struct audio_usecase, list); curr_out = (struct stream_out*) uc->stream.out; if (curr_out && PCM_PLAYBACK == uc->type) { if (curr_out && PCM_PLAYBACK == uc->type && uc != uc_info) { /* *Split snd device for existing combo use case *e.g. Ringtone (Headphone + Speaker) + Headphopne 44.1 */ ret = platform_split_snd_device(adev->platform, uc->out_snd_device, &num_devices, Loading Loading @@ -672,7 +689,7 @@ static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_ } if (adev->asrc_mode_enabled) break; } } } } Loading Loading @@ -798,8 +815,6 @@ int enable_snd_device(struct audio_device *adev, } else { ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, device_name); if (platform_check_codec_asrc_support(adev->platform)) check_and_set_asrc_mode(adev, snd_device); if ((SND_DEVICE_OUT_BT_A2DP == snd_device) && (audio_extn_a2dp_start_playback() < 0)) { Loading Loading @@ -1620,6 +1635,8 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) /* Enable new sound devices */ if (out_snd_device != SND_DEVICE_NONE) { check_usecases_codec_backend(adev, usecase, out_snd_device); if (platform_check_codec_asrc_support(adev->platform)) check_and_set_asrc_mode(adev, usecase, out_snd_device); enable_snd_device(adev, out_snd_device); } Loading