summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/talk.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 2f15ebce49..0c3b769d82 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -354,14 +354,6 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize)
354 logf("Incompatible voice file"); 354 logf("Incompatible voice file");
355 goto load_err; 355 goto load_err;
356 } 356 }
357 p_thumbnail = voicebuf.buf + file_size;
358 p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */
359 size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail;
360#if CONFIG_CODEC == SWCODEC
361 size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE);
362#endif
363 if (size_for_thumbnail <= 0)
364 p_thumbnail = NULL;
365 } 357 }
366 else 358 else
367 goto load_err; 359 goto load_err;
@@ -403,11 +395,26 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize)
403 395
404#ifdef TALK_PARTIAL_LOAD 396#ifdef TALK_PARTIAL_LOAD
405 alloc_size += silence_len + QUEUE_SIZE; 397 alloc_size += silence_len + QUEUE_SIZE;
398#else
399 /* allocate for the entire file, TALK_PROGRESSIVE_LOAD doesn't
400 * load everything just yet */
401 alloc_size = file_size;
406#endif 402#endif
403
407 if (alloc_size > bufsize) 404 if (alloc_size > bufsize)
408 goto load_err; 405 goto load_err;
409 return; 406 return;
410 407
408 /* now move p_thumbnail behind the voice clip buffer */
409 p_thumbnail = voicebuf.buf + alloc_size;
410 p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */
411 size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail;
412#if CONFIG_CODEC == SWCODEC
413 size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE);
414#endif
415 if (size_for_thumbnail <= 0)
416 p_thumbnail = NULL;
417
411load_err: 418load_err:
412 p_voicefile = NULL; 419 p_voicefile = NULL;
413 has_voicefile = false; /* don't try again */ 420 has_voicefile = false; /* don't try again */