-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate
- Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
- Tested with the latest version to ensure the issue hasn't been fixed
How often does this bug occurs?
always
Expected behavior
opus encode
Actual behavior (suspected bug)
opus enc process always trigger error
Error logs or terminal output
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4037d41f PS : 0x00050031 A0 : 0x40377d00 A1 : 0x3fc9ac00
--- 0x4037d41f: systimer_ll_clear_alarm_int at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/hal/esp32s3/include/hal/systimer_ll.h:190
(inlined by) SysTickIsrHandler at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/freertos/port_systick.c:136
0x40377d00: _xt_lowint1 at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/xtensa/xtensa_vectors.S:1240
A2 : 0x3fc9b17c A3 : 0x00000000 A4 : 0xfffffffc A5 : 0x4037cfd2
--- 0x4037cfd2: _frxt_int_enter at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:140
A6 : 0x00000000 A7 : 0x00000011 A8 : 0x00000000 A9 : 0x00001224
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x3fcaf34c
A14 : 0x00000003 A15 : 0x00000004 SAR : 0x0000001d EXCCAUSE: 0x0000001c
EXCVADDR: 0x00001290 LBEG : 0x4205d4f8 LEND : 0x4205d538 LCOUNT : 0x00000000
--- 0x4205d4f8: compute_allocation at ??:?
0x4205d538: compute_allocation at ??:?
Backtrace: 0x4037d41c:0x3fc9ac00 0x40377cfd:0x3fc9acc0 0x40377cfd:0x3fc9ace0 0x4205d4ef:0x3fc9ada0 0x4205a612:0x3fc9afc0 0x420562ca:0x3fc9dc70 0x42056619:0x3fc9e100 0x42053ace:0x3fc9e140 0x4200afd5:0x3fc9e180 0x4200b03f:0x3fc9e1f0 0x4209139b:0x3fc9e220 0x4037cbb1:0x3fc9e250
--- 0x4037d41c: systimer_ll_clear_alarm_int at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/hal/esp32s3/include/hal/systimer_ll.h:190
(inlined by) SysTickIsrHandler at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/freertos/port_systick.c:136
0x40377cfd: _xt_lowint1 at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/xtensa/xtensa_vectors.S:1240
0x40377cfd: _xt_lowint1 at C:/Espressif/5.4/Espressif/frameworks/esp-idf-v5.4/components/xtensa/xtensa_vectors.S:1240
0x4205d4ef: compute_allocation at ??:?
0x4205a612: celt_encode_with_ec at ??:?
0x420562ca: opus_encode_native at ??:?
0x42056619: opus_encode at ??:?
0x42053ace: esp_opus_enc_process at ??:?Steps to reproduce the behavior
void opus_encode1()
{
esp_audio_enc_handle_t encoder = NULL;
esp_opus_enc_config_t opus_cfg = ESP_OPUS_ENC_CONFIG_DEFAULT();
opus_cfg.sample_rate = ESP_AUDIO_SAMPLE_RATE_16K;
opus_cfg.channel = ESP_AUDIO_MONO;
esp_audio_err_t ret = esp_opus_enc_open(&opus_cfg, sizeof(esp_opus_enc_config_t), &encoder);
if (ret != ESP_OK || encoder == NULL) {
printf("Opus encoder creation failed! Error: 0x%x\n", ret);
return;
}
int pcm_frame_size = 0, raw_frame_size = 0;
if (esp_opus_enc_get_frame_size(encoder, &pcm_frame_size, &raw_frame_size) != ESP_OK) {
printf("Failed to get frame size\n");
esp_opus_enc_close(encoder);
return;
}
printf("PCM frame size: %d bytes, Raw frame size: %d bytes\n", pcm_frame_size, raw_frame_size);
uint8_t *pcm_data = malloc(20 * pcm_frame_size);
uint8_t *raw_data = malloc(raw_frame_size);
if (!pcm_data || !raw_data) {
printf("Memory allocation failed!\n");
if (pcm_data) free(pcm_data);
if (raw_data) free(raw_data);
esp_opus_enc_close(encoder);
return;
}
size_t bytes_read = 0;
esp_err_t ret1 = i2s_channel_read(rx_chan, pcm_data, 20 * pcm_frame_size, &bytes_read, portMAX_DELAY);
printf("bytes_read: %d\n", bytes_read);
for (int i = 0; i < 20; i++) {
esp_audio_enc_in_frame_t in_frame = {
.buffer = pcm_data + i * pcm_frame_size,
.len = pcm_frame_size,
};
esp_audio_enc_out_frame_t out_frame = {
.buffer = raw_data,
.len = raw_frame_size,
};
esp_audio_err_t ret = esp_opus_enc_process(encoder, &in_frame, &out_frame);
if (ret != ESP_OK) {
printf("Encoding failed at frame %d! Error: 0x%x\n", i, ret);
break;
}
}
// 7. 清理资源
free(pcm_data);
free(raw_data);
esp_opus_enc_close(encoder);
}
Project release version
latest
System architecture
Intel/AMD 64-bit (modern PC, older Mac)
Operating system
Linux
Operating system version
N/A
Shell
ZSH
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels