Merge "hal: Ensure that stream is not started during Sub system restart." into av-userspace.lnx.1.0-dev.1.0
diff --git a/hal/Android.mk b/hal/Android.mk
index 76b4157..ea54bd5 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -69,6 +69,10 @@
LOCAL_CFLAGS += -DANC_HEADSET_ENABLED
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HIFI_AUDIO)),true)
+ LOCAL_CFLAGS += -DHIFI_AUDIO_ENABLED
+endif
+
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_VBAT_MONITOR)),true)
LOCAL_CFLAGS += -DVBAT_MONITOR_ENABLED
endif
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 3482127..b8b8b85 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -64,6 +64,7 @@
uint32_t proxy_channel_num;
bool hpx_enabled;
bool vbat_enabled;
+ bool hifi_audio_enabled;
};
static struct audio_extn_module aextnmod = {
@@ -73,6 +74,7 @@
.proxy_channel_num = 2,
.hpx_enabled = 0,
.vbat_enabled = 0,
+ .hifi_audio_enabled = 0,
};
#define AUDIO_PARAMETER_KEY_ANC "anc_enabled"
@@ -335,6 +337,28 @@
}
#endif
+#ifdef HIFI_AUDIO_ENABLED
+bool audio_extn_is_hifi_audio_enabled(void)
+{
+ ALOGV("%s: status: %d", __func__, aextnmod.hifi_audio_enabled);
+ return (aextnmod.hifi_audio_enabled ? true: false);
+}
+
+bool audio_extn_is_hifi_audio_supported(void)
+{
+ /*
+ * for internal codec, check for hifiaudio property to enable hifi audio
+ */
+ if (property_get_bool("persist.audio.hifi.int_codec", false))
+ {
+ ALOGD("%s: hifi audio supported on internal codec", __func__);
+ aextnmod.hifi_audio_enabled = 1;
+ }
+
+ return (aextnmod.hifi_audio_enabled ? true: false);
+}
+#endif
+
#ifdef VBAT_MONITOR_ENABLED
bool audio_extn_is_vbat_enabled(void)
{
@@ -1085,8 +1109,10 @@
int *perf_lock_opts, int size)
{
- if (!perf_lock_opts || !size || !perf_lock_acq || !handle)
- return -EINVAL;
+ if (!perf_lock_opts || !size || !perf_lock_acq || !handle) {
+ ALOGE("%s: Invalid arguments", __func__);
+ return;
+ }
/*
* Acquire performance lock for 1 sec during device path bringup.
* Lock will be released either after 1 sec or when perf_lock_release
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index c442aa7..10693ea 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -131,6 +131,14 @@
bool audio_extn_can_use_vbat(void);
#endif
+#ifndef HIFI_AUDIO_ENABLED
+#define audio_extn_is_hifi_audio_enabled() (0)
+#define audio_extn_is_hifi_audio_supported() (0)
+#else
+bool audio_extn_is_hifi_audio_enabled(void);
+bool audio_extn_is_hifi_audio_supported(void);
+#endif
+
#ifndef FLUENCE_ENABLED
#define audio_extn_set_fluence_parameters(adev, parms) (0)
#define audio_extn_get_fluence_parameters(adev, query, reply) (0)
diff --git a/hal/audio_extn/dolby.c b/hal/audio_extn/dolby.c
index 92ef4ac..c8bf543 100644
--- a/hal/audio_extn/dolby.c
+++ b/hal/audio_extn/dolby.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2010 The Android Open Source Project
@@ -772,9 +772,7 @@
ds2extnmod.dap_hal_set_hw_info(DMID, (void*)(&dolby_license.dmid));
} else {
ALOGV("%s: dap_hal_set_hw_info is NULL", __func__);
- return ret;
}
- return 0;
}
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 5d35969..fdfbfad 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 - 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
@@ -95,6 +95,9 @@
#define SPKR_PROCESSING_IN_PROGRESS 1
#define SPKR_PROCESSING_IN_IDLE 0
+/* In wsa analog mode vi feedback DAI supports at max 2 channels*/
+#define WSA_ANALOG_MODE_CHANNELS 2
+
#define MAX_PATH (256)
#define THERMAL_SYSFS "/sys/class/thermal"
#define TZ_TYPE "/sys/class/thermal/thermal_zone%d/type"
@@ -993,6 +996,10 @@
handle.spkr_prot_t0 = -1;
if (is_wsa_present()) {
+ if (platform_spkr_prot_is_wsa_analog_mode(adev) == 1) {
+ ALOGD("%s: WSA analog mode", __func__);
+ pcm_config_skr_prot.channels = WSA_ANALOG_MODE_CHANNELS;
+ }
pthread_cond_init(&handle.spkr_calib_cancel, NULL);
pthread_cond_init(&handle.spkr_calibcancel_ack, NULL);
pthread_mutex_init(&handle.mutex_spkr_prot, NULL);
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 45fa223..8f49b8d 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -622,13 +622,17 @@
__func__, platform_get_default_app_type(adev->platform), acdb_dev_id, sample_rate);
} else if (usecase->type == PCM_PLAYBACK) {
- if ((24 == usecase->stream.out->bit_width) &&
- (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
+ if (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) {
usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
- } else if (!audio_is_this_native_usecase(usecase) ||
- (usecase->stream.out->sample_rate < OUTPUT_SAMPLING_RATE_44100)) {
- usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+ } else if ((usecase->stream.out->app_type_cfg.sample_rate == OUTPUT_SAMPLING_RATE_44100 &&
+ !(audio_is_this_native_usecase(usecase))) ||
+ (usecase->stream.out->sample_rate < OUTPUT_SAMPLING_RATE_44100)) {
+ usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
}
+
+ if (!audio_extn_is_hifi_audio_enabled())
+ usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+
sample_rate = usecase->stream.out->app_type_cfg.sample_rate;
property_get("audio.playback.mch.downsample",value,"");
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 7cdfc62..378ca83 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -222,6 +222,7 @@
bool ec_ref_enabled;
bool is_wsa_speaker;
bool is_acdb_initialized;
+ bool hifi_audio;
/* Vbat monitor related flags */
bool is_vbat_speaker;
bool gsm_mode_enabled;
@@ -1773,6 +1774,14 @@
if (ret)
my_data->is_vbat_speaker = true;
+ /*
+ * Check if hifi audio( i.e. 96, 192 KHZ) is enabled for this platform,
+ * enable hifi audio by default for external codec targets
+ */
+ ret = audio_extn_is_hifi_audio_supported();
+ if (ret || is_external_codec)
+ my_data->hifi_audio = true;
+
my_data->voice_feature_set = VOICE_FEATURE_SET_DEFAULT;
my_data->acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW);
if (my_data->acdb_handle == NULL) {
@@ -1891,16 +1900,22 @@
my_data->current_backend_cfg[idx].bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
}
- my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].bitwidth_mixer_ctl =
- strdup("SLIM_0_RX Format");
- my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
- strdup("SLIM_0_RX SampleRate");
+ if (is_external_codec) {
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].bitwidth_mixer_ctl =
+ strdup("SLIM_0_RX Format");
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
+ strdup("SLIM_0_RX SampleRate");
- my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
- strdup("SLIM_5_RX Format");
- my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
- strdup("SLIM_5_RX SampleRate");
-
+ my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
+ strdup("SLIM_5_RX Format");
+ my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
+ strdup("SLIM_5_RX SampleRate");
+ } else {
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].bitwidth_mixer_ctl =
+ strdup("MI2S_RX Format");
+ my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
+ strdup("MI2S_RX SampleRate");
+ }
ret = audio_extn_utils_get_codec_version(snd_card_name,
my_data->adev->snd_card,
@@ -2337,29 +2352,16 @@
return ret;
}
-int check_hdset_combo_device(struct audio_device *adev, snd_device_t snd_device)
+int check_hdset_combo_device(snd_device_t snd_device)
{
int ret = false;
- struct listnode *node;
- int i =0;
- if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == snd_device)
+ if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_LINE == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1 == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2 == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET == snd_device)
ret = true;
- else {
- list_for_each(node, &adev->usecase_list) {
- struct audio_usecase *uc;
- uc = node_to_item(node, struct audio_usecase, list);
- ALOGD("%s: (%d) use case %s snd device %s",
- __func__, i++, use_case_table[uc->id],
- platform_get_snd_device_name(uc->out_snd_device));
-
- if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == uc->out_snd_device)
- ret = true;
- }
- }
- ALOGV("%s:napb: (%s) snd_device (%s)",
- __func__, (ret == false ? "false":"true"),
- platform_get_snd_device_name(snd_device));
return ret;
}
@@ -4084,44 +4086,6 @@
return OFFLOAD_USE_SMALL_BUFFER;
}
-int platform_is_external_codec (char *snd_card_name)
-{
-
- if (!strncmp(snd_card_name, "msm8952-tomtom-snd-card",
- sizeof("msm8952-tomtom-snd-card")) ||
- !strncmp(snd_card_name, "msm8952-tasha-snd-card",
- sizeof("msm8952-tasha-snd-card")) ||
- !strncmp(snd_card_name, "msm8952-tashalite-snd-card",
- sizeof("msm8952-tashalite-snd-card")) ||
- !strncmp(snd_card_name, "msm8952-tasha-skun-snd-card",
- sizeof("msm8952-tasha-skun-snd-card")) ||
- !strncmp(snd_card_name, "msm8976-tasha-snd-card",
- sizeof("msm8976-tasha-snd-card")) ||
- !strncmp(snd_card_name, "msm8976-tashalite-snd-card",
- sizeof("msm8976-tashalite-snd-card")) ||
- !strncmp(snd_card_name, "msm8976-tasha-skun-snd-card",
- sizeof("msm8976-tasha-skun-snd-card")) ||
- !strncmp(snd_card_name, "msm8937-tasha-snd-card",
- sizeof("msm8937-tasha-snd-card")) ||
- !strncmp(snd_card_name, "msm8937-tashalite-snd-card",
- sizeof("msm8937-tashalite-snd-card")) ||
- !strncmp(snd_card_name, "msm8953-tasha-snd-card",
- sizeof("msm8953-tasha-snd-card")) ||
- !strncmp(snd_card_name, "msm8953-tashalite-snd-card",
- sizeof("msm8953-tashalite-snd-card")))
- {
- /* external codec, for rest/old of the external codecs
- we dont support this funtionality(chaning AFE params)
- at the monment
- */
- return 1;
- }
- else {
- /* internal codec */
- return 0;
- }
-}
-
/*
* configures afe with bit width and Sample Rate
*/
@@ -4133,7 +4097,6 @@
int backend_idx = DEFAULT_CODEC_BACKEND;
struct platform_data *my_data = (struct platform_data *)adev->platform;
const char *snd_card_name = mixer_get_name(adev->mixer);
- int is_external_codec = platform_is_external_codec(snd_card_name);
int na_mode = platform_get_native_support();
@@ -4146,14 +4109,8 @@
my_data->current_backend_cfg[backend_idx].bit_width) {
struct mixer_ctl *ctl;
- if (!is_external_codec) {
- ctl = mixer_get_ctl_by_name(adev->mixer,
- "MI2S_RX Format");
-
- } else {
- ctl = mixer_get_ctl_by_name(adev->mixer,
+ ctl = mixer_get_ctl_by_name(adev->mixer,
my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl);
- }
if (!ctl) {
ALOGE("%s:becf: afe: Could not get ctl for mixer command - %s",
__func__,
@@ -4182,9 +4139,10 @@
// TODO: This has to be more dynamic based on policy file
if ((sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
- (is_external_codec)) {
- /* sample rate update is needed only for external codecs which
- support 24 bit playback*/
+ (my_data->hifi_audio)) {
+ /*
+ * sample rate update is needed only for hifi audio enabled platforms
+ */
char *rate_str = NULL;
struct mixer_ctl *ctl;
@@ -4311,7 +4269,7 @@
}
if (audio_is_true_native_stream_active(adev)) {
- if (check_hdset_combo_device(adev, snd_device)) {
+ if (check_hdset_combo_device(snd_device)) {
/*
* In true native mode Tasha has a limitation that one port at 44.1 khz
* cannot drive both spkr and hdset, to simiplify the solution lets
@@ -4333,16 +4291,15 @@
}
+
/*
- * 24 bit playback on speakers is allowed through 48
- * khz backend only
+ * hifi playback not supported on spkr devices, limit the Sample Rate
+ * to 48 khz.
*/
- if ((24 == bit_width) &&
- (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
- bit_width = (uint32_t)platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
+ if (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
- ALOGD("%s:becf: afe: 24 bit playback on speakers"
- "Configure afe to default Sample Rate(48k)", __func__);
+ ALOGD("%s:becf: afe: playback on speakers Configure afe to \
+ default Sample Rate(48k)", __func__);
}
/*
@@ -4356,14 +4313,12 @@
}
/*
- * Sample rate greater than 48K is only supported by external codecs on
- * specific devices e.g. Headphones, reset the sample rate to
- * default value if not external codec.
+ * reset the sample rate to default value(48K), if hifi audio is not supported
*/
- if (!is_external_codec) {
- ALOGD("%s:becf: afe: For internal codec only 48 is supported \
- Configure afe to default Sample Rate(48k)", __func__);
- sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+ if (!my_data->hifi_audio) {
+ ALOGD("%s:becf: afe: only 48KHZ sample rate is supported \
+ Configure afe to default Sample Rate(48k)", __func__);
+ sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
}
//check if mulitchannel clip needs to be down sampled to 48k
@@ -5094,16 +5049,20 @@
return ret;
}
-int platform_get_wsa_mode(void *adev)
+int platform_spkr_prot_is_wsa_analog_mode(void *adev)
{
struct audio_device *adev_h = adev;
char *snd_card_name;
+ /*
+ * wsa analog mode is decided based on the sound card name
+ */
snd_card_name = mixer_get_name(adev_h->mixer);
if ((!strcmp(snd_card_name, "msm8952-skum-snd-card")) ||
(!strcmp(snd_card_name, "msm8952-snd-card")) ||
(!strcmp(snd_card_name, "msm8952-snd-card-mtp")) ||
- (!strcmp(snd_card_name, "msm8976-skun-snd-card")))
+ (!strcmp(snd_card_name, "msm8976-skun-snd-card")) ||
+ (!strcmp(snd_card_name, "msm8953-snd-card-mtp")))
return 1;
else
return 0;
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index be50289..e32a73d 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -1206,3 +1206,8 @@
{
return -ENOSYS;
}
+
+int platform_spkr_prot_is_wsa_analog_mode(void *adev __unused)
+{
+ return 0;
+}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 65ef702..516179a 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2049,29 +2049,16 @@
return ret;
}
-int check_hdset_combo_device(struct audio_device *adev, snd_device_t snd_device)
+int check_hdset_combo_device(snd_device_t snd_device)
{
int ret = false;
- struct listnode *node;
- int i =0;
- if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == snd_device)
+ if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_LINE == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1 == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2 == snd_device ||
+ SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET == snd_device)
ret = true;
- else {
- list_for_each(node, &adev->usecase_list) {
- struct audio_usecase *uc;
- uc = node_to_item(node, struct audio_usecase, list);
- ALOGD("%s: (%d) use case %s snd device %s",
- __func__, i++, use_case_table[uc->id],
- platform_get_snd_device_name(uc->out_snd_device));
-
- if (SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES == uc->out_snd_device)
- ret = true;
- }
- }
- ALOGV("%s:napb: (%s) snd_device (%s)",
- __func__, (ret == false ? "false":"true"),
- platform_get_snd_device_name(snd_device));
return ret;
}
@@ -3884,7 +3871,7 @@
}
if (audio_is_true_native_stream_active(adev)) {
- if (check_hdset_combo_device(adev, snd_device)) {
+ if (check_hdset_combo_device(snd_device)) {
/*
* In true native mode Tasha has a limitation that one port at 44.1 khz
* cannot drive both spkr and hdset, to simiplify the solution lets
@@ -3906,15 +3893,13 @@
}
/*
- * 24 bit playback on speakers is allowed through 48
- * khz backend only
+ * hifi playback not supported on spkr devices, limit the Sample Rate
+ * to 48 khz.
*/
- if ((24 == bit_width) &&
- (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
- bit_width = (uint32_t)platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
+ if (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
- ALOGD("%s:becf: afe: 24 bit playback on speakers"
- "Configure afe to default Sample Rate(48k)", __func__);
+ ALOGD("%s:becf: afe: playback on speakers Configure afe to \
+ default Sample Rate(48k)", __func__);
}
/*
@@ -4571,6 +4556,11 @@
}
}
+int platform_spkr_prot_is_wsa_analog_mode(void *adev __unused)
+{
+ return 0;
+}
+
/*
* This is a lookup table to map android audio input device to audio h/w interface (backend).
* The table can be extended for other input devices by adding appropriate entries.
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 44f7d14..fb72e40 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -137,4 +137,5 @@
bool platform_can_enable_spkr_prot_on_device(snd_device_t snd_device);
int platform_get_spkr_prot_acdb_id(snd_device_t snd_device);
int platform_get_spkr_prot_snd_device(snd_device_t snd_device);
+int platform_spkr_prot_is_wsa_analog_mode(void *adev);
#endif // AUDIO_PLATFORM_API_H
diff --git a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
index 6154e0c..d2dd1d0 100644
--- a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
+++ b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-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:
@@ -145,7 +145,7 @@
=============================================================================*/
void omx_aac_aenc::wait_for_event()
{
- int rc;
+ int rc = 0;
struct timespec ts;
pthread_mutex_lock(&m_event_lock);
while (0 == m_is_event_done)
@@ -155,10 +155,19 @@
ts.tv_nsec += ((SLEEP_MS%1000) * 1000000);
rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts);
if (rc == ETIMEDOUT && !m_is_event_done) {
- DEBUG_PRINT("Timed out waiting for flush");
- if (ioctl( m_drv_fd, AUDIO_FLUSH, 0) == -1)
- DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed %d\n",
- errno);
+ DEBUG_PRINT("Timed out waiting for flush");
+ rc = ioctl(m_drv_fd, AUDIO_FLUSH, 0);
+ if (rc == -1)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ }
+ else if (rc < 0)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl failed error: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ break;
+ }
}
}
m_is_event_done = 0;
diff --git a/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp b/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
index 5e9ee4e..ba66d1b 100644
--- a/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
+++ b/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 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:
@@ -144,7 +144,7 @@
=============================================================================*/
void omx_amr_aenc::wait_for_event()
{
- int rc;
+ int rc = 0;
struct timespec ts;
pthread_mutex_lock(&m_event_lock);
while (0 == m_is_event_done)
@@ -154,10 +154,19 @@
ts.tv_nsec += ((SLEEP_MS%1000) * 1000000);
rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts);
if (rc == ETIMEDOUT && !m_is_event_done) {
- DEBUG_PRINT("Timed out waiting for flush");
- if (ioctl( m_drv_fd, AUDIO_FLUSH, 0) == -1)
- DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed %d\n",
- errno);
+ DEBUG_PRINT("Timed out waiting for flush");
+ rc = ioctl(m_drv_fd, AUDIO_FLUSH, 0);
+ if (rc == -1)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ }
+ else if (rc < 0)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl failed error: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ break;
+ }
}
}
m_is_event_done = 0;
diff --git a/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp b/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
index af9f785..84bb774 100644
--- a/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
+++ b/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 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:
@@ -144,7 +144,7 @@
=============================================================================*/
void omx_evrc_aenc::wait_for_event()
{
- int rc;
+ int rc = 0;
struct timespec ts;
pthread_mutex_lock(&m_event_lock);
while (0 == m_is_event_done)
@@ -154,10 +154,19 @@
ts.tv_nsec += ((SLEEP_MS%1000) * 1000000);
rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts);
if (rc == ETIMEDOUT && !m_is_event_done) {
- DEBUG_PRINT("Timed out waiting for flush");
- if (ioctl( m_drv_fd, AUDIO_FLUSH, 0) == -1)
- DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed %d\n",
- errno);
+ DEBUG_PRINT("Timed out waiting for flush");
+ rc = ioctl(m_drv_fd, AUDIO_FLUSH, 0);
+ if (rc == -1)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ }
+ else if (rc < 0)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl failed error: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ break;
+ }
}
}
m_is_event_done = 0;
diff --git a/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp b/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
index d25eb7f..1d7962b 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
+++ b/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 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:
@@ -144,7 +144,7 @@
=============================================================================*/
void omx_qcelp13_aenc::wait_for_event()
{
- int rc;
+ int rc = 0;
struct timespec ts;
pthread_mutex_lock(&m_event_lock);
while (0 == m_is_event_done)
@@ -154,10 +154,19 @@
ts.tv_nsec += ((SLEEP_MS%1000) * 1000000);
rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts);
if (rc == ETIMEDOUT && !m_is_event_done) {
- DEBUG_PRINT("Timed out waiting for flush");
- if (ioctl( m_drv_fd, AUDIO_FLUSH, 0) == -1)
- DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed %d\n",
- errno);
+ DEBUG_PRINT("Timed out waiting for flush");
+ rc = ioctl( m_drv_fd, AUDIO_FLUSH, 0);
+ if (rc == -1)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl flush failed: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ }
+ else if (rc < 0)
+ {
+ DEBUG_PRINT_ERROR("Flush:Input port, ioctl failed error: rc:%d, %s, no:%d \n",
+ rc, strerror(errno), errno);
+ break;
+ }
}
}
m_is_event_done = 0;
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 37cceab..cbebf42 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2009 The Android Open Source Project
@@ -397,6 +397,7 @@
ALOGW("setDeviceConnectionState() invalid device: %x", device);
return BAD_VALUE;
}
+
// This function checks for the parameters which can be offloaded.
// This can be enhanced depending on the capability of the DSP and policy
// of the system.
@@ -577,6 +578,7 @@
ALOGV("isOffloadSupported() profile %sfound", profile != 0 ? "" : "NOT ");
return (profile != 0);
}
+
audio_devices_t AudioPolicyManagerCustom::getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc,
bool fromCache)
{
@@ -642,6 +644,7 @@
ALOGV("getNewOutputDevice() selected device %x", device);
return device;
}
+
void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
{
ALOGV("setPhoneState() state %d", state);
@@ -1013,7 +1016,7 @@
handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT);
// handle special case for sonification while in call
- if (isInCall() && (outputDesc->mRefCount[stream] == 1)) {
+ if (isInCall()) {
if (outputDesc->isDuplicated()) {
handleIncallSonification(stream, false, false, outputDesc->subOutput1()->mIoHandle);
handleIncallSonification(stream, false, false, outputDesc->subOutput2()->mIoHandle);
@@ -1068,6 +1071,7 @@
return INVALID_OPERATION;
}
}
+
status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputDesc,
audio_stream_type_t stream,
audio_devices_t device,
@@ -1153,13 +1157,14 @@
}
}
else {
- // handle special case for sonification while in call
- if (isInCall()) {
- handleIncallSonification(stream, true, false, outputDesc->mIoHandle);
- }
+ // handle special case for sonification while in call
+ if (isInCall()) {
+ handleIncallSonification(stream, true, false, outputDesc->mIoHandle);
}
+ }
return NO_ERROR;
}
+
void AudioPolicyManagerCustom::handleIncallSonification(audio_stream_type_t stream,
bool starting, bool stateChange,
audio_io_handle_t output)
@@ -1212,6 +1217,7 @@
}
}
}
+
void AudioPolicyManagerCustom::handleNotificationRoutingForStream(audio_stream_type_t stream) {
switch(stream) {
case AUDIO_STREAM_MUSIC:
@@ -1222,6 +1228,7 @@
break;
}
}
+
status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream,
int index,
const sp<AudioOutputDescriptor>& outputDesc,
@@ -1291,6 +1298,7 @@
return NO_ERROR;
}
+
bool AudioPolicyManagerCustom::isDirectOutput(audio_io_handle_t output) {
for (size_t i = 0; i < mOutputs.size(); i++) {
audio_io_handle_t curOutput = mOutputs.keyAt(i);
@@ -1861,6 +1869,7 @@
selectedDeviceId,
inputType);
}
+
status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
audio_session_t session)
{
@@ -1984,6 +1993,7 @@
#endif
return NO_ERROR;
}
+
status_t AudioPolicyManagerCustom::stopInput(audio_io_handle_t input,
audio_session_t session)
{