Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 988918ea authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: Update the stream_in sample rate and also acquire lock for SSR"

parents 1d6ce1bc d2634036
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1252,6 +1252,7 @@ int audio_extn_check_and_set_multichannel_usecase(struct audio_device *adev,
                                                  bool *update_params)
{
    bool ssr_supported = false;
    in->config.rate = config->sample_rate;
    ssr_supported = audio_extn_ssr_check_usecase(in);
    if (ssr_supported) {
        return audio_extn_ssr_set_usecase(in, config, update_params);
+42 −33
Original line number Diff line number Diff line
@@ -6792,8 +6792,14 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
        in->config.channels = channel_count;
        in->config.rate = config->sample_rate;
        in->sample_rate = config->sample_rate;
    } else if (!audio_extn_check_and_set_multichannel_usecase(adev,
                in, config, &channel_mask_updated)) {
    } else {
        int ret_val;
        pthread_mutex_lock(&adev->lock);
        ret_val = audio_extn_check_and_set_multichannel_usecase(adev,
               in, config, &channel_mask_updated);
        pthread_mutex_unlock(&adev->lock);

        if (!ret_val) {
           if (channel_mask_updated == true) {
               ALOGD("%s: return error to retry with updated channel mask (%#x)",
                   __func__, config->channel_mask);
@@ -6833,6 +6839,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
                goto err_open;
            }
        }
    }
    audio_extn_utils_update_stream_input_app_type_cfg(adev->platform,
                                                &adev->streams_input_cfg_list,
                                                devices, flags, in->format,
@@ -6886,6 +6893,7 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
    } else
        in_standby(&stream->common);

    pthread_mutex_lock(&adev->lock);
    if (audio_extn_ssr_get_stream() == in) {
        audio_extn_ssr_deinit();
    }
@@ -6906,6 +6914,7 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
        audio_extn_sound_trigger_stop_lab(in);
    }
    free(stream);
    pthread_mutex_unlock(&adev->lock);
    return;
}