Audio Codec导致panic

liugyer
Posts: 11
Joined: Mon Oct 18, 2021 3:23 am

Audio Codec导致panic

Postby liugyer » Wed Oct 27, 2021 1:41 pm

Hi guys

我在使用voip的例程时,一旦使用codec播放音频,就会出现panic。‘

我使用的硬件是ESP32-WROOM-32, 软件ESP-ADF和IDF版本分别是138ac2 和 722043f,
log如下:

I (42670) SIP: [1970-01-01/00:00:21]=======================>>
I (42680) VOIP_EXAMPLE: SIP_EVENT_AUDIO_SESSION_BEGIN
W (42680) I2S: I2S driver already installed
I (42690) LYRAT_MINI_V1_1: I2S0, MCLK output by GPIO0
I (42690) AUDIO_PIPELINE: link el->rb, el:0x3ffd9fe4, tag:raw, rb:0x3ffdae80
I (42700) AUDIO_PIPELINE: link el->rb, el:0x3ffda3c4, tag:sip_dec, rb:0x3ffdd188
I (42710) AUDIO_PIPELINE: link el->rb, el:0x3ffda754, tag:filter, rb:0x3ffddad0
I (42720) AUDIO_ELEMENT: [raw-0x3ffd9fe4] Element task created
I (42720) AUDIO_ELEMENT: [sip_dec-0x3ffda3c4] Element task created
I (42730) AUDIO_ELEMENT: [filter-0x3ffda754] Element task created
I (42740) AUDIO_ELEMENT: [i2s-0x3ffdab00] Element task created
I (42740) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:359, MEM Total:104416 Bytes

I (42750) AUDIO_ELEMENT: [sip_dec] AEL_MSG_CMD_RESUME,state:1
I (42760) AUDIO_ELEMENT: [filter] AEL_MSG_CMD_RESUME,state:1
I (42760) CODEC_ELEMENT_HELPER: The element is 0x3ffda3c4. The reserve data 2 is 0x0.
I (42770) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:1
I (42780) I2S_STREAM: AUDIO_STREAM_WRITER
I (42780) AUDIO_PIPELINE: Pipeline started
I (42790) VOIP_EXAMPLE: SIP player has been created
I (42800) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (42800) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (42810) I2S: APLL: Req RATE: 16000, real rate: 15999.986, BITS: 16, CLKM: 1, BCK_M: 8, MCLK: 4095996.500, SCLK: 511999.562500, diva: 1, divb: 0
I (42820) LYRAT_MINI_V1_1: I2S1, MCLK output by GPIO0
I (42830) ALGORITHM_STREAM: reset channel number of record signal : 2, sample rate of record signal: 16000
I (42840) AUDIO_PIPELINE: link el->rb, el:0x3ffed4bc, tag:i2s, rb:0x3ffe8614
I (42850) AUDIO_PIPELINE: link el->rb, el:0x3ffe6ac4, tag:algo, rb:0x3ffea75c
I (42850) AUDIO_PIPELINE: link el->rb, el:0x3ffe7a1c, tag:filter, rb:0x3ffeaa60
I (42860) AUDIO_PIPELINE: link el->rb, el:0x3ffe7d5c, tag:sip_enc, rb:0x3ffeaba4
I (42870) AUDIO_ELEMENT: [i2s-0x3ffed4bc] Element task created
I (42880) AUDIO_ELEMENT: [filter-0x3ffe7a1c] Element task created
I (42880) AUDIO_ELEMENT: [sip_enc-0x3ffe7d5c] Element task created
I (42890) AUDIO_ELEMENT: [raw-0x3ffe80a4] Element task created
I (42900) AUDIO_ELEMENT: [algo-0x3ffe6ac4] Element task created
I (42900) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:359, MEM Total:43204 Bytes

