hal: Add support for two concurrent record sessions.

Add support to fallback to compress record path for second
record session during concurrent recording.

Change-Id: I0b570bb8a15fa6b07210e643b63ce65d8d95616a
This commit is contained in:
Samyak Jain 2018-12-18 16:40:52 +05:30 committed by Gerrit - the friendly Code Review server
parent 2725368d5e
commit 15fda66019
3 changed files with 26 additions and 0 deletions

View File

@ -321,6 +321,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_QAF)),true)
LOCAL_SRC_FILES += audio_extn/qaf.c
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_CONCURRENT_CAPTURE)),true)
LOCAL_CFLAGS += -DCONCURRENT_CAPTURE_ENABLED
endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_INPUT)),true)
LOCAL_CFLAGS += -DCOMPRESS_INPUT_ENABLED
LOCAL_SRC_FILES += audio_extn/compress_in.c

View File

@ -7858,6 +7858,22 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
pthread_mutex_lock(&adev->lock);
ret_val = audio_extn_check_and_set_multichannel_usecase(adev,
in, config, &channel_mask_updated);
#ifdef CONCURRENT_CAPTURE_ENABLED
/* Acquire lock to avoid two concurrent use cases initialized to
same pcm record use case*/
if(in->usecase == USECASE_AUDIO_RECORD) {
if (!(adev->pcm_record_uc_state)) {
ALOGV("%s: using USECASE_AUDIO_RECORD",__func__);
adev->pcm_record_uc_state = 1;
} else {
/* Assign compress record use case for second record */
in->usecase = USECASE_AUDIO_RECORD_COMPRESS2;
in->flags |= AUDIO_INPUT_FLAG_COMPRESS;
ALOGV("%s: overriding usecase with USECASE_AUDIO_RECORD_COMPRESS2 and appending compress flag", __func__);
}
}
#endif
pthread_mutex_unlock(&adev->lock);
if (!ret_val) {
@ -7983,6 +7999,10 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
in_standby(&stream->common);
pthread_mutex_lock(&adev->lock);
if (in->usecase == USECASE_AUDIO_RECORD) {
adev->pcm_record_uc_state = 0;
}
if (audio_extn_ssr_get_stream() == in) {
audio_extn_ssr_deinit();
}
@ -8442,6 +8462,7 @@ static int adev_open(const hw_module_t *module, const char *name,
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;

View File

@ -526,6 +526,7 @@ struct audio_device {
void *platform;
void *extspk;
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);