Skip to content

Commit 20d54e4

Browse files
committed
third_party/speex: adjust enc/dec buffer size
Fixes [FIRM-593] Signed-off-by: Joshua Jun <[email protected]>
1 parent 9b2d9b4 commit 20d54e4

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

third_party/speex/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#define OVERRIDE_SPEEX_ALLOC_SCRATCH
7979
#define OVERRIDE_SPEEX_REALLOC
8080
#define OVERRIDE_SPEEX_FREE
81+
#define OVERRIDE_SPEEX_FREE_SCRATCH
8182

8283
/* Override debug/warning functions */
8384
#define OVERRIDE_SPEEX_FATAL

third_party/speex/os_support_custom.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ extern void *kernel_zalloc_check(size_t size);
1010
extern void *kernel_realloc(void *ptr, size_t size);
1111
extern void kernel_free(void *ptr);
1212

13+
1314
/* Override memory allocation functions to use PebbleOS kernel functions */
14-
static inline void *speex_alloc(int size) { return kernel_zalloc_check(size); }
15-
static inline void *speex_alloc_scratch(int size) { return kernel_zalloc_check(size); }
16-
static inline void *speex_realloc(void *ptr, int size) { return kernel_realloc(ptr, size); }
15+
static inline void *speex_alloc(int size) { return kernel_zalloc_check((size_t)size); }
16+
static inline void *speex_alloc_scratch(int size) { return kernel_zalloc_check((size_t)size); }
17+
static inline void *speex_realloc(void *ptr, int size) { return kernel_realloc(ptr, (size_t)size); }
1718
static inline void speex_free(void *ptr) { kernel_free(ptr); }
19+
static inline void speex_free_scratch(void *ptr) { kernel_free(ptr); }
1820

1921
/* Override debug/warning functions to be no-ops for embedded system */
2022
static inline void _speex_fatal(const char *str, const char *file, int line) { (void)str; (void)file; (void)line; }

third_party/speex/wscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ def build(bld):
5252
'DISABLE_NOTIFICATIONS', # Disable notification functions
5353
]
5454

55+
# Define stack sizes for encoder and decoder
56+
speex_defines += [
57+
'NB_ENC_STACK=(2000*sizeof(spx_sig_t))', # ~8 KiB
58+
'NB_DEC_STACK=(1500*sizeof(spx_sig_t))', # ~6 KiB
59+
]
60+
5561
# Compiler flags to handle warnings
5662
speex_cflags = [
5763
'-Wno-implicit-function-declaration',

0 commit comments

Comments
 (0)