audio: miscellaneous fixes against iot changes
-Fix compilation warnings against tx app_type changes.
-Remove assignment of compress usecase outside compress
input extension.
-Define input flag for compress record usage.
Change-Id: I36630c7f6524d494b76e0a3bd074185a01e19883
diff --git a/hal/audio_extn/audio_defs.h b/hal/audio_extn/audio_defs.h
index ee4f7d4..1baa3a7 100644
--- a/hal/audio_extn/audio_defs.h
+++ b/hal/audio_extn/audio_defs.h
@@ -106,10 +106,11 @@
/* Set or Query stream profile type */
#define AUDIO_PARAMETER_STREAM_PROFILE "audio_stream_profile"
-/* audio inout flag for timestamp mode.
+/* audio input flags for compress and timestamp mode.
* check other input flags defined in audio.h for conflicts
*/
#define AUDIO_INPUT_FLAG_TIMESTAMP 0x80000000
+#define AUDIO_INPUT_FLAG_COMPRESS 0x40000000
/* MAX SECTORS for sourcetracking feature */
#define MAX_SECTORS 8
diff --git a/hal/audio_extn/compress_in.c b/hal/audio_extn/compress_in.c
index 403ee8b..1a6c789 100644
--- a/hal/audio_extn/compress_in.c
+++ b/hal/audio_extn/compress_in.c
@@ -84,8 +84,7 @@
bool audio_extn_cin_applicable_stream(struct stream_in *in)
{
- if ((in->flags & AUDIO_INPUT_FLAG_TIMESTAMP) ||
- in->usecase == USECASE_AUDIO_RECORD_COMPRESS2)
+ if (in->flags & (AUDIO_INPUT_FLAG_COMPRESS | AUDIO_INPUT_FLAG_TIMESTAMP))
return true;
return false;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index a0eb5cd..367e9a8 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -380,9 +380,9 @@
if (app_type_cfg[i+1] == 0)
break;
else if (app_type_cfg[i+1] == (size_t)s_info->app_type_cfg.app_type) {
- if (app_type_cfg[i+2] < s_info->app_type_cfg.sample_rate)
+ if (app_type_cfg[i+2] < (size_t)s_info->app_type_cfg.sample_rate)
app_type_cfg[i+2] = s_info->app_type_cfg.sample_rate;
- if (app_type_cfg[i+3] < s_info->app_type_cfg.bit_width)
+ if (app_type_cfg[i+3] < (size_t)s_info->app_type_cfg.bit_width)
app_type_cfg[i+3] = s_info->app_type_cfg.bit_width;
update = false;
break;
@@ -402,9 +402,9 @@
if (app_type_cfg[i+1] == 0)
break;
else if (app_type_cfg[i+1] == (size_t)s_info->app_type_cfg.app_type) {
- if (app_type_cfg[i+2] < s_info->app_type_cfg.sample_rate)
+ if (app_type_cfg[i+2] < (size_t)s_info->app_type_cfg.sample_rate)
app_type_cfg[i+2] = s_info->app_type_cfg.sample_rate;
- if (app_type_cfg[i+3] < s_info->app_type_cfg.bit_width)
+ if (app_type_cfg[i+3] < (size_t)s_info->app_type_cfg.bit_width)
app_type_cfg[i+3] = s_info->app_type_cfg.bit_width;
update = false;
break;
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b3a985c..659b013 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -4742,23 +4742,6 @@
in->realtime = may_use_noirq_mode(adev, in->usecase, in->flags);
}
- pthread_mutex_lock(&adev->lock);
- if (in->usecase == USECASE_AUDIO_RECORD) {
- if (!(adev->pcm_record_uc_state) &&
- ((flags & AUDIO_INPUT_FLAG_TIMESTAMP) == 0)) {
- ALOGV("%s: pcm record usecase", __func__);
- adev->pcm_record_uc_state = 1;
- } else {
- /*
- * Assign default compress record use case, actual use case
- * assignment will happen later.
- */
- in->usecase = USECASE_AUDIO_RECORD_COMPRESS2;
- ALOGV("%s: compress record usecase", __func__);
- }
- }
- pthread_mutex_unlock(&adev->lock);
-
/* Update config params with the requested sample rate and channels */
if ((in->device == AUDIO_DEVICE_IN_TELEPHONY_RX) &&
(adev->mode != AUDIO_MODE_IN_CALL)) {
@@ -4877,12 +4860,6 @@
audio_extn_compr_cap_format_supported(in->config.format))
audio_extn_compr_cap_deinit();
- if (in->usecase == USECASE_AUDIO_RECORD) {
- pthread_mutex_lock(&adev->lock);
- adev->pcm_record_uc_state = 0;
- pthread_mutex_unlock(&adev->lock);
- }
-
if (audio_extn_cin_attached_usecase(in->usecase))
audio_extn_cin_close_input_stream(in);
@@ -5014,7 +4991,6 @@
list_init(&adev->usecase_list);
adev->cur_wfd_channels = 2;
adev->offload_usecases_state = 0;
- adev->pcm_record_uc_state = 0;
adev->is_channel_status_set = false;
adev->perf_lock_opts[0] = 0x101;
adev->perf_lock_opts[1] = 0x20E;
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index f837952..38ac547 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -385,7 +385,6 @@
bool is_channel_status_set;
void *platform;
unsigned int offload_usecases_state;
- unsigned int pcm_record_uc_state;
void *visualizer_lib;
int (*visualizer_start_output)(audio_io_handle_t, int);
int (*visualizer_stop_output)(audio_io_handle_t, int);
diff --git a/qahw_api/inc/qahw_defs.h b/qahw_api/inc/qahw_defs.h
index c3def18..8b890b9 100644
--- a/qahw_api/inc/qahw_defs.h
+++ b/qahw_api/inc/qahw_defs.h
@@ -165,10 +165,11 @@
/* Set or Query stream profile type */
#define QAHW_PARAMETER_STREAM_PROFILE "audio_stream_profile"
-/* audio inout flag for timestamp mode.
+/* audio input flags for compress and timestamp mode.
* check other input flags defined in audio.h for conflicts
*/
#define QAHW_INPUT_FLAG_TIMESTAMP 0x80000000
+#define QAHW_INPUT_FLAG_COMPRESS 0x40000000
/* Query fm volume */
#define QAHW_PARAMETER_KEY_FM_VOLUME "fm_volume"