From 60dea95cad710095477a2f5e35bd5692f79f76da Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 29 Jan 2014 07:08:42 +0100 Subject: talk/hwcodec: Do always free the clip buffer in shrink_callback(). This is necessary because when voice is active audio is disabled. But only audio was able to shrink it's buffer to let other memory allocs succeed. talk needs to be able to do this too when it owns the audio buffer exclusively. Change-Id: Idea8ab90da7169f977c0c766cccb42c4fe6d6e81 --- apps/talk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/talk.c b/apps/talk.c index 9e46218187..2dcaf91420 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -210,11 +210,20 @@ static int move_callback(int handle, void *current, void *new) static int clip_shrink_callback(int handle, unsigned hints, void *start, size_t old_size) { - (void)start;(void)old_size; + (void)start;(void)old_size;(void)hints; +#if (!defined(TALK_PARTIAL_LOAD) || (MEMORYSIZE > 2)) + /* on low-mem and when the voice buffer size is not limited (i.e. + * on 2MB HWCODEC) we effectively own the entire buffer because + * the voicefile takes up all RAM. This blocks other Rockbox parts + * from allocating, especially during bootup. Therefore always give + * up the buffer and reload when clips are played back. On high-mem + * or when the clip buffer is limited to a few 100K this provision is + * not necessary. */ if (LIKELY(!talk_handle_locked) && give_buffer_away && (hints & BUFLIB_SHRINK_POS_MASK) == BUFLIB_SHRINK_POS_MASK) +#endif { talk_handle = core_free(handle); return BUFLIB_CB_OK; -- cgit v1.2.3