Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_coding/neteq/mcu_reset.c @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 3.4 KB
Line 
1/*
2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11/*
12 * Reset MCU side data.
13 */
14
15#include "mcu.h"
16
17#include <assert.h>
18#include <string.h>
19
20#include "automode.h"
21
22int WebRtcNetEQ_McuReset(MCUInst_t *inst)
23{
24
25#ifdef NETEQ_ATEVENT_DECODE
26    int ok;
27#endif
28
29    /* MCU/DSP Communication layer */
30    inst->pw16_readAddress = NULL;
31    inst->pw16_writeAddress = NULL;
32    inst->main_inst = NULL;
33    inst->one_desc = 0;
34    inst->BufferStat_inst.Automode_inst.extraDelayMs = 0;
35    inst->BufferStat_inst.Automode_inst.minimum_delay_ms = 0;
36    inst->BufferStat_inst.Automode_inst.maximum_delay_ms = 10000;
37    inst->NetEqPlayoutMode = kPlayoutOn;
38    inst->av_sync = 0;
39
40    WebRtcNetEQ_DbReset(&inst->codec_DB_inst);
41    memset(&inst->PayloadSplit_inst, 0, sizeof(SplitInfo_t));
42
43    /* Clear the Packet buffer and the pointer to memory storage */
44    WebRtcNetEQ_PacketBufferFlush(&inst->PacketBuffer_inst);
45    inst->PacketBuffer_inst.memorySizeW16 = 0;
46    inst->PacketBuffer_inst.maxInsertPositions = 0;
47
48    /* Clear the decision and delay history */
49    memset(&inst->BufferStat_inst, 0, sizeof(BufstatsInst_t));
50#ifdef NETEQ_ATEVENT_DECODE
51    ok = WebRtcNetEQ_DtmfDecoderInit(&inst->DTMF_inst, 8000, 560);
52    if (ok != 0)
53    {
54        return ok;
55    }
56#endif
57    inst->NoOfExpandCalls = 0;
58    inst->current_Codec = -1;
59    inst->current_Payload = -1;
60
61    inst->millisecondsPerCall = 10;
62    inst->timestampsPerCall = inst->millisecondsPerCall * 8;
63    inst->fs = 8000;
64    inst->first_packet = 1;
65
66    WebRtcNetEQ_ResetMcuInCallStats(inst);
67
68    WebRtcNetEQ_ResetWaitingTimeStats(inst);
69
70    WebRtcNetEQ_ResetMcuJitterStat(inst);
71
72    WebRtcNetEQ_ResetAutomode(&(inst->BufferStat_inst.Automode_inst),
73        inst->PacketBuffer_inst.maxInsertPositions);
74
75    return 0;
76}
77
78/*
79 * Reset MCU-side statistics variables for the in-call statistics.
80 */
81
82int WebRtcNetEQ_ResetMcuInCallStats(MCUInst_t *inst)
83{
84    inst->lostTS = 0;
85    inst->lastReportTS = 0;
86    inst->PacketBuffer_inst.discardedPackets = 0;
87
88    return 0;
89}
90
91/*
92 * Reset waiting-time statistics.
93 */
94
95void WebRtcNetEQ_ResetWaitingTimeStats(MCUInst_t *inst) {
96  memset(inst->waiting_times, 0,
97         kLenWaitingTimes * sizeof(inst->waiting_times[0]));
98  inst->len_waiting_times = 0;
99  inst->next_waiting_time_index = 0;
100}
101
102/*
103 * Store waiting-time in the statistics.
104 */
105
106void WebRtcNetEQ_StoreWaitingTime(MCUInst_t *inst, int waiting_time) {
107  assert(inst->next_waiting_time_index < kLenWaitingTimes);
108  inst->waiting_times[inst->next_waiting_time_index] = waiting_time;
109  inst->next_waiting_time_index++;
110  if (inst->next_waiting_time_index >= kLenWaitingTimes) {
111    inst->next_waiting_time_index = 0;
112  }
113  if (inst->len_waiting_times < kLenWaitingTimes) {
114    inst->len_waiting_times++;
115  }
116}
117
118/*
119 * Reset all MCU-side statistics variables for the post-call statistics.
120 */
121
122int WebRtcNetEQ_ResetMcuJitterStat(MCUInst_t *inst)
123{
124    inst->BufferStat_inst.Automode_inst.countIAT500ms = 0;
125    inst->BufferStat_inst.Automode_inst.countIAT1000ms = 0;
126    inst->BufferStat_inst.Automode_inst.countIAT2000ms = 0;
127    inst->BufferStat_inst.Automode_inst.longestIATms = 0;
128
129    return 0;
130}
131
Note: See TracBrowser for help on using the repository browser.