summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-03-04 23:31:32 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2021-03-04 23:31:32 -0500
commit895ed92496408b538f2dc58a07d4e5ad56d24560 (patch)
tree86603a2ffac88e80cb37f4c3d2f0e270c9450260
parent03ae4e6019500c1fb9a292ae428e5c47b17bf18f (diff)
downloadrockbox-895ed92496408b538f2dc58a07d4e5ad56d24560.tar.gz
rockbox-895ed92496408b538f2dc58a07d4e5ad56d24560.tar.bz2
rockbox-895ed92496408b538f2dc58a07d4e5ad56d24560.zip
Talk.c, playlist.c fix bugs
fix bug in talk.c playlist.c only dump voice buffer if we are out of space Change-Id: I75705d755db4193a87e542d062dbdc96b153dbb6
-rw-r--r--apps/playlist.c3
-rw-r--r--apps/talk.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index af733f486c..6f26b6beda 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2122,7 +2122,8 @@ int playlist_resume(void)
* default buflib buffers can be moved around which must be avoided */
static struct buflib_callbacks dummy_ops;
/* use mp3 buffer for maximum load speed */
- talk_buffer_set_policy(TALK_BUFFER_LOOSE); /* back off voice buffer */
+ if (core_allocatable() < (1 << 10))
+ talk_buffer_set_policy(TALK_BUFFER_LOOSE); /* back off voice buffer */
handle = core_alloc_maximum("temp", &buflen, &dummy_ops);
if (handle < 0)
panicf("%s(): OOM", __func__);
diff --git a/apps/talk.c b/apps/talk.c
index 8a428d1ed8..551d9672bc 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -625,8 +625,10 @@ static bool load_voicefile_data(int fd)
metadata_alloc_size = max_clips * sizeof(struct clip_cache_metadata);
metadata_table_handle = buflib_alloc(&clip_ctx, metadata_alloc_size);
if (metadata_table_handle <= 0)
+ {
talk_status = TALK_STATUS_ERR_OOM;
return false;
+ }
memset(buflib_get_data(&clip_ctx, metadata_table_handle), 0, metadata_alloc_size);
load_initial_clips(fd);