diff options
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/playback.c b/apps/playback.c index f41cca64a2..bfad1a280c 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -166,10 +166,8 @@ enum filling_state { | |||
166 | 166 | ||
167 | /* As defined in plugins/lib/xxx2wav.h */ | 167 | /* As defined in plugins/lib/xxx2wav.h */ |
168 | #if MEM > 1 | 168 | #if MEM > 1 |
169 | #define MALLOC_BUFSIZE (512*1024) | ||
170 | #define GUARD_BUFSIZE (32*1024) | 169 | #define GUARD_BUFSIZE (32*1024) |
171 | #else | 170 | #else |
172 | #define MALLOC_BUFSIZE (100*1024) | ||
173 | #define GUARD_BUFSIZE (8*1024) | 171 | #define GUARD_BUFSIZE (8*1024) |
174 | #endif | 172 | #endif |
175 | 173 | ||
@@ -924,10 +922,12 @@ static bool codec_pcmbuf_insert_callback( | |||
924 | return true; | 922 | return true; |
925 | } /* codec_pcmbuf_insert_callback */ | 923 | } /* codec_pcmbuf_insert_callback */ |
926 | 924 | ||
927 | static void* codec_get_memory_callback(size_t *size) | 925 | static void* codec_get_buffer(size_t *size) |
928 | { | 926 | { |
929 | *size = MALLOC_BUFSIZE; | 927 | if (codec_size >= CODEC_SIZE) |
930 | return malloc_buf; | 928 | return NULL; |
929 | *size = CODEC_SIZE - codec_size; | ||
930 | return &codecbuf[codec_size]; | ||
931 | } | 931 | } |
932 | 932 | ||
933 | /* Between the codec and PCM track change, we need to keep updating the | 933 | /* Between the codec and PCM track change, we need to keep updating the |
@@ -2297,7 +2297,7 @@ static void audio_finalise_track_change(void) | |||
2297 | 2297 | ||
2298 | /* | 2298 | /* |
2299 | * Layout audio buffer as follows - iram buffer depends on target: | 2299 | * Layout audio buffer as follows - iram buffer depends on target: |
2300 | * [|SWAP:iram][|TALK]|MALLOC|FILE|GUARD|PCM|[SWAP:dram[|iram]|] | 2300 | * [|SWAP:iram][|TALK]|FILE|GUARD|PCM|[SWAP:dram[|iram]|] |
2301 | */ | 2301 | */ |
2302 | static void audio_reset_buffer(void) | 2302 | static void audio_reset_buffer(void) |
2303 | { | 2303 | { |
@@ -2313,7 +2313,7 @@ static void audio_reset_buffer(void) | |||
2313 | /* Align the malloc buf to line size. Especially important to cf | 2313 | /* Align the malloc buf to line size. Especially important to cf |
2314 | targets that do line reads/writes. */ | 2314 | targets that do line reads/writes. */ |
2315 | malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + 15) & ~15); | 2315 | malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + 15) & ~15); |
2316 | filebuf = malloc_buf + MALLOC_BUFSIZE; /* filebuf line align implied */ | 2316 | filebuf = malloc_buf; /* filebuf line align implied */ |
2317 | filebuflen = audiobufend - filebuf; | 2317 | filebuflen = audiobufend - filebuf; |
2318 | 2318 | ||
2319 | filebuflen &= ~15; | 2319 | filebuflen &= ~15; |
@@ -2338,7 +2338,6 @@ static void audio_reset_buffer(void) | |||
2338 | size_t pcmbufsize; | 2338 | size_t pcmbufsize; |
2339 | const unsigned char *pcmbuf = pcmbuf_get_meminfo(&pcmbufsize); | 2339 | const unsigned char *pcmbuf = pcmbuf_get_meminfo(&pcmbufsize); |
2340 | logf("mabuf: %08X", (unsigned)malloc_buf); | 2340 | logf("mabuf: %08X", (unsigned)malloc_buf); |
2341 | logf("mabufe: %08X", (unsigned)(malloc_buf + MALLOC_BUFSIZE)); | ||
2342 | logf("fbuf: %08X", (unsigned)filebuf); | 2341 | logf("fbuf: %08X", (unsigned)filebuf); |
2343 | logf("fbufe: %08X", (unsigned)(filebuf + filebuflen)); | 2342 | logf("fbufe: %08X", (unsigned)(filebuf + filebuflen)); |
2344 | logf("gbuf: %08X", (unsigned)(filebuf + filebuflen)); | 2343 | logf("gbuf: %08X", (unsigned)(filebuf + filebuflen)); |
@@ -2513,7 +2512,7 @@ void audio_init(void) | |||
2513 | /* Initialize codec api. */ | 2512 | /* Initialize codec api. */ |
2514 | ci.read_filebuf = codec_filebuf_callback; | 2513 | ci.read_filebuf = codec_filebuf_callback; |
2515 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; | 2514 | ci.pcmbuf_insert = codec_pcmbuf_insert_callback; |
2516 | ci.get_codec_memory = codec_get_memory_callback; | 2515 | ci.codec_get_buffer = codec_get_buffer; |
2517 | ci.request_buffer = codec_request_buffer_callback; | 2516 | ci.request_buffer = codec_request_buffer_callback; |
2518 | ci.advance_buffer = codec_advance_buffer_callback; | 2517 | ci.advance_buffer = codec_advance_buffer_callback; |
2519 | ci.advance_buffer_loc = codec_advance_buffer_loc_callback; | 2518 | ci.advance_buffer_loc = codec_advance_buffer_loc_callback; |