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

Commit 0e985805 authored by Arun Kumar Dasari's avatar Arun Kumar Dasari Committed by Gerrit - the friendly Code Review server
Browse files

mm-audio: amrnb: update test app to handle invalid params

Update test app to report error if bandmode and dtxenable
are not in range. Also update amrwb max framelength to 64 as
amrwb maximum framesize is 64.

Change-Id: Ibd7470a574a0e1fcacd6c15f13b1e98b9963ea73
parent 9117c39d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -135,8 +135,11 @@ extern "C" {
#define FALSE 0

#define NUMOFFRAMES                   1
#define MAXFRAMELENGTH                32
#define OMX_AMR_OUTPUT_BUFFER_SIZE    ((NUMOFFRAMES * (sizeof(ENC_META_OUT) + MAXFRAMELENGTH) \
#define AMRNB_MAXFRAMELENGTH                32
#define AMRWB_MAXFRAMELENGTH                62
#define OMX_AMRNB_OUTPUT_BUFFER_SIZE    ((NUMOFFRAMES * (sizeof(ENC_META_OUT) + AMRNB_MAXFRAMELENGTH) \
                        + 1))
#define OMX_AMRWB_OUTPUT_BUFFER_SIZE    ((NUMOFFRAMES * (sizeof(ENC_META_OUT) + AMRWB_MAXFRAMELENGTH) \
                        + 1))
#define FRAMEDURATION                 20000

+25 −7
Original line number Diff line number Diff line
@@ -281,7 +281,6 @@ omx_amr_aenc::omx_amr_aenc(): m_tmp_meta_buf(NULL),
        m_out_act_buf_count (OMX_CORE_NUM_OUTPUT_BUFFERS),
        m_inp_current_buf_count(0),
        m_out_current_buf_count(0),
        output_buffer_size((OMX_U32)OMX_AMR_OUTPUT_BUFFER_SIZE),
        input_buffer_size(OMX_CORE_INPUT_BUFFER_SIZE),
        m_session_id(0),
        m_inp_bEnabled(OMX_TRUE),
@@ -1136,6 +1135,15 @@ OMX_ERRORTYPE omx_amr_aenc::component_init(OMX_STRING role)
		sizeof(component_Role.cRole));
        DEBUG_PRINT("\ncomponent_init: Component %s LOADED is invalid\n", role);
    }

    if (!amrwb_enable)
    {
        output_buffer_size = (OMX_U32)OMX_AMRNB_OUTPUT_BUFFER_SIZE;
    }
    else
    {
        output_buffer_size = (OMX_U32)OMX_AMRWB_OUTPUT_BUFFER_SIZE;
    }
    if(pcm_input)
    {
        m_tmp_meta_buf = (OMX_U8*) malloc(sizeof(OMX_U8) *
@@ -1146,8 +1154,18 @@ OMX_ERRORTYPE omx_amr_aenc::component_init(OMX_STRING role)
            return OMX_ErrorInsufficientResources;
        }
    }

    if (!amrwb_enable)
    {
        m_tmp_out_meta_buf =
            (OMX_U8*)malloc(sizeof(OMX_U8)*OMX_AMRNB_OUTPUT_BUFFER_SIZE);
    }
    else
    {
        m_tmp_out_meta_buf =
		(OMX_U8*)malloc(sizeof(OMX_U8)*OMX_AMR_OUTPUT_BUFFER_SIZE);
            (OMX_U8*)malloc(sizeof(OMX_U8)*OMX_AMRWB_OUTPUT_BUFFER_SIZE);
    }

    if (m_tmp_out_meta_buf == NULL ){
        DEBUG_PRINT_ERROR("Mem alloc failed for out meta buf\n");
        return OMX_ErrorInsufficientResources;
+17 −1
Original line number Diff line number Diff line
@@ -529,12 +529,28 @@ int main(int argc, char **argv)
    } else {
          DEBUG_PRINT(" invalid format: \n");
          DEBUG_PRINT("ex: ./mm-aenc-omxamr-test INPUTFILE OUTPUTFILE Tunnel BANDMODE DTXENABLE RECORDPATH RECORDTIME amrwb_enable \n");
          DEBUG_PRINT("Bandmode 1-7, dtxenable 0-1\n");
          DEBUG_PRINT("amrnb:Bandmode 1-8 amrwb:Bandmode 0-8, dtxenable 0-1\n");
          DEBUG_PRINT("RECORDPATH 0(TX),1(RX),2(BOTH),3(MIC)\n");
          DEBUG_PRINT("RECORDTIME in seconds for AST Automation\n");
	  DEBUG_PRINT("amrwb_enable:1-amrwb 0-amrnb\n");
          return 0;
    }

    if (!amrwb_enable && (bandmode < 1 || bandmode > 8)) {
          DEBUG_PRINT("%d Bandmode is not supported for amrnb:supported Bandmodes are 1-8\n",bandmode);
          return 0;
    }

    if (amrwb_enable && (bandmode < 0 || bandmode > 8)) {
          DEBUG_PRINT("%d Bandmode not supported for amrwb:supported Bandmodes are 0-8\n",bandmode);
          return 0;
    }

    if (dtxenable != 0 && dtxenable != 1) {
          DEBUG_PRINT("dtxenable not supported:dtxenable should be 0-1\n");
          return 0;
    }

    if(recpath != 3) {
          DEBUG_PRINT("For RECORDPATH Only MIC supported\n");
          return 0;