summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-16 16:15:48 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-16 16:15:48 +1100
commitbb91724b941e6366711515a544b09385fbb6fc3d (patch)
tree3e22163db7fda806ba1903a9a5eaff8987f0b640 /lib
parent7523772886ca37cf05d0ad5b24f6d520e314242e (diff)
downloadtangara-fw-bb91724b941e6366711515a544b09385fbb6fc3d.tar.gz
Codec memory tweaks
- Ensure mad and ogg structs are allocated internally - Free old codec before making a new one
Diffstat (limited to 'lib')
-rw-r--r--lib/ogg/include/ogg/os_types.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ogg/include/ogg/os_types.h b/lib/ogg/include/ogg/os_types.h
index e655a1d6..9d2da360 100644
--- a/lib/ogg/include/ogg/os_types.h
+++ b/lib/ogg/include/ogg/os_types.h
@@ -16,11 +16,16 @@
#ifndef _OS_TYPES_H
#define _OS_TYPES_H
+#include "esp_heap_caps.h"
+
+#define OGG_MALLOC_CAPS_1 (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
+#define OGG_MALLOC_CAPS_2 (MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)
+
/* make it easy on the folks that want to compile the libs with a
different malloc than stdlib */
-#define _ogg_malloc malloc
-#define _ogg_calloc calloc
-#define _ogg_realloc realloc
+#define _ogg_malloc(x) heap_caps_malloc_prefer(x, OGG_MALLOC_CAPS_1, OGG_MALLOC_CAPS_2)
+#define _ogg_calloc(x, y) heap_caps_calloc_prefer(x, y, OGG_MALLOC_CAPS_1, OGG_MALLOC_CAPS_2)
+#define _ogg_realloc(x, y) heap_caps_realloc_prefer(x, y, OGG_MALLOC_CAPS_1, OGG_MALLOC_CAPS_2)
#define _ogg_free free
#if defined(_WIN32)