MP3 decoder crash
Posted: Wed Sep 14, 2022 1:49 am
Hi,
I have a project playing mp3 files from sd card. The pipeline is fatfs_stream -> mp3_decoder -> i2s_writer. In between each play, I'm playing a wav file from flash memory: wav_decoder -> i2s_writer. I'm keeping the pipeline and elements allocated and just breaking up and relinking between each audio play.
The error seems to indicate memory exhaustion. I added some heap logging at the before the start and after the end of each pipeline run with this code:
Here is the output (with other log messages removed)...
As you can see there is a memory leak somewhere but there is still plenty of ram when the crash occurs. Unfortunately the pvmp3_framedecoder.cpp is included only as a library so there is no opportunity for me to examine the code and see what might be going on (unless I decompile it).
Can someone from Espressif ADF team please take a look at this and see if you can shed some light on this error?
Thanks,
Felix
I have a project playing mp3 files from sd card. The pipeline is fatfs_stream -> mp3_decoder -> i2s_writer. In between each play, I'm playing a wav file from flash memory: wav_decoder -> i2s_writer. I'm keeping the pipeline and elements allocated and just breaking up and relinking between each audio play.
The error seems to indicate memory exhaustion. I added some heap logging at the before the start and after the end of each pipeline run with this code:
Code: Select all
ESP_LOGW(TAG, "HEAP Available:%d, Largest:%d, Min:%d", xPortGetFreeHeapSize(), heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), xPortGetMinimumEverFreeHeapSize());
Code: Select all
W (80412) MUSIC: HEAP Available:103844, Largest:71664, Min:8832
W (80412) MUSIC: HEAP Available:103848, Largest:71664, Min:8832
W (82012) MUSIC: HEAP Available:103848, Largest:71664, Min:8832
W (82012) MUSIC: HEAP Available:103856, Largest:71664, Min:8832
W (84022) MUSIC: HEAP Available:105656, Largest:71664, Min:8832
W (84022) MUSIC: HEAP Available:105660, Largest:71664, Min:8832
W (86452) MUSIC: HEAP Available:103856, Largest:69616, Min:8832
W (86452) MUSIC: HEAP Available:103856, Largest:69616, Min:8832
W (86452) MUSIC: HEAP Available:103856, Largest:69616, Min:8832
W (86452) MUSIC: HEAP Available:103856, Largest:69616, Min:8832
W (94862) MUSIC: HEAP Available:95252, Largest:69616, Min:8832
W (94862) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (97492) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (97492) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (98902) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (98902) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (100102) MUSIC: HEAP Available:95248, Largest:69616, Min:8832
W (100102) MUSIC: HEAP Available:95220, Largest:69616, Min:8832
W (101682) MUSIC: HEAP Available:86612, Largest:61424, Min:8832
W (101682) MUSIC: HEAP Available:86620, Largest:61424, Min:8832
W (104872) MUSIC: HEAP Available:86620, Largest:61424, Min:8832
W (104882) MUSIC: HEAP Available:86628, Largest:61424, Min:8832
W (106872) MUSIC: HEAP Available:86628, Largest:61424, Min:8832
W (106882) MUSIC: HEAP Available:86628, Largest:61424, Min:8832
W (108872) MUSIC: HEAP Available:86628, Largest:61424, Min:8832
W (108872) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (110792) MUSIC: HEAP Available:88440, Largest:61424, Min:8832
W (110802) MUSIC: HEAP Available:88440, Largest:61424, Min:8832
W (112402) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (112412) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (113992) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (113992) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (115552) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (115552) MUSIC: HEAP Available:86640, Largest:61424, Min:8832
W (116742) MUSIC: HEAP Available:78048, Largest:53232, Min:8832
W (116742) MUSIC: HEAP Available:78048, Largest:53232, Min:8832
W (118342) MUSIC: HEAP Available:78048, Largest:53232, Min:8832
W (118342) MUSIC: HEAP Available:78020, Largest:53232, Min:8832
W (119692) MUSIC: HEAP Available:78020, Largest:53232, Min:8832
W (119692) MUSIC: HEAP Available:78028, Largest:53232, Min:8832
W (121042) MUSIC: HEAP Available:78028, Largest:53232, Min:8832
W (121042) MUSIC: HEAP Available:78032, Largest:53232, Min:8832
W (122312) MUSIC: HEAP Available:78032, Largest:53232, Min:8832
W (122322) MUSIC: HEAP Available:78032, Largest:53232, Min:8832
W (123712) MUSIC: HEAP Available:78032, Largest:53232, Min:8832
W (123712) MUSIC: HEAP Available:78048, Largest:53232, Min:8832
etc etc...
until the last logging before the crash
W (138242) MUSIC: HEAP Available:78032, Largest:53232, Min:8832
W (138252) MUSIC: HEAP Available:78048, Largest:53232, Min:8832
I (138262) MP3_DECODER: MP3 opened
W (138262) MUSICLOG: Logged play 5,2022-09-14T01:19:02,1
W (138322) MUSIC: Got STATUS report from i2s_status 122s_status
W (138322) MUSIC: Other state reported by main i2s stream writer: 3
W (138362) MUSIC: message from fatfs reader 8
E (138392) MP3_DE_LIB: /builds/adf/esp-adf-libs-source/esp_codec/esp-mp3/src/pvmp3_framedecoder.cpp:700 (pvmp3_InitDecoder): Memory exhausted
W (138Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Can someone from Espressif ADF team please take a look at this and see if you can shed some light on this error?
Thanks,
Felix
Code: Select all
E (138392) MP3_DE_LIB: /builds/adf/esp-adf-libs-source/esp_codec/esp-mp3/src/pvmp3_framedecoder.cpp:700 (pvmp3_InitDecoder): Memory exhausted
W (138Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4000c350 PS : 0x00060e30 A0 : 0x800e57c8 A1 : 0x3fff6ec0
A2 : 0x00000000 A3 : 0x3fff8138 A4 : 0x0000025d A5 : 0x00000000
A6 : 0x694a3291 A7 : 0xb1b25769 A8 : 0xfe632660 A9 : 0x3fff6e80
A10 : 0x00000004 A11 : 0x00000001 A12 : 0x00b00000 A13 : 0x3fff6f60
A14 : 0x00000000 A15 : 0x00000001 SAR : 0x00000008 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000024
Backtrace:0x4000c34d:0x3fff6ec00x400e57c5:0x3fff6ed0 0x400e59d6:0x3fff6f00 0x400e2b0e:0x3fff6fa0 0x400e2cf5:0x3fff7040 0x400e0b2f:0x3fff7060
0x400e57c5: fillMainDataBuf at /builds/adf/esp-adf-libs-source/esp_codec/esp-mp3/src/pvmp3_framedecoder.cpp:607
0x400e59d6: pvmp3_framedecoder at /builds/adf/esp-adf-libs-source/esp_codec/esp-mp3/src/pvmp3_framedecoder.cpp:295
0x400e2b0e: mp3_decoder_process at /builds/adf/esp-adf-libs-source/esp_processing/esp-wrapper/mp3_decoder.c:446
0x400e2cf5: _mp3_decoder_process at /builds/adf/esp-adf-libs-source/esp_processing/esp-wrapper/mp3_decoder.c:538
0x400e0b2f: audio_element_process_running at C:/SysGCC/esp32/esp-adf/v2.4/components/audio_pipeline/audio_element.c:336
(inlined by) audio_element_task at C:/SysGCC/esp32/esp-adf/v2.4/components/audio_pipeline/audio_element.c:483