libxaac-mirror/decoder/drc_src/impd_error_handler.h
Ray Essick 4908247643 Sanitization fixes from new CTS tests
Updates from vendor to remedy issues exposed by new CTS tests

Bug: 77287124
Test: CTS DecoderTest, DecoderTest{AacDrc,XheAac}

@ Sanitizer fixes in libxaac

Fixes few integer overflow sanitizer errors
Progagate few errors
ENABLE_DRC macro is removed
AMMENDMENT1 macro is removed

Change-Id: Ic61163dfd6318bd4a00ed45e1295c819cb0f637b

@ Add support for audio pre-roll and DRC effect type

Also includes the following
MPEG-D DRC parameters related changes
USAC config switch changes
SBR config switch changes

Bug: 80133175
Change-Id: I0ab25641768cf523b66f7b0fcb4137429c1c4a77

@ Fixed trailing spaces

Change-Id: I32de0c9d3f7237e1fbf8dfef1cac485ef8458173

@ Replaced tabs

Change-Id: Ic741ee13d7b978b37edc27d087903caaa40b8d90
2018-05-25 11:35:52 -07:00

94 lines
4.2 KiB
C

/******************************************************************************
*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#ifndef IMPD_ERROR_HANDLER_H
#define IMPD_ERROR_HANDLER_H
/*****************************************************************************/
/* File includes */
/*****************************************************************************/
/* these definitions are used by error handling function */
/* the error handler will work on a structure which identifies a */
/* particular error with a module, context and error_code */
/* within error_code, MSB identifies FATAL (1), NONFATAL (0) */
/* next 4 ms_bs identify a class of error */
/*****************************************************************************/
/* Constant hash defines */
/*****************************************************************************/
#define IA_ERROR_NON_FATAL_IDX 0x0
#define IA_ERROR_FATAL_IDX 0x1
#define IA_ERROR_CLASS_0 0x0
#define IA_ERROR_CLASS_1 0x1
#define IA_ERROR_CLASS_2 0x2
#define IA_ERROR_CLASS_3 0x3
#define IA_ERROR_CLASS_4 0x4
#define IA_ERROR_CLASS_5 0x5
#define IA_ERROR_CLASS_6 0x6
#define IA_ERROR_CLASS_7 0x7
#define IA_ERROR_CLASS_8 0x8
#define IA_ERROR_CLASS_9 0x9
#define IA_ERROR_CLASS_A 0xA
#define IA_ERROR_CLASS_B 0xB
#define IA_ERROR_CLASS_C 0xC
#define IA_ERROR_CLASS_D 0xD
#define IA_ERROR_CLASS_E 0xE
#define IA_ERROR_CLASS_F 0xF
/* each module, hence, needs to copy the following structure */
/* the first index is for FATAL/NONFATAL */
/* the second index is for the classes */
/* then in a module specific initialization, fill in the following */
/* structure with the pointers to the particular error message arrays */
/*****************************************************************************/
/* Type definitions */
/*****************************************************************************/
typedef struct
{
pWORD8 pb_module_name;
pWORD8 ppb_class_names[16];
WORD8 **ppppb_error_msg_pointers[2][16];
} ia_error_info_struct;
/*****************************************************************************/
/* Function prototypes */
/*****************************************************************************/
/* this error handler maps the code generated by a module to a error string */
/* pb_context is a string to specify where the module broke */
IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info,
WORD8 *pb_context, IA_ERRORCODE code);
/*****************************************************************************/
/* Macro functions */
/*****************************************************************************/
/* the following macro does a line job of returning back to the parent */
/* in case a fatal error occurs after calling the errorhandler */
#define _IA_HANDLE_ERROR(p_mod_err_info, context, e) \
if((e) != IA_NO_ERROR) \
{ \
ia_error_handler((p_mod_err_info), (context), (e)); \
if((e) & IA_FATAL_ERROR) \
return (e); \
}
#endif