From e1ea13ee75d545a4a945f5e24b652d8741a675cf Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sat, 8 Oct 2011 10:09:11 +0000 Subject: libtremor: hack to work around huge allocations for the comment packet in files with embedded album art. Should fix playback of such files on targets with large codec buffers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30728 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libtremor/framing.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'apps/codecs/libtremor/framing.c') diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c index d67708f87a..582084853a 100644 --- a/apps/codecs/libtremor/framing.c +++ b/apps/codecs/libtremor/framing.c @@ -236,7 +236,7 @@ int ogg_stream_destroy(ogg_stream_state *os){ /* Helpers for ogg_stream_encode; this keeps the structure and what's happening fairly clear */ -static int _os_body_expand(ogg_stream_state *os,int needed){ +int _os_body_expand(ogg_stream_state *os,int needed){ if(os->body_storage<=os->body_fill+needed){ void *ret; ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)* @@ -783,7 +783,7 @@ int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){ /* add the incoming page to the stream state; we decompose the page into packet segments here as well. */ -int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ +int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og, bool copy_body){ unsigned char *header=og->header; unsigned char *body=og->body; long bodysize=og->body_len; @@ -868,8 +868,10 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ } if(bodysize){ - if(_os_body_expand(os,bodysize)) return -1; - memcpy(os->body_data+os->body_fill,body,bodysize); + if(copy_body){ + if(_os_body_expand(os,bodysize)) return -1; + memcpy(os->body_data+os->body_fill,body,bodysize); + } os->body_fill+=bodysize; } -- cgit v1.2.3