diff options
-rw-r--r-- | apps/playback.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/playback.c b/apps/playback.c index 872bf6f3e9..2ea6e2f004 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -196,6 +196,7 @@ static volatile bool filling IDATA_ATTR = false; /* Is file buffer refilling? (A | |||
196 | 196 | ||
197 | /* Ring buffer where compressed audio and codecs are loaded */ | 197 | /* Ring buffer where compressed audio and codecs are loaded */ |
198 | static unsigned char *filebuf = NULL; /* Start of buffer (A/C-) */ | 198 | static unsigned char *filebuf = NULL; /* Start of buffer (A/C-) */ |
199 | static unsigned char *malloc_buf = NULL; /* Start of malloc buffer (A/C-) */ | ||
199 | /* FIXME: make filebuflen static */ | 200 | /* FIXME: make filebuflen static */ |
200 | size_t filebuflen = 0; /* Size of buffer (A/C-) */ | 201 | size_t filebuflen = 0; /* Size of buffer (A/C-) */ |
201 | /* FIXME: make buf_ridx (C/A-) */ | 202 | /* FIXME: make buf_ridx (C/A-) */ |
@@ -1041,6 +1042,8 @@ static bool voice_pcmbuf_insert_callback( | |||
1041 | 1042 | ||
1042 | static void* voice_get_memory_callback(size_t *size) | 1043 | static void* voice_get_memory_callback(size_t *size) |
1043 | { | 1044 | { |
1045 | /* Voice should have no use for this. If it did, we'd have to | ||
1046 | swap the malloc buffer as well. */ | ||
1044 | *size = 0; | 1047 | *size = 0; |
1045 | return NULL; | 1048 | return NULL; |
1046 | } | 1049 | } |
@@ -1321,7 +1324,7 @@ static bool codec_pcmbuf_insert_callback( | |||
1321 | static void* codec_get_memory_callback(size_t *size) | 1324 | static void* codec_get_memory_callback(size_t *size) |
1322 | { | 1325 | { |
1323 | *size = MALLOC_BUFSIZE; | 1326 | *size = MALLOC_BUFSIZE; |
1324 | return &audiobuf[talk_get_bufsize()]; | 1327 | return malloc_buf; |
1325 | } | 1328 | } |
1326 | 1329 | ||
1327 | static void codec_pcmbuf_position_callback(size_t size) ICODE_ATTR; | 1330 | static void codec_pcmbuf_position_callback(size_t size) ICODE_ATTR; |
@@ -3351,7 +3354,11 @@ static void audio_reset_buffer(size_t pcmbufsize) | |||
3351 | logf(" size:%08X", pcmbufsize); | 3354 | logf(" size:%08X", pcmbufsize); |
3352 | 3355 | ||
3353 | /* Initially set up file buffer as all space available */ | 3356 | /* Initially set up file buffer as all space available */ |
3354 | filebuf = audiobuf + MALLOC_BUFSIZE + talk_get_bufsize(); | 3357 | malloc_buf = audiobuf + talk_get_bufsize(); |
3358 | /* Align the malloc buf to line size. Especially important to cf | ||
3359 | targets that do line reads/writes. */ | ||
3360 | malloc_buf = (unsigned char *)(((uintptr_t)filebuf + 15) & ~15); | ||
3361 | filebuf = malloc_buf + MALLOC_BUFSIZE; | ||
3355 | filebuflen = audiobufend - filebuf; | 3362 | filebuflen = audiobufend - filebuf; |
3356 | 3363 | ||
3357 | /* Allow for codec(s) at end of audio buffer */ | 3364 | /* Allow for codec(s) at end of audio buffer */ |