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

Commit dcb43442 authored by Naresh Tanniru's avatar Naresh Tanniru Committed by Gerrit - the friendly Code Review server
Browse files

hal: Reject DSP decoder request during voice call

- For resource constrained targets DSP decoders
  should not supported during voice call
  due to MIPS limitation

- Add support for get param to check dsp decoder
  availability, which will be used by frameworks
  before creation of decoder

Change-Id: Ida0086aa30ab39e240581a3f482a450983d6ccd6
parent eef44a98
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -141,6 +141,19 @@ char cal_name_info[WCD9XXX_MAX_CAL][MAX_CAL_NAME] = {

#define AUDIO_PARAMETER_KEY_REC_PLAY_CONC "rec_play_conc_on"

#define  AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED  "is_hw_dec_session_allowed"

#define MAX_DSP_ONLY_DECODERS 6

char * dsp_only_decoders_mime[] = {
	"audio/x-ms-wma" /* wma*/ ,
	"audio/x-ms-wma-lossless" /* wma lossless */ ,
	"audio/x-ms-wma-pro" /* wma prop */ ,
	"audio/amr-wb-plus" /* amr wb plus */ ,
	"audio/alac"  /*alac */ ,
	"audio/x-ape" /*ape */,
};

enum {
	VOICE_FEATURE_SET_DEFAULT,
	VOICE_FEATURE_SET_VOLUME_BOOST
@@ -3068,6 +3081,32 @@ void platform_get_parameters(void *platform,
        str_parms_add_str(reply, AUDIO_PARAMETER_KEY_VOLUME_BOOST, value);
    }

    ret = str_parms_get_str(query, AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED,
                                    value, sizeof(value));

    if (ret >= 0) {
        int isallowed = 1; /*true*/

        if(voice_is_in_call(my_data->adev)) {
            char *decoder_mime_type = value;

            //check if unsupported mime type or not
            if(decoder_mime_type) {
                int i = 0;
                for (i = 0; i < sizeof(dsp_only_decoders_mime)/sizeof(dsp_only_decoders_mime[0]); i++) {
                    if (!strncmp(decoder_mime_type, dsp_only_decoders_mime[i],
                    strlen(dsp_only_decoders_mime[i]))) {
                       ALOGE("Rejecting request for DSP only session from HAL during voice call");
                       isallowed = 0;
                       break;
                    }
                }
            }
        }
        str_parms_add_int(reply, AUDIO_PARAMETER_IS_HW_DECODER_SESSION_ALLOWED, isallowed);
    }


    /* Handle audio calibration keys */
    kv_pairs = str_parms_to_str(reply);
    ALOGV("%s: exit: returns - %s", __func__, kv_pairs);