summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-10-30 21:04:32 +0000
committerDave Chapman <dave@dchapman.com>2005-10-30 21:04:32 +0000
commit29c7da9e69b1d052049e8fba5e0dafaaf93df12a (patch)
tree550e96004e6f6121cbef14a1969cc9ed876dde11
parentc082bc42a20e8b325cfa0c680d940f5d4e95e2f5 (diff)
downloadrockbox-29c7da9e69b1d052049e8fba5e0dafaaf93df12a.tar.gz
rockbox-29c7da9e69b1d052049e8fba5e0dafaaf93df12a.tar.bz2
rockbox-29c7da9e69b1d052049e8fba5e0dafaaf93df12a.zip
Don't copy the data from the audio buffer - request_buffer() guarantees to always return up to GUARD_BUFSIZE bytes, even at the buffer wraparound point. This removes the need for the 32KB static input buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7691 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/alac.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/apps/codecs/alac.c b/apps/codecs/alac.c
index 916dd06262..c96d1f0405 100644
--- a/apps/codecs/alac.c
+++ b/apps/codecs/alac.c
@@ -27,9 +27,6 @@ extern char iramstart[];
extern char iramend[];
#endif
-#define destBufferSize (1024*16)
-
-char inputBuffer[1024*32]; /* Input buffer */
int32_t outputbuffer[ALAC_MAX_CHANNELS][ALAC_BLOCKSIZE] IBSS_ATTR;
struct codec_api* rb;
@@ -125,23 +122,7 @@ enum codec_status codec_start(struct codec_api* api)
buffer=ci->request_buffer((long*)&n,sample_byte_size);
if (n!=sample_byte_size) {
- /* The decode_frame function requires the whole frame, so if we
- can't get it contiguously from the buffer, then we need to
- copy it via a read - i.e. we are at the buffer wraparound
- point */
-
- /* Check we estimated the maximum buffer size correctly */
- if (sample_byte_size > sizeof(inputBuffer)) {
- LOGF("ALAC: Input buffer < %d bytes\n",sample_byte_size);
- return CODEC_ERROR;
- }
-
- n=ci->read_filebuf(inputBuffer,sample_byte_size);
- if (n!=sample_byte_size) {
- LOGF("ALAC: Error reading data\n");
return CODEC_ERROR;
- }
- buffer=inputBuffer;
}
/* Decode one block - returned samples will be host-endian */
@@ -149,9 +130,7 @@ enum codec_status codec_start(struct codec_api* api)
samplesdecoded=alac_decode_frame(&alac, buffer, outputbuffer, rb->yield);
/* Advance codec buffer - unless we did a read */
- if ((char*)buffer!=(char*)inputBuffer) {
- ci->advance_buffer(n);
- }
+ ci->advance_buffer(n);
/* Output the audio */
rb->yield();