I (42910) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:1
I (42910) RSP_FILTER: sample rate of source data : 8000, channel of source data : 1, sample rate of destination data : 16000, channel of destination data : 2
I (42920) I2S_STREAM: AUDIO_STREAM_READER,Rate:16000,ch:2
I (42940) I2S: APLL: Req RATE: 16000, real rate: 15999.986, BITS: 16, CLKM: 1, BCK_M: 8, MCLK: 4095996.500, SCLK: 511999.562500, diva: 1, divb: 0
I (42920) AUDIO_ELEMENT: [filter] AEL_MSG_CMD_RESUME,state:1
I (42960) RSP_FILTER: sample rate of source data : 16000, channel of source data : 1, sample rate of destination data : 8000, channel of destination data : 1
I (42970) AUDIO_ELEMENT: [sip_enc] AEL_MSG_CMD_RESUME,state:1
I (42980) AUDIO_ELEMENT: [algo] AEL_MSG_CMD_RESUME,state:1
uru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4014b3ac PS : 0x00060030 A0 : 0x8014a0cd A1 : 0x3fff5220
0x4014b3ac: esp_aec3_init at /home/zhaoyang/esp/tmp1/esp_sr_lib/home/madcow/esp_sr_lib/components/esp_audio_processor/acoustic_echo_cancellation/esp_aec3.c:86 (discriminator 3)

A2 : 0x3f800000 A3 : 0x00000401 A4 : 0x00000401 A5 : 0x00000000
A6 : 0x3fff79dc A7 : 0xff000000 A8 : 0x00000401 A9 : 0x00000000
A10 : 0x00000401 A11 : 0x00000004 A12 : 0x00000000 A13 : 0x3ffae918
A14 : 0x7f800000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4014b3ac LEND : 0x4014b3b0 LCOUNT : 0x00000400
0x4014b3ac: esp_aec3_init at /home/zhaoyang/esp/tmp1/esp_sr_lib/home/madcow/esp_sr_lib/components/esp_audio_processor/acoustic_echo_cancellation/esp_aec3.c:86 (discriminator 3)

0x4014b3b0: esp_aec3_init at /home/zhaoyang/esp/tmp1/esp_sr_lib/home/madcow/esp_sr_lib/components/esp_audio_processor/acoustic_echo_cancellation/esp_aec3.c:87


ELF file SHA256: d9cad08bfce74056

Backtrace: 0x4014b3ac:0x3fff5220 0x4014a0ca:0x3fff5240 0x4010d823:0x3fff5260 0x4010691c:0x3fff5290 0x40106e4f:0x3fff52c0 0x40106f53:0x3fff52e0 0x40107d21:0x3fff5310 0x40107040:0x3fff5350
0x4014b3ac: esp_aec3_init at /home/zhaoyang/esp/tmp1/esp_sr_lib/home/madcow/esp_sr_lib/components/esp_audio_processor/acoustic_echo_cancellation/esp_aec3.c:86 (discriminator 3)

0x4014a0ca: aec_pro_create at /home/zhaoyang/esp/tmp1/esp_sr_lib/home/madcow/esp_sr_lib/components/esp_audio_processor/esp_aec.c:96

0x4010d823: _algo_open at D:/work/esp-libs/esp-adf/components/audio_stream/algorithm_stream.c:574

0x4010691c: audio_element_process_init at D:/work/esp-libs/esp-adf/components/audio_pipeline/audio_element.c:806

0x40106e4f: audio_element_on_cmd_resume at D:/work/esp-libs/esp-adf/components/audio_pipeline/audio_element.c:806

0x40106f53: audio_element_on_cmd at D:/work/esp-libs/esp-adf/components/audio_pipeline/audio_element.c:806

0x40107d21: audio_event_iface_waiting_cmd_msg at D:/work/esp-libs/esp-adf/components/audio_pipeline/audio_event_iface.c:247

0x40107040: audio_element_task at D:/work/esp-libs/esp-adf/components/audio_pipeline/audio_element.c:806

