在webRTC aecm上从0x2af41bc0读取内存失败(读取4个字节中的0个)

时间:2018-06-06 03:48:18

标签: java android c++ native

我试图将WebRTC aecm整合到我的VoiP应用程序中。我在多部手机上测试了它,它在三星S7(API24)和Xperia XZ(API25)上崩溃了。它适用于API小于24的手机。

当我调用aecm实例设置采样频率时,应用程序崩溃。我追查了它,它给了我这个错误:

  

从0x2af41bc0读取内存失败(读取4个字节中的0个)

我不确定为什么它会在较新的手机上出现读取错误,但这是崩溃的部分。

int32_t WebRtcAecm_Init(void *aecmInst, int32_t sampFreq)
{
aecmob_t *aecm = aecmInst;
AecmConfig aecConfig;

if (aecm == NULL)
{
    return -1;
}

if (sampFreq != 8000 && sampFreq != 16000)
{
    aecm->lastError = AECM_BAD_PARAMETER_ERROR;
    return -1;
}
aecm->sampFreq = sampFreq;
// Initialize AECM core
if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1)
{
    aecm->lastError = AECM_UNSPECIFIED_ERROR;
    return -1;
}

// Initialize farend buffer
if (WebRtc_InitBuffer(aecm->farendBuf) == -1)
{
    aecm->lastError = AECM_UNSPECIFIED_ERROR;
    return -1;
}
aecm->initFlag = kInitCheck; // indicates that initialization has been done

aecm->delayChange = 1;

aecm->sum = 0;
aecm->counter = 0;
aecm->checkBuffSize = 1;
aecm->firstVal = 0;
aecm->ECstartup = 1;
aecm->bufSizeStart = 0;
aecm->checkBufSizeCtr = 0;
aecm->filtDelay = 0;
aecm->timeForDelayChange = 0;
aecm->knownDelay = 0;
aecm->lastDelayDiff = 0;

memset(&aecm->farendOld[0][0], 0, 160);

// Default settings.
aecConfig.cngMode = AecmTrue;
aecConfig.echoMode = 3;

if (WebRtcAecm_set_config(aecm, aecConfig) == -1)
{
    aecm->lastError = AECM_UNSPECIFIED_ERROR;
    return -1;
}
return 0;
}

0 个答案:

没有答案