Loading hal/audio_hw.c +31 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ static unsigned int audio_device_ref_count; static int set_voice_volume_l(struct audio_device *adev, float volume); static uint32_t get_offload_buffer_size(); static int set_gapless_mode(struct audio_device *adev); static bool is_supported_format(audio_format_t format) { Loading Loading @@ -2138,6 +2139,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, } } //Decide if we need to use gapless mode by default set_gapless_mode(adev); } else if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) { ret = voice_check_and_set_incall_music_usecase(adev, out); if (ret != 0) { Loading Loading @@ -2694,6 +2698,33 @@ static uint32_t get_offload_buffer_size() return fragment_size; } static int set_gapless_mode(struct audio_device *adev) { char value[PROPERTY_VALUE_MAX] = {0}; bool gapless_enabled = false; const char *mixer_ctl_name = "Compress Gapless Playback"; struct mixer_ctl *ctl; ALOGV("%s:", __func__); property_get("audio.offload.gapless.enabled", value, NULL); gapless_enabled = atoi(value) || !strncmp("true", value, 4); ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); return -EINVAL; } if (mixer_ctl_set_value(ctl, 0, gapless_enabled) < 0) { ALOGE("%s: Could not set gapless mode %d", __func__, gapless_enabled); return -EINVAL; } return 0; } static struct hw_module_methods_t hal_module_methods = { .open = adev_open, }; Loading Loading
hal/audio_hw.c +31 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ static unsigned int audio_device_ref_count; static int set_voice_volume_l(struct audio_device *adev, float volume); static uint32_t get_offload_buffer_size(); static int set_gapless_mode(struct audio_device *adev); static bool is_supported_format(audio_format_t format) { Loading Loading @@ -2138,6 +2139,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, } } //Decide if we need to use gapless mode by default set_gapless_mode(adev); } else if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) { ret = voice_check_and_set_incall_music_usecase(adev, out); if (ret != 0) { Loading Loading @@ -2694,6 +2698,33 @@ static uint32_t get_offload_buffer_size() return fragment_size; } static int set_gapless_mode(struct audio_device *adev) { char value[PROPERTY_VALUE_MAX] = {0}; bool gapless_enabled = false; const char *mixer_ctl_name = "Compress Gapless Playback"; struct mixer_ctl *ctl; ALOGV("%s:", __func__); property_get("audio.offload.gapless.enabled", value, NULL); gapless_enabled = atoi(value) || !strncmp("true", value, 4); ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); return -EINVAL; } if (mixer_ctl_set_value(ctl, 0, gapless_enabled) < 0) { ALOGE("%s: Could not set gapless mode %d", __func__, gapless_enabled); return -EINVAL; } return 0; } static struct hw_module_methods_t hal_module_methods = { .open = adev_open, }; Loading