hal: Check for multiple offload usecases
While checking if a usecase is compressed offload, consider concurrent multiple offload usecases Change-Id: If01424137d4d5640e97ead58f151300a168f0912
This commit is contained in:
parent
284eff23e4
commit
2f89cfa059
|
@ -495,7 +495,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase)
|
|||
if ((usecase->id != USECASE_AUDIO_PLAYBACK_DEEP_BUFFER) &&
|
||||
(usecase->id != USECASE_AUDIO_PLAYBACK_LOW_LATENCY) &&
|
||||
(usecase->id != USECASE_AUDIO_PLAYBACK_MULTI_CH) &&
|
||||
(usecase->id != USECASE_AUDIO_PLAYBACK_OFFLOAD)) {
|
||||
(!is_offload_usecase(usecase->id))) {
|
||||
ALOGV("%s: a playback path where app type cfg is not required", __func__);
|
||||
rc = 0;
|
||||
goto exit_send_app_type_cfg;
|
||||
|
|
|
@ -1929,7 +1929,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
|
|||
ALOGD(" %s: sound card is not active/SSR state", __func__);
|
||||
ret= -EIO;
|
||||
goto exit;
|
||||
} else if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) {
|
||||
} else if (is_offload_usecase(out->usecase)) {
|
||||
//during SSR for compress usecase we should return error to flinger
|
||||
ALOGD(" copl %s: sound card is not active/SSR state", __func__);
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
|
@ -2838,6 +2838,28 @@ static void adev_close_output_stream(struct audio_hw_device *dev __unused,
|
|||
ALOGV("%s: exit", __func__);
|
||||
}
|
||||
|
||||
static void close_compress_sessions(struct audio_device *adev)
|
||||
{
|
||||
struct stream_out *out = NULL;
|
||||
struct listnode *node = NULL;
|
||||
struct listnode *tmp = NULL;
|
||||
struct audio_usecase *usecase = NULL;
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
list_for_each_safe(node, tmp, &adev->usecase_list) {
|
||||
usecase = node_to_item(node, struct audio_usecase, list);
|
||||
if (is_offload_usecase(usecase->id)) {
|
||||
if (usecase && usecase->stream.out) {
|
||||
ALOGI(" %s closing compress session %d on OFFLINE state", __func__, usecase->id);
|
||||
out = usecase->stream.out;
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
out_standby(&out->stream.common);
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
}
|
||||
|
||||
static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
||||
{
|
||||
struct audio_device *adev = (struct audio_device *)dev;
|
||||
|
@ -2859,22 +2881,10 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
|||
if (strstr(snd_card_status, "OFFLINE")) {
|
||||
struct listnode *node;
|
||||
struct audio_usecase *usecase;
|
||||
|
||||
ALOGD("Received sound card OFFLINE status");
|
||||
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
|
||||
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
//close compress session on OFFLINE status
|
||||
usecase = get_usecase_from_list(adev,USECASE_AUDIO_PLAYBACK_OFFLOAD);
|
||||
if (usecase && usecase->stream.out) {
|
||||
ALOGD(" %s closing compress session on OFFLINE state", __func__);
|
||||
|
||||
struct stream_out *out = usecase->stream.out;
|
||||
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
out_standby(&out->stream.common);
|
||||
} else
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
//close compress sessions on OFFLINE status
|
||||
close_compress_sessions(adev);
|
||||
} else if (strstr(snd_card_status, "ONLINE")) {
|
||||
ALOGD("Received sound card ONLINE status");
|
||||
set_snd_card_state(adev,SND_CARD_STATE_ONLINE);
|
||||
|
|
|
@ -509,6 +509,16 @@ static struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = {
|
|||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_LOW_LATENCY)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_MULTI_CH)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD)},
|
||||
#ifdef MULTIPLE_OFFLOAD_ENABLED
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD2)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD3)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD4)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD5)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD6)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD7)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD8)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_OFFLOAD9)},
|
||||
#endif
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_RECORD)},
|
||||
{TO_NAME_INDEX(USECASE_AUDIO_RECORD_LOW_LATENCY)},
|
||||
{TO_NAME_INDEX(USECASE_VOICE_CALL)},
|
||||
|
|
Loading…
Reference in New Issue