author Randell Jesup <>
Fri, 25 Oct 2013 18:21:23 -0400
changeset 167076 0288124b22dd527171b4b13415511bcf4bcae677
parent 151123 6063eaf3633fec74f5289571c7dd2ef36ab07074
child 169618 7aca035355aefd9694132f0c913227016358ded1
permissions -rw-r--r--
Bug 930603: Increase WebRTC AEC tail from 48ms to 128ms (rev 4837 at r=jib

 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.


#include "webrtc/modules/audio_processing/aec/aec_core.h"
#include "webrtc/modules/audio_processing/utility/ring_buffer.h"

typedef struct {
  int delayCtr;
  int sampFreq;
  int splitSampFreq;
  int scSampFreq;
  float sampFactor;  // scSampRate / sampFreq
  short skewMode;
  int bufSizeStart;
  int knownDelay;
  int rate_factor;

  short initFlag;  // indicates if AEC has been initialized

  // Variables used for averaging far end buffer size
  short counter;
  int sum;
  short firstVal;
  short checkBufSizeCtr;

  // Variables used for delay shifts
  short msInSndCardBuf;
  short filtDelay;  // Filtered delay estimate.
  int timeForDelayChange;
  int startup_phase;
  int checkBuffSize;
  short lastDelayDiff;

  RingBuffer* far_pre_buf_s16;  // Time domain far-end pre-buffer in int16_t.
  FILE* bufFile;
  FILE* delayFile;
  FILE* skewFile;

  // Structures
  void* resampler;

  int skewFrCtr;
  int resample;  // if the skew is small enough we don't resample
  int highSkewCtr;
  float skew;

  RingBuffer* far_pre_buf;  // Time domain far-end pre-buffer.

  int lastError;

  int farend_started;

  AecCore* aec;
} aecpc_t;