Merge "config: supplement the supported format into compress_offload_24"

This commit is contained in:
qctecmdr 2020-09-15 10:44:14 -07:00 committed by Gerrit - the friendly Code Review server
commit 8b79353866
3 changed files with 66 additions and 70 deletions

4
configs/holi/audio_io_policy.conf Normal file → Executable file
View File

@ -69,14 +69,14 @@ outputs {
}
compress_offload_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_PCM_16_BIT_OFFLOAD|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_PCM_16_BIT_OFFLOAD|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2|AUDIO_FORMAT_AAC_LATM_LC|AUDIO_FORMAT_AAC_LATM_HE_V1|AUDIO_FORMAT_AAC_LATM_HE_V2
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 16
app_type 69936
}
compress_offload_24 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
formats AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_VORBIS|AUDIO_FORMAT_WMA|AUDIO_FORMAT_WMA_PRO
formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_ALAC|AUDIO_FORMAT_APE|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_WMA_PRO|AUDIO_FORMAT_AAC_ADTS_LC|AUDIO_FORMAT_AAC_ADTS_HE_V1|AUDIO_FORMAT_AAC_ADTS_HE_V2|AUDIO_FORMAT_AAC_LATM_LC|AUDIO_FORMAT_AAC_LATM_HE_V1|AUDIO_FORMAT_AAC_LATM_HE_V2
sampling_rates 44100|48000|88200|96000|176400|192000
bit_width 24
app_type 69940

View File

@ -377,62 +377,6 @@ static int usb_get_sample_rates(int type, char *rates_str,
return 0;
}
int usb_get_service_interval(bool playback,
unsigned long *service_interval)
{
const char *ctl_name = "USB_AUDIO_RX service_interval";
struct mixer_ctl *ctl = mixer_get_ctl_by_name(usbmod->adev->mixer,
ctl_name);
if (!playback) {
ALOGE("%s not valid for capture", __func__);
return -1;
}
if (!ctl) {
ALOGV("%s: could not get mixer %s", __func__, ctl_name);
return -1;
}
*service_interval = mixer_ctl_get_value(ctl, 0);
return 0;
}
int usb_set_service_interval(bool playback,
unsigned long service_interval,
bool *reconfig)
{
*reconfig = false;
unsigned long current_service_interval = 0;
const char *ctl_name = "USB_AUDIO_RX service_interval";
struct mixer_ctl *ctl = mixer_get_ctl_by_name(usbmod->adev->mixer,
ctl_name);
if (!playback) {
ALOGE("%s not valid for capture", __func__);
return -1;
}
if (!ctl) {
ALOGV("%s: could not get mixer %s", __func__, ctl_name);
return -1;
}
if (usb_get_service_interval(playback,
&current_service_interval) != 0) {
ALOGE("%s Unable to get current service interval", __func__);
return -1;
}
if (current_service_interval != service_interval) {
mixer_ctl_set_value(ctl, 0, service_interval);
*reconfig = usbmod->usb_reconfig = true;
}
else
*reconfig = usbmod->usb_reconfig = false;
return 0;
}
static int get_usb_service_interval(const char *interval_str_start,
struct usb_device_config *usb_device_info)
{
@ -640,7 +584,6 @@ static int usb_get_capability(int type,
// Data packet interval is an optional field.
// Assume 0ms interval if this cannot be read
// LPASS USB and HLOS USB will figure out the default to use
bool reconfig = false;
usb_device_info->service_interval_us = DEFAULT_SERVICE_INTERVAL_US;
interval_str_start = strstr(str_start, DATA_PACKET_INTERVAL_STR);
if (interval_str_start != NULL) {
@ -651,9 +594,6 @@ static int usb_get_capability(int type,
__func__);
}
}
usb_set_service_interval(true /*playback*/,
usb_device_info->service_interval_us,
&reconfig);
/* Add to list if every field is valid */
list_add_tail(&usb_card_info->usb_device_conf_list,
&usb_device_info->list);
@ -1452,6 +1392,62 @@ int usb_altset_for_service_interval(bool playback,
#undef SET_OR_RETURN_ON_ERROR
}
int usb_get_service_interval(bool playback,
unsigned long *service_interval)
{
const char *ctl_name = "USB_AUDIO_RX service_interval";
struct mixer_ctl *ctl = mixer_get_ctl_by_name(usbmod->adev->mixer,
ctl_name);
if (!playback) {
ALOGE("%s not valid for capture", __func__);
return -1;
}
if (!ctl) {
ALOGV("%s: could not get mixer %s", __func__, ctl_name);
return -1;
}
*service_interval = mixer_ctl_get_value(ctl, 0);
return 0;
}
int usb_set_service_interval(bool playback,
unsigned long service_interval,
bool *reconfig)
{
*reconfig = false;
unsigned long current_service_interval = 0;
const char *ctl_name = "USB_AUDIO_RX service_interval";
struct mixer_ctl *ctl = mixer_get_ctl_by_name(usbmod->adev->mixer,
ctl_name);
if (!playback) {
ALOGE("%s not valid for capture", __func__);
return -1;
}
if (!ctl) {
ALOGV("%s: could not get mixer %s", __func__, ctl_name);
return -1;
}
if (usb_get_service_interval(playback,
&current_service_interval) != 0) {
ALOGE("%s Unable to get current service interval", __func__);
return -1;
}
if (current_service_interval != service_interval) {
mixer_ctl_set_value(ctl, 0, service_interval);
*reconfig = usbmod->usb_reconfig = true;
}
else
*reconfig = usbmod->usb_reconfig = false;
return 0;
}
int usb_check_and_set_svc_int(struct audio_usecase *uc_info,
bool starting_output_stream)
{

View File

@ -4952,14 +4952,6 @@ int route_output_stream(struct stream_out *out,
if (!voice_is_call_state_active(adev)) {
if (adev->mode == AUDIO_MODE_IN_CALL) {
adev->current_call_output = out;
if (is_usb_out_device_type(&out->device_list)) {
service_interval =
audio_extn_usb_find_service_interval(true, true /*playback*/);
audio_extn_usb_set_service_interval(true /*playback*/,
service_interval,
&reconfig);
ALOGD("%s, svc_int(%ld),reconfig(%d)",__func__,service_interval, reconfig);
}
ret = voice_start_call(adev);
}
} else {
@ -4968,6 +4960,14 @@ int route_output_stream(struct stream_out *out,
}
}
if (is_usb_out_device_type(&out->device_list)) {
service_interval = audio_extn_usb_find_service_interval(false, true /*playback*/);
audio_extn_usb_set_service_interval(true /*playback*/,
service_interval,
&reconfig);
ALOGD("%s, svc_int(%ld),reconfig(%d)",__func__,service_interval, reconfig);
}
if (!out->standby) {
if (!same_dev) {
ALOGV("update routing change");