对于声学回声消除目前比较流行的WEB_RTC开源库的应用日益增多,本人在这小试牛刀,希望日后能更深层次的进行学习。
以下分别是针对webrtc开源库的调用,包括create(),init(),config(),process(),close()
#include<stdio.h>
int webrtc_open(void **webrtc_handle,int SampleRate)
{
AecmConfig config;
config.cngMode = AecmTrue;
config.echoMode = 0;
if(WebRtcAecm_Create(webrtc_handle) < 0)
{
perror("WebRtcAecm_Create error!");
return -1;
}
if(WebRtcAecm_Init(*webrtc_handle, SampleRate) < 0) //8000 or 16000 Sample rate
{
perror("WebRtcAecm_Init error!");
return -1;
}
if(WebRtcAecm_set_config(*webrtc_handle, config) < 0 )
{
perror("WebRtcAecm_set_config error!");
return -1;
}
return 0;
}
int webrtc_close(void **webrtc_handle)
{
return WebRtcAecm_Free(*webrtc_handle);//释放资源
}
/*
* Inserts an 80 or 160 sample block of data into the farend buffer.
* Inputs Description
* -------------------------------