liugyer
Posts: 11
Joined: Mon Oct 18, 2021 3:23 am

Re: Audio Codec导致panic

Postby liugyer » Fri Oct 29, 2021 10:01 am

有人遇到过这个问题吗?
只要一跑到以下代码就会crash

Code: Select all

static esp_err_t recorder_pipeline_open()
{
    audio_element_handle_t i2s_stream_reader;
    audio_pipeline_cfg_t pipeline_cfg = DEFAULT_AUDIO_PIPELINE_CONFIG();
    recorder = audio_pipeline_init(&pipeline_cfg);
    AUDIO_NULL_CHECK(TAG, recorder, return ESP_FAIL);

    i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT();
    i2s_cfg.type = AUDIO_STREAM_READER;
    i2s_cfg.uninstall_drv = false;
#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD
    i2s_cfg.i2s_port = 1;
    i2s_cfg.task_core = 1;
#endif
    i2s_cfg.i2s_config.sample_rate = I2S_SAMPLE_RATE;
    i2s_stream_reader = i2s_stream_init(&i2s_cfg);

#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD
    algorithm_stream_cfg_t algo_config = ALGORITHM_STREAM_CFG_DEFAULT();
    algo_config.input_type = ALGORITHM_STREAM_INPUT_TYPE1;
    algo_config.task_core = 1;
    audio_element_handle_t element_algo = algo_stream_init(&algo_config);
#endif

    rsp_filter_cfg_t rsp_cfg = DEFAULT_RESAMPLE_FILTER_CONFIG();
    rsp_cfg.src_rate = I2S_SAMPLE_RATE;
#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD
    rsp_cfg.src_ch = 1;
#else
    rsp_cfg.src_ch = I2S_CHANNELS;
#endif
    rsp_cfg.dest_rate = CODEC_SAMPLE_RATE;
    rsp_cfg.dest_ch = CODEC_CHANNELS;
    rsp_cfg.complexity = 5;
    rsp_cfg.task_core = 1;
    audio_element_handle_t filter = rsp_filter_init(&rsp_cfg);

    g711_encoder_cfg_t g711_cfg = DEFAULT_G711_ENCODER_CONFIG();
    g711_cfg.task_core = 1;
    audio_element_handle_t sip_encoder = g711_encoder_init(&g711_cfg);

    raw_stream_cfg_t raw_cfg = RAW_STREAM_CFG_DEFAULT();
    raw_cfg.type = AUDIO_STREAM_READER;
    raw_read = raw_stream_init(&raw_cfg);
    audio_element_set_output_timeout(raw_read, portMAX_DELAY);

    audio_pipeline_register(recorder, i2s_stream_reader, "i2s");
    audio_pipeline_register(recorder, filter, "filter");
    audio_pipeline_register(recorder, sip_encoder, "sip_enc");
    audio_pipeline_register(recorder, raw_read, "raw");

#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD
    audio_pipeline_register(recorder, element_algo, "algo");
    algo_stream_set_record_rate(element_algo, I2S_CHANNELS, I2S_SAMPLE_RATE);
    const char *link_tag[5] = {"i2s", "algo", "filter", "sip_enc", "raw"};
    audio_pipeline_link(recorder, &link_tag[0], 5);
#else
    const char *link_tag[4] = {"i2s", "filter", "sip_enc", "raw"};
    audio_pipeline_link(recorder, &link_tag[0], 4);
#endif

    audio_pipeline_run(recorder);
    ESP_LOGI(TAG, " SIP recorder has been created");
    return ESP_OK;
}

ESP_HengYC
Posts: 184
Joined: Fri Dec 15, 2017 2:45 am

Re: Audio Codec导致panic

Postby ESP_HengYC » Tue Nov 02, 2021 6:54 am

你好,

这个问题是 DRAM 不足了, 导致 aec init 失败, 建议使用带 PSRAM 的模组来测试这个例程。

Who is online

Users browsing this forum: No registered users and 21 guests