aboutsummaryrefslogtreecommitdiff
path: root/decoder/ixheaacd_api.c
diff options
context:
space:
mode:
authorRamesh Katuri <ramesh.katuri@ittiam.com>2018-11-29 15:51:30 +0530
committerRay Essick <essick@google.com>2019-01-02 14:08:58 -0800
commite988b01822fed279ea701d55f08e598c4bee6b3b (patch)
tree627526b434e807e875e8ebb8b491e648c13c52a5 /decoder/ixheaacd_api.c
parente6d51f6bf35baa655eb4f1c4ddbf2c2c970ad816 (diff)
downloadlibxaac-e988b01822fed279ea701d55f08e598c4bee6b3b.tar.gz
Bit buffer error handling using setjmp and longjmp
Bug: 112552816 Bug: 116774502 Bug: 117531281 Bug: 118145923 Bug: 120124041 Test: vendor Change-Id: Ib11c82a8cf728c8a0a841b5fc0452daa1a5b37be
Diffstat (limited to 'decoder/ixheaacd_api.c')
-rw-r--r--decoder/ixheaacd_api.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/decoder/ixheaacd_api.c b/decoder/ixheaacd_api.c
index a68167f..8f9a51d 100644
--- a/decoder/ixheaacd_api.c
+++ b/decoder/ixheaacd_api.c
@@ -1256,10 +1256,21 @@ IA_ERRORCODE ixheaacd_dec_init(
IA_ERRORCODE err_code = IA_NO_ERROR;
struct ia_aac_persistent_struct *aac_persistent_mem;
struct ia_sbr_pers_struct *sbr_persistent_mem;
+ WORD32 ret_val;
p_obj_exhaacplus_dec->p_state_aac =
p_obj_exhaacplus_dec->pp_mem_aac[IA_ENHAACPLUS_DEC_PERSIST_IDX];
+ if (p_obj_exhaacplus_dec->p_state_aac != NULL) {
+ ret_val = setjmp(p_obj_exhaacplus_dec->p_state_aac->xaac_jmp_buf);
+ if (ret_val != 0) {
+ p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
+ p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
+ p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes = 0;
+ return IA_NO_ERROR;
+ }
+ }
+
time_data = (WORD16 *)(p_obj_exhaacplus_dec
->pp_mem_aac[IA_ENHAACPLUS_DEC_OUTPUT_IDX]);
@@ -1492,6 +1503,8 @@ IA_ERRORCODE ixheaacd_dec_init(
&p_state_enhaacplus_dec->str_bit_buf, (UWORD8 *)in_buffer,
p_obj_exhaacplus_dec->p_mem_info_aac[IA_ENHAACPLUS_DEC_INPUT_IDX]
.ui_size);
+ p_state_enhaacplus_dec->pstr_bit_buf->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
p_state_enhaacplus_dec->ptr_bit_stream =
p_state_enhaacplus_dec->pstr_bit_buf;
@@ -1611,6 +1624,8 @@ IA_ERRORCODE ixheaacd_dec_init(
ixheaacd_create_init_bit_buf(it_bit_buff, in_buffer,
p_state_enhaacplus_dec->ui_in_bytes);
+ p_state_enhaacplus_dec->pstr_bit_buf->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
it_bit_buff->adts_header_present =
p_state_enhaacplus_dec->s_adts_hdr_present;
@@ -1803,6 +1818,10 @@ IA_ERRORCODE ixheaacd_dec_init(
1, frame_size_1 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
+ if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
+ p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
+ }
} else {
}
@@ -1862,6 +1881,10 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
}
+ if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
+ p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
+ }
}
if (sample_rate < sample_rate_1) sample_rate = sample_rate_1;
@@ -1995,6 +2018,10 @@ IA_ERRORCODE ixheaacd_dec_init(
frame_size_2 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
+ if (p_state_enhaacplus_dec->str_sbr_dec_info[i]) {
+ p_state_enhaacplus_dec->str_sbr_dec_info[i]->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
+ }
}
i++;
@@ -2128,9 +2155,20 @@ IA_ERRORCODE ixheaacd_dec_execute(
SIZE_T bytes_for_sync;
WORD32 audio_mux_length_bytes_last = 0;
+ WORD32 ret_val;
p_obj_exhaacplus_dec->aac_config.ui_sbr_mode = 0;
+ if (p_obj_exhaacplus_dec->p_state_aac != NULL) {
+ ret_val = setjmp(p_obj_exhaacplus_dec->p_state_aac->xaac_jmp_buf);
+ if (ret_val != 0) {
+ p_obj_exhaacplus_dec->p_state_aac->i_bytes_consumed =
+ p_obj_exhaacplus_dec->p_state_aac->ui_in_bytes;
+ p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes = 0;
+ return IA_NO_ERROR;
+ }
+ }
+
time_data = (WORD16 *)(p_obj_exhaacplus_dec
->pp_mem_aac[IA_ENHAACPLUS_DEC_OUTPUT_IDX]);
in_buffer = p_obj_exhaacplus_dec->pp_mem_aac[IA_ENHAACPLUS_DEC_INPUT_IDX];
@@ -2237,6 +2275,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
{
ixheaacd_create_init_bit_buf(it_bit_buff, in_buffer,
p_state_enhaacplus_dec->ui_in_bytes);
+ it_bit_buff->xaac_jmp_buf = &(p_state_enhaacplus_dec->xaac_jmp_buf);
it_bit_buff->adts_header_present =
p_state_enhaacplus_dec->s_adts_hdr_present;
@@ -2536,6 +2575,10 @@ IA_ERRORCODE ixheaacd_dec_execute(
ps_enable, 1, frame_size * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
+ if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
+ p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
+ &(p_state_enhaacplus_dec->xaac_jmp_buf);
+ }
}
{