not30 发表于 2021-6-15 15:28:55

QCC30XX模拟和I2S输出切换几次后死机!

void AudioOutputInitI2s(void)
{
    if (!AudioOutI2s)
    {
    audio_output_config_t* m_config = PanicUnlessMalloc(sizeof(audio_output_config_t));
   
    /* Populate the plugin config from the PSKey contents */
    PanicFalse(populateAudioOutputConfig(m_config));
   
    m_config->mapping.endpoint.type = audio_output_type_i2s;
    m_config->mapping.endpoint.type = audio_output_type_i2s;

    /* Initialise multi- channel plugin */   
    PanicFalse(AudioOutputInit_ex(m_config));
    AudioOutI2s = TRUE;
    }
}

bool AudioOutputInit_ex(const audio_output_config_t* const conf)
{
    if (conf == NULL)
    {
      /* Passed in pointer was NULL, return error. */
      PRINT(("AUDIO OUT: Failed to initialise - NULL config\n"));
      return FALSE;
    }

    /* Store pointer for later access. */
    config = conf;

    return TRUE;
}

大师帮忙解解惑啊!:'(

not30 发表于 2021-6-15 20:31:32

本帖最后由 not30 于 2021-6-15 21:19 编辑

切换8次死机:@

twspro 发表于 2021-6-17 09:02:18

那么容易复现,应该很容易解决。

522315697 发表于 2021-6-17 15:41:39

not30 发表于 2021-6-15 20:31
切换8次死机

这么固定吗?刚好8次?

not30 发表于 2021-6-18 02:26:05

audio_output_config_t*m_config = NULL; 加了个初始化,变成16次死机:@:'(

522315697 发表于 2021-6-19 11:22:26

切换时断开下音频试试?

not30 发表于 2021-6-19 11:30:11

每切换一次,PanicUnlessMalloc申请新的内存,但是老的内存没有释放掉,导致内存溢出

函数结尾用free释放的话,其它某段程序在再调用的话,又会返回空导致死机

页: [1]
查看完整版本: QCC30XX模拟和I2S输出切换几次后死机!