1
0
Fork 0
forked from len0rd/rockbox

Implement error handling for libfaad's memory allocation. Do not allocate PS related types dynamically anymore to minimize code changes.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29854 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-05-10 19:04:24 +00:00
parent 78b0f94c76
commit 03e23d1113
7 changed files with 66 additions and 35 deletions

View file

@ -1031,11 +1031,14 @@ static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength,
hDecoder->element_id[sbr_ele], sbr_ele,
2*get_sample_rate(hDecoder->sf_index),
hDecoder->downSampledSBR
#ifdef DRM
, 0
hDecoder->downSampledSBR, 0);
#ifndef FAAD_STATIC_ALLOC
if (hDecoder->sbr[sbr_ele] == NULL)
{
/* could not allocate memory */
return 28;
}
#endif
);
}
hDecoder->sbr_present_flag = 1;
@ -1249,10 +1252,24 @@ void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo
{
hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0],
2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
#ifndef FAAD_STATIC_ALLOC
if (hDecoder->sbr[0] == NULL)
{
/* could not allocate memory */
hInfo->error = 28;
return;
}
#endif
}
/* Reverse bit reading of SBR data in DRM audio frame */
revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t));
if (revbuffer == NULL)
{
/* could not allocate memory */
hInfo->error = 28;
return;
}
prevbufstart = revbuffer;
pbufend = &buffer[buffer_size - 1];
for (i = 0; i < buffer_size; i++)