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

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

Merge "hal: Restrict SSR recording to channel position representation"

parents 135697ad 79b67fcd
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ endif
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SSR)),true)
    LOCAL_CFLAGS += -DSSR_ENABLED
    LOCAL_SRC_FILES += audio_extn/ssr.c
    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound/
    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound_3mic/
    LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc/
endif
+48 −0
Original line number Diff line number Diff line
@@ -930,3 +930,51 @@ void audio_extn_perf_lock_release(void)
        ALOGE("%s: Perf lock release error \n", __func__);
}
#endif /* KPI_OPTIMIZE_ENABLED */

static int audio_extn_set_multichannel_usecase(struct audio_device *adev,
                                               struct stream_in *in,
                                               struct audio_config *config,
                                               bool *update_params)
{
    int ret = -EINVAL;
    int channel_count = audio_channel_count_from_in_mask(in->channel_mask);
    *update_params = false;

    int max_mic_count = platform_get_max_mic_count(adev->platform);
    /* validate input params*/
    if ((channel_count == 6) &&
        (in->format == AUDIO_FORMAT_PCM_16_BIT)) {

        switch (max_mic_count) {
            case 4:
                config->channel_mask = AUDIO_CHANNEL_INDEX_MASK_4;
                break;
            case 3:
                config->channel_mask = AUDIO_CHANNEL_INDEX_MASK_3;
                break;
            case 2:
                config->channel_mask = AUDIO_CHANNEL_IN_STEREO;
                break;
            default:
                config->channel_mask = AUDIO_CHANNEL_IN_STEREO;
                break;
       }
        ret = 0;
        *update_params = true;
    }
    return ret;
}

int audio_extn_check_and_set_multichannel_usecase(struct audio_device *adev,
                                                  struct stream_in *in,
                                                  struct audio_config *config,
                                                  bool *update_params)
{
    bool ssr_supported = false;
    ssr_supported = audio_extn_ssr_check_usecase(in);
    if (ssr_supported) {
        return audio_extn_ssr_set_usecase(in, config, update_params);
    } else {
        return audio_extn_set_multichannel_usecase(adev, in, config, update_params);
    }
}
+10 −1
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@ bool audio_extn_usb_is_proxy_inuse();
#endif

#ifndef SSR_ENABLED
#define audio_extn_ssr_check_usecase(in)      (0)
#define audio_extn_ssr_set_usecase(in, config, update_params)      (0)
#define audio_extn_ssr_init(in, num_out_chan)         (0)
#define audio_extn_ssr_deinit()                       (0)
#define audio_extn_ssr_update_enabled()               (0)
@@ -157,6 +159,10 @@ bool audio_extn_usb_is_proxy_inuse();
#define audio_extn_ssr_get_parameters(adev, parms, reply) (0)
#define audio_extn_ssr_get_stream()                   (0)
#else
bool audio_extn_ssr_check_usecase(struct stream_in *in);
int audio_extn_ssr_set_usecase(struct stream_in *in,
                                         struct audio_config *config,
                                         bool *update_params);
int32_t audio_extn_ssr_init(struct stream_in *in,
                            int num_out_chan);
int32_t audio_extn_ssr_deinit();
@@ -171,7 +177,10 @@ void audio_extn_ssr_get_parameters(const struct audio_device *adev,
                                   struct str_parms *reply);
struct stream_in *audio_extn_ssr_get_stream();
#endif

int audio_extn_check_and_set_multichannel_usecase(struct audio_device *adev,
                                                  struct stream_in *in,
                                                  struct audio_config *config,
                                                  bool *update_params);
#ifndef HW_VARIANTS_ENABLED
#define hw_info_init(snd_card_name)                  (0)
#define hw_info_deinit(hw_info)                      (0)
Loading