diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-09-24 03:14:49 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-09-24 10:47:34 -0400 |
commit | f0c208554c5ccf628965c0b4b1415ac04789876e (patch) | |
tree | e1a18f326ad518bb6fa8394c2132b6e74efbe10d /apps/pcmbuf.c | |
parent | c3f51b5fe9f947a25bfee145450fddec04404bd5 (diff) | |
download | rockbox-f0c208554c5ccf628965c0b4b1415ac04789876e.tar.gz rockbox-f0c208554c5ccf628965c0b4b1415ac04789876e.zip |
[BugFix] Playback.c OOM with large voice file
with our large voice file being loaded in its entirety to the buffer
there isn't enough room to allocate the required pcm buffer
well prior to this patch we looked for 1k free to allow the talk buffer
to be given away
well the pcm buffer expects something like 5-600 kb on the clipzip
and there is 1k allocatable but not 300 more
so instead get the required pcm buffer size and check against that
Change-Id: I40a056e4170c37bc3429f0cb37af221ae7f812e5
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r-- | apps/pcmbuf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 773e97cce0..b32cb4c429 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -580,6 +580,12 @@ static void init_buffer_state(void) | |||
580 | chunk_transidx = INVALID_BUF_INDEX; | 580 | chunk_transidx = INVALID_BUF_INDEX; |
581 | } | 581 | } |
582 | 582 | ||
583 | /* call prior to init to get bytes required */ | ||
584 | size_t pcmbuf_size_reqd(void) | ||
585 | { | ||
586 | return get_next_required_pcmbuf_chunks() * PCMBUF_CHUNK_SIZE; | ||
587 | } | ||
588 | |||
583 | /* Initialize the PCM buffer. The structure looks like this: | 589 | /* Initialize the PCM buffer. The structure looks like this: |
584 | * ...|---------PCMBUF---------|GUARDBUF|DESCS| */ | 590 | * ...|---------PCMBUF---------|GUARDBUF|DESCS| */ |
585 | size_t pcmbuf_init(void *bufend) | 591 | size_t pcmbuf_init(void *bufend) |