int WebRtcNetEQ_McuSetFs(MCUInst_t *inst, WebRtc_UWord16 fs) { WebRtc_Word16 ok = 0; switch (fs) { case 8000: { #ifdef NETEQ_ATEVENT_DECODE ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 8000, 560); #endif inst->timestampsPerCall = inst->millisecondsPerCall * 8; break; } #ifdef NETEQ_WIDEBAND case 16000: { #ifdef NETEQ_ATEVENT_DECODE ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 16000, 1120); #endif inst->timestampsPerCall = inst->millisecondsPerCall * 16; break; } #endif #ifdef NETEQ_32KHZ_WIDEBAND case 32000: { #ifdef NETEQ_ATEVENT_DECODE ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 32000, 2240); #endif inst->timestampsPerCall = inst->millisecondsPerCall * 32; break; } #endif #ifdef NETEQ_48KHZ_WIDEBAND case 48000: { #ifdef NETEQ_ATEVENT_DECODE ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 48000, 3360); #endif inst->timestampsPerCall = inst->millisecondsPerCall * 48; break; } #endif default: { /* Not supported yet */ return CODEC_DB_UNSUPPORTED_FS; } } /* end switch */ inst->fs = fs; return ok; }
int WebRtcNetEQ_McuReset(MCUInst_t *inst) { #ifdef NETEQ_ATEVENT_DECODE int ok; #endif /* MCU/DSP Communication layer */ inst->pw16_readAddress = NULL; inst->pw16_writeAddress = NULL; inst->main_inst = NULL; inst->one_desc = 0; inst->BufferStat_inst.Automode_inst.extraDelayMs = 0; inst->BufferStat_inst.Automode_inst.minimum_delay_ms = 0; inst->BufferStat_inst.Automode_inst.maximum_delay_ms = 10000; inst->NetEqPlayoutMode = kPlayoutOn; inst->av_sync = 0; WebRtcNetEQ_DbReset(&inst->codec_DB_inst); memset(&inst->PayloadSplit_inst, 0, sizeof(SplitInfo_t)); /* Clear the Packet buffer and the pointer to memory storage */ WebRtcNetEQ_PacketBufferFlush(&inst->PacketBuffer_inst); inst->PacketBuffer_inst.memorySizeW16 = 0; inst->PacketBuffer_inst.maxInsertPositions = 0; /* Clear the decision and delay history */ memset(&inst->BufferStat_inst, 0, sizeof(BufstatsInst_t)); #ifdef NETEQ_ATEVENT_DECODE ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 8000, 560); if (ok != 0) { return ok; } #endif inst->NoOfExpandCalls = 0; inst->current_Codec = -1; inst->current_Payload = -1; inst->millisecondsPerCall = 10; inst->timestampsPerCall = inst->millisecondsPerCall * 8; inst->fs = 8000; inst->first_packet = 1; WebRtcNetEQ_ResetMcuInCallStats(inst); WebRtcNetEQ_ResetWaitingTimeStats(inst); WebRtcNetEQ_ResetMcuJitterStat(inst); WebRtcNetEQ_ResetAutomode(&(inst->BufferStat_inst.Automode_inst), inst->PacketBuffer_inst.maxInsertPositions); return 0; }