Merge "hal: Do not force mono for VoIP Rx with stock configuration"
This commit is contained in:
commit
d293a67203
|
@ -800,6 +800,7 @@ int audio_extn_utils_get_bit_width_from_string(const char *);
|
|||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
int audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
|
||||
#ifdef DS2_DOLBY_DAP_ENABLED
|
||||
#define LIB_DS2_DAP_HAL "vendor/lib/libhwdaphal.so"
|
||||
|
|
|
@ -42,47 +42,17 @@
|
|||
#include "voice_extn.h"
|
||||
#include "audio_feature_manager.h"
|
||||
|
||||
#ifdef __LP64__
|
||||
#define VNDK_FWK_LIB_PATH "/vendor/lib64/libqti_vndfwk_detect.so"
|
||||
#else
|
||||
#define VNDK_FWK_LIB_PATH "/vendor/lib/libqti_vndfwk_detect.so"
|
||||
#endif
|
||||
|
||||
AHalValues* confValues = NULL;
|
||||
static void *vndk_fwk_lib_handle = NULL;
|
||||
|
||||
typedef int (*vndk_fwk_isVendorEnhancedFwk_t)();
|
||||
static vndk_fwk_isVendorEnhancedFwk_t vndk_fwk_isVendorEnhancedFwk;
|
||||
|
||||
void audio_feature_manager_init()
|
||||
{
|
||||
ALOGD("%s: Enter", __func__);
|
||||
int is_running_with_enhanced_fwk = 0;
|
||||
|
||||
//dlopen lib
|
||||
vndk_fwk_lib_handle = dlopen(VNDK_FWK_LIB_PATH, RTLD_NOW);
|
||||
if (vndk_fwk_lib_handle != NULL) {
|
||||
vndk_fwk_isVendorEnhancedFwk = (vndk_fwk_isVendorEnhancedFwk_t)
|
||||
dlsym(vndk_fwk_lib_handle, "isRunningWithVendorEnhancedFramework");
|
||||
if (vndk_fwk_isVendorEnhancedFwk == NULL) {
|
||||
ALOGW("%s: VNDK_FWK_LIB not found, defaulting to enhanced_fwk configuration",
|
||||
__func__);
|
||||
is_running_with_enhanced_fwk = 1;
|
||||
} else {
|
||||
is_running_with_enhanced_fwk = vndk_fwk_isVendorEnhancedFwk();
|
||||
}
|
||||
}
|
||||
|
||||
ALOGD("%s: vndk_fwk_isVendorEnhancedFwk=%d", __func__, is_running_with_enhanced_fwk);
|
||||
int is_running_with_enhanced_fwk = audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
audio_extn_ahal_config_helper_init(is_running_with_enhanced_fwk);
|
||||
audio_extn_get_feature_values(&confValues);
|
||||
audio_extn_feature_init(is_running_with_enhanced_fwk);
|
||||
voice_extn_feature_init(is_running_with_enhanced_fwk);
|
||||
|
||||
if (vndk_fwk_lib_handle != NULL) {
|
||||
dlclose(vndk_fwk_lib_handle);
|
||||
vndk_fwk_lib_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool audio_feature_manager_is_feature_enabled(audio_ext_feature feature)
|
||||
|
|
|
@ -108,6 +108,16 @@
|
|||
#define MAX_CHANNELS_SUPPORTED 8
|
||||
#endif
|
||||
|
||||
#ifdef __LP64__
|
||||
#define VNDK_FWK_LIB_PATH "/vendor/lib64/libqti_vndfwk_detect.so"
|
||||
#else
|
||||
#define VNDK_FWK_LIB_PATH "/vendor/lib/libqti_vndfwk_detect.so"
|
||||
#endif
|
||||
|
||||
static void *vndk_fwk_lib_handle = NULL;
|
||||
typedef int (*vndk_fwk_isVendorEnhancedFwk_t)();
|
||||
static vndk_fwk_isVendorEnhancedFwk_t vndk_fwk_isVendorEnhancedFwk;
|
||||
|
||||
typedef struct {
|
||||
const char *id_string;
|
||||
const int value;
|
||||
|
@ -2752,3 +2762,31 @@ int audio_extn_utils_send_app_type_gain(struct audio_device *adev,
|
|||
return mixer_ctl_set_array(ctl, gain_cfg,
|
||||
sizeof(gain_cfg)/sizeof(gain_cfg[0]));
|
||||
}
|
||||
|
||||
int audio_extn_utils_is_vendor_enhanced_fwk()
|
||||
{
|
||||
static int is_running_with_enhanced_fwk = -EINVAL;
|
||||
|
||||
if (is_running_with_enhanced_fwk == -EINVAL) {
|
||||
vndk_fwk_lib_handle = dlopen(VNDK_FWK_LIB_PATH, RTLD_NOW);
|
||||
if (vndk_fwk_lib_handle != NULL) {
|
||||
vndk_fwk_isVendorEnhancedFwk = (vndk_fwk_isVendorEnhancedFwk_t)
|
||||
dlsym(vndk_fwk_lib_handle, "isRunningWithVendorEnhancedFramework");
|
||||
if (vndk_fwk_isVendorEnhancedFwk == NULL) {
|
||||
ALOGW("%s: dlsym failed, defaulting to enhanced_fwk configuration",
|
||||
__func__);
|
||||
is_running_with_enhanced_fwk = 1;
|
||||
} else {
|
||||
is_running_with_enhanced_fwk = vndk_fwk_isVendorEnhancedFwk();
|
||||
}
|
||||
dlclose(vndk_fwk_lib_handle);
|
||||
vndk_fwk_lib_handle = NULL;
|
||||
} else {
|
||||
ALOGW("%s: VNDK_FWK_LIB not found, setting stock configuration", __func__);
|
||||
is_running_with_enhanced_fwk = 0;
|
||||
}
|
||||
ALOGV("%s: vndk_fwk_isVendorEnhancedFwk=%d", __func__, is_running_with_enhanced_fwk);
|
||||
}
|
||||
|
||||
return is_running_with_enhanced_fwk;
|
||||
}
|
||||
|
|
|
@ -5287,7 +5287,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
|
|||
__func__, frames, frame_size, bytes_to_write);
|
||||
|
||||
if (out->usecase == USECASE_INCALL_MUSIC_UPLINK ||
|
||||
out->usecase == USECASE_INCALL_MUSIC_UPLINK2) {
|
||||
out->usecase == USECASE_INCALL_MUSIC_UPLINK2 ||
|
||||
(out->usecase == USECASE_AUDIO_PLAYBACK_VOIP &&
|
||||
!audio_extn_utils_is_vendor_enhanced_fwk())) {
|
||||
size_t channel_count = audio_channel_count_from_out_mask(out->channel_mask);
|
||||
int16_t *src = (int16_t *)buffer;
|
||||
int16_t *dst = (int16_t *)buffer;
|
||||
|
@ -6933,7 +6935,8 @@ int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
if (!voice_extn_is_compress_voip_supported()) {
|
||||
if (out->sample_rate == 8000 || out->sample_rate == 16000 ||
|
||||
out->sample_rate == 32000 || out->sample_rate == 48000) {
|
||||
out->channel_mask = AUDIO_CHANNEL_OUT_MONO;
|
||||
out->channel_mask = audio_extn_utils_is_vendor_enhanced_fwk() ?
|
||||
AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO;
|
||||
out->usecase = USECASE_AUDIO_PLAYBACK_VOIP;
|
||||
out->format = AUDIO_FORMAT_PCM_16_BIT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue