1
0
Fork 0
forked from len0rd/rockbox

Fix opus craches with large embedded album art

Use the tlsf malloc and friends instead of the silly
codec_malloc to get actually working free and saner
realloc that doesn't leak memory.
Makes files with moderately sized embedded AA play
on targets with large enough codec buffers and files
with too large AA are now skipped rather than crashing.
Fixes crash when playing example file in FS#12842.

Change-Id: I06562955c4d9a95bd90f55738214fba462092b71
This commit is contained in:
Nils Wallménius 2013-05-18 19:48:08 +02:00
parent fc0cf8d91b
commit c7124b5520
4 changed files with 42 additions and 44 deletions

View file

@ -329,10 +329,8 @@ enum codec_status codec_run(void)
int64_t seek_target;
uint64_t granule_pos;
/* reset our simple malloc */
if (codec_init()) {
goto done;
}
ogg_malloc_init();
global_stack = 0;
#if defined(CPU_COLDFIRE)
@ -344,10 +342,10 @@ enum codec_status codec_run(void)
/* pre-init the ogg_sync_state buffer, so it won't need many reallocs */
ogg_sync_init(&oy);
oy.storage = 64*1024;
oy.data = codec_malloc(oy.storage);
oy.data = _ogg_malloc(oy.storage);
/* allocate output buffer */
uint16_t *output = (uint16_t*) codec_malloc(MAX_FRAME_SIZE*sizeof(uint16_t));
uint16_t *output = (uint16_t*) _ogg_malloc(MAX_FRAME_SIZE*sizeof(uint16_t));
ci->seek_buffer(0);
ci->set_elapsed(0);
@ -465,6 +463,7 @@ enum codec_status codec_run(void)
LOGF("Returned OK");
error = CODEC_OK;
done:
ogg_malloc_destroy();
return error;
}