Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove malloc_buf references from playback.c since it's no longer used for anything and align the codec slack space buffer that is now use as the malloc buffer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29533 a1c6a512-1295-4272-9138-f99709370657

+16 -18
+8 -3
apps/codec_thread.c
··· 193 193 194 194 static void* codec_get_buffer(size_t *size) 195 195 { 196 - if (codec_size >= CODEC_SIZE) 196 + ssize_t s = CODEC_SIZE - codec_size; 197 + void *buf = &codecbuf[codec_size]; 198 + ALIGN_BUFFER(buf, s, CACHEALIGN_SIZE); 199 + 200 + if (s <= 0) 197 201 return NULL; 198 - *size = CODEC_SIZE - codec_size; 199 - return &codecbuf[codec_size]; 202 + 203 + *size = s; 204 + return buf; 200 205 } 201 206 202 207 static void codec_pcmbuf_insert_callback(
+8 -15
apps/playback.c
··· 116 116 117 117 /* Ring buffer where compressed audio and codecs are loaded */ 118 118 static unsigned char *filebuf = NULL; /* Start of buffer (A/C-) */ 119 - static unsigned char *malloc_buf = NULL; /* Start of malloc buffer (A/C-) */ 120 119 static size_t filebuflen = 0; /* Size of buffer (A/C-) */ 121 120 /* FIXME: make buf_ridx (C/A-) */ 122 121 ··· 2014 2013 as it will likely be affected and need sliding over */ 2015 2014 2016 2015 /* Initially set up file buffer as all space available */ 2017 - malloc_buf = audiobuf + talk_get_bufsize(); 2016 + filebuf = audiobuf + talk_get_bufsize(); 2017 + filebuflen = audiobufend - filebuf; 2018 2018 2019 - /* Align the malloc buf to line size. 2020 - * Especially important to cf targets that do line reads/writes. 2021 - * Also for targets which need aligned DMA storage buffers */ 2022 - malloc_buf = (unsigned char *)(((uintptr_t)malloc_buf + (CACHEALIGN_SIZE - 1)) & ~(CACHEALIGN_SIZE - 1)); 2023 - filebuf = malloc_buf; /* filebuf line align implied */ 2024 - filebuflen = (audiobufend - filebuf) & ~(CACHEALIGN_SIZE - 1); 2019 + ALIGN_BUFFER(filebuf, filebuflen, sizeof (intptr_t)); 2025 2020 2026 2021 /* Subtract whatever the pcm buffer says it used plus the guard buffer */ 2027 - const size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) +GUARD_BUFSIZE; 2022 + size_t pcmbuf_size = pcmbuf_init(filebuf + filebuflen) + GUARD_BUFSIZE; 2023 + 2024 + /* Make sure filebuflen is a pointer sized multiple after adjustment */ 2025 + pcmbuf_size = ALIGN_UP(pcmbuf_size, sizeof (intptr_t)); 2026 + 2028 2027 if(pcmbuf_size > filebuflen) 2029 2028 panicf("%s(): EOM (%zu > %zu)", __func__, pcmbuf_size, filebuflen); 2030 2029 2031 2030 filebuflen -= pcmbuf_size; 2032 - 2033 - /* Make sure filebuflen is a longword multiple after adjustment - filebuf 2034 - will already be line aligned */ 2035 - filebuflen &= ~3; 2036 - 2037 2031 buffering_reset(filebuf, filebuflen); 2038 2032 2039 2033 /* Clear any references to the file buffer */ ··· 2046 2040 { 2047 2041 size_t pcmbufsize; 2048 2042 const unsigned char *pcmbuf = pcmbuf_get_meminfo(&pcmbufsize); 2049 - logf("mabuf: %08X", (unsigned)malloc_buf); 2050 2043 logf("fbuf: %08X", (unsigned)filebuf); 2051 2044 logf("fbufe: %08X", (unsigned)(filebuf + filebuflen)); 2052 2045 logf("gbuf: %08X", (unsigned)(filebuf + filebuflen));