summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-29 07:08:42 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-02 19:40:39 +0100
commit60dea95cad710095477a2f5e35bd5692f79f76da (patch)
treeb5034acae9483c716e8e8ff1c737a85c6d5928d1
parent428f069a1f1da9fe5461d2c2359f3da1bfb63e0a (diff)
downloadrockbox-60dea95cad710095477a2f5e35bd5692f79f76da.tar.gz
rockbox-60dea95cad710095477a2f5e35bd5692f79f76da.zip
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
-rw-r--r--apps/talk.c11
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)
210 210
211static int clip_shrink_callback(int handle, unsigned hints, void *start, size_t old_size) 211static int clip_shrink_callback(int handle, unsigned hints, void *start, size_t old_size)
212{ 212{
213 (void)start;(void)old_size; 213 (void)start;(void)old_size;(void)hints;
214 214
215#if (!defined(TALK_PARTIAL_LOAD) || (MEMORYSIZE > 2))
216 /* on low-mem and when the voice buffer size is not limited (i.e.
217 * on 2MB HWCODEC) we effectively own the entire buffer because
218 * the voicefile takes up all RAM. This blocks other Rockbox parts
219 * from allocating, especially during bootup. Therefore always give
220 * up the buffer and reload when clips are played back. On high-mem
221 * or when the clip buffer is limited to a few 100K this provision is
222 * not necessary. */
215 if (LIKELY(!talk_handle_locked) 223 if (LIKELY(!talk_handle_locked)
216 && give_buffer_away 224 && give_buffer_away
217 && (hints & BUFLIB_SHRINK_POS_MASK) == BUFLIB_SHRINK_POS_MASK) 225 && (hints & BUFLIB_SHRINK_POS_MASK) == BUFLIB_SHRINK_POS_MASK)
226#endif
218 { 227 {
219 talk_handle = core_free(handle); 228 talk_handle = core_free(handle);
220 return BUFLIB_CB_OK; 229 return BUFLIB_CB_OK;