path: root/apps/talk.c
diff options
authorThomas Martitz <>2014-01-29 07:08:42 +0100
committerThomas Martitz <>2014-02-02 19:40:39 +0100
commit60dea95cad710095477a2f5e35bd5692f79f76da (patch)
treeb5034acae9483c716e8e8ff1c737a85c6d5928d1 /apps/talk.c
parent428f069a1f1da9fe5461d2c2359f3da1bfb63e0a (diff)
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
Diffstat (limited to 'apps/talk.c')
1 files changed, 10 insertions, 1 deletions
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
talk_handle = core_free(handle);
return BUFLIB_CB_OK;