WebRtc_Word32 WebRtcAec_Free(void *aecInst) { aecpc_t *aecpc = aecInst; if (aecpc == NULL) { return -1; } WebRtc_FreeBuffer(aecpc->far_pre_buf); #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); fclose(aecpc->aec->farFile); fclose(aecpc->aec->nearFile); fclose(aecpc->aec->outFile); fclose(aecpc->aec->outLinearFile); fclose(aecpc->bufFile); fclose(aecpc->skewFile); fclose(aecpc->delayFile); #endif WebRtcAec_FreeAec(aecpc->aec); WebRtcAec_FreeResampler(aecpc->resampler); free(aecpc); return 0; }
int32_t WebRtcAec_Free(void* aecInst) { aecpc_t* aecpc = aecInst; if (aecpc == NULL) { return -1; } WebRtc_FreeBuffer(aecpc->far_pre_buf); #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); if (aecpc->bufFile) { // we don't let one be open and not the others fclose(aecpc->bufFile); fclose(aecpc->skewFile); fclose(aecpc->delayFile); } #endif WebRtcAec_FreeAec(aecpc->aec); WebRtcAec_FreeResampler(aecpc->resampler); free(aecpc); return 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; }
int32_t WebRtcAec_Free(void* aecInst) { Aec* aecpc = aecInst; if (aecpc == NULL) { return -1; } WebRtc_FreeBuffer(aecpc->far_pre_buf); #ifdef WEBRTC_AEC_DEBUG_DUMP fclose(aecpc->bufFile); fclose(aecpc->skewFile); fclose(aecpc->delayFile); #endif WebRtcAec_FreeAec(aecpc->aec); WebRtcAec_FreeResampler(aecpc->resampler); free(aecpc); return 0; }
int WebRtcAec_CreateAec(aec_t **aecInst) { aec_t *aec = malloc(sizeof(aec_t)); *aecInst = aec; if (aec == NULL) { return -1; } if (WebRtc_CreateBuffer(&aec->nearFrBuf, FRAME_LEN + PART_LEN, sizeof(int16_t)) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } if (WebRtc_CreateBuffer(&aec->outFrBuf, FRAME_LEN + PART_LEN, sizeof(int16_t)) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } if (WebRtc_CreateBuffer(&aec->nearFrBufH, FRAME_LEN + PART_LEN, sizeof(int16_t)) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } if (WebRtc_CreateBuffer(&aec->outFrBufH, FRAME_LEN + PART_LEN, sizeof(int16_t)) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } // Create far-end buffers. if (WebRtc_CreateBuffer(&aec->far_buf, kBufSizePartitions, sizeof(float) * 2 * PART_LEN1) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } if (WebRtc_CreateBuffer(&aec->far_buf_windowed, kBufSizePartitions, sizeof(float) * 2 * PART_LEN1) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } #ifdef WEBRTC_AEC_DEBUG_DUMP if (WebRtc_CreateBuffer(&aec->far_time_buf, kBufSizePartitions, sizeof(int16_t) * PART_LEN) == -1) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } #endif aec->delay_estimator = WebRtc_CreateDelayEstimator(PART_LEN1, kMaxDelayBlocks, kLookaheadBlocks); if (aec->delay_estimator == NULL) { WebRtcAec_FreeAec(aec); aec = NULL; return -1; } return 0; }