Example #1
0
int WebRtcAec_CreateAecStatistical(statistical_aec_t **aecInst)
{
    statistical_aec_t *stats_aec = (statistical_aec_t *)malloc(sizeof(statistical_aec_t));
    *aecInst = stats_aec;
	printf("aec created\n");
    if (stats_aec == NULL) {
        return -1;
    }
	memset(stats_aec,0,sizeof(statistical_aec_t));

    if (WebRtcApm_CreateBuffer(&stats_aec->farFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAecStatistical(stats_aec);
        stats_aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&stats_aec->nearFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAecStatistical(stats_aec);
        stats_aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&stats_aec->outFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAecStatistical(stats_aec);
        stats_aec = NULL;
        return -1;
    }

    
    return 0;
}
Example #2
0
int WebRtcAec_CreateAec(aec_t **aecInst)
{
    aec_t *aec = malloc(sizeof(aec_t));
    *aecInst = aec;
    if (aec == NULL) {
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&aec->farFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAec(aec);
        aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&aec->nearFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAec(aec);
        aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&aec->outFrBuf, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAec(aec);
        aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&aec->nearFrBufH, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAec(aec);
        aec = NULL;
        return -1;
    }

    if (WebRtcApm_CreateBuffer(&aec->outFrBufH, FRAME_LEN + PART_LEN) == -1) {
        WebRtcAec_FreeAec(aec);
        aec = NULL;
        return -1;
    }

    return 0;
}