From 369b6bd367d96e0c4a13c1f8c14830091737e84f Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Sat, 27 Jan 2007 16:33:44 +0000 Subject: Fix a potential voice related bug with first time buffer setup git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12125 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/playback.c b/apps/playback.c index c4f590c34f..ff681bb85c 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -3447,7 +3447,14 @@ static void audio_reset_buffer(size_t pcmbufsize) #ifdef IRAM_STEAL /* Allocate voice IRAM swap buffer once */ if (iram_buf[CODEC_IDX_VOICE] == NULL) + { iram_buf[CODEC_IDX_VOICE] = buffer_alloc(CODEC_IRAM_SIZE); + /* buffer_alloc moves audiobuf; this is safe because only the end + * has been touched so far in this function and the address of + * filebuf + filebuflen is not changed */ + filebuf += CODEC_IRAM_SIZE; + filebuflen -= CODEC_IRAM_SIZE; + } dram_buf[CODEC_IDX_VOICE] = dram_buf[CODEC_IDX_AUDIO] + CODEC_SIZE; #else iram_buf[CODEC_IDX_VOICE] = dram_buf[CODEC_IDX_AUDIO] + CODEC_SIZE; -- cgit v1.2.3