Home | History | Annotate | Download | only in interface
      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 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_
     12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_
     13 
     14 #include <map>
     15 
     16 #include "webrtc/modules/interface/module_common_types.h"
     17 #include "webrtc/typedefs.h"
     18 
     19 namespace webrtc {
     20 
     21 ///////////////////////////////////////////////////////////////////////////
     22 // enum AudioPlayoutMode
     23 // An enumerator for different playout modes.
     24 //
     25 // -voice       : This is the standard mode for VoIP calls. The trade-off
     26 //                between low delay and jitter robustness is optimized
     27 //                for high-quality two-way communication.
     28 //                NetEQs packet loss concealment and signal processing
     29 //                capabilities are fully employed.
     30 // -fax         : The fax mode is optimized for decodability of fax signals
     31 //                rather than for perceived audio quality. When this mode
     32 //                is selected, NetEQ will do as few delay changes as possible,
     33 //                trying to maintain a high and constant delay. Meanwhile,
     34 //                the packet loss concealment efforts are reduced.
     35 //
     36 // -streaming   : In the case of one-way communication such as passive
     37 //                conference participant, a webinar, or a streaming application,
     38 //                this mode can be used to improve the jitter robustness at
     39 //                the cost of increased delay.
     40 // -off         : Turns off most of NetEQ's features. Stuffs zeros for lost
     41 //                packets and during buffer increases.
     42 //
     43 enum AudioPlayoutMode {
     44   voice = 0,
     45   fax = 1,
     46   streaming = 2,
     47   off = 3,
     48 };
     49 
     50 ///////////////////////////////////////////////////////////////////////////
     51 // enum ACMSpeechType
     52 // An enumerator for possible labels of a decoded frame.
     53 //
     54 // -normal      : a normal speech frame. If VAD is enabled on the
     55 //                incoming stream this label indicate that the
     56 //                frame is active.
     57 // -PLC         : a PLC frame. The corresponding packet was lost
     58 //                and this frame generated by PLC techniques.
     59 // -CNG         : the frame is comfort noise. This happens if VAD
     60 //                is enabled at the sender and we have received
     61 //                SID.
     62 // -PLCCNG      : PLC will fade to comfort noise if the duration
     63 //                of PLC is long. This labels such a case.
     64 // -VADPassive  : the VAD at the receiver recognizes this frame as
     65 //                passive.
     66 //
     67 enum ACMSpeechType {
     68   normal = 0,
     69   PLC = 1,
     70   CNG = 2,
     71   PLCCNG = 3,
     72   VADPassive = 4
     73 };
     74 
     75 ///////////////////////////////////////////////////////////////////////////
     76 // enum ACMVADMode
     77 // An enumerator for aggressiveness of VAD
     78 // -VADNormal                : least aggressive mode.
     79 // -VADLowBitrate            : more aggressive than "VADNormal" to save on
     80 //                             bit-rate.
     81 // -VADAggr                  : an aggressive mode.
     82 // -VADVeryAggr              : the most agressive mode.
     83 //
     84 enum ACMVADMode {
     85   VADNormal = 0,
     86   VADLowBitrate = 1,
     87   VADAggr = 2,
     88   VADVeryAggr = 3
     89 };
     90 
     91 ///////////////////////////////////////////////////////////////////////////
     92 // enum ACMCountries
     93 // An enumerator for countries, used when enabling CPT for a specific country.
     94 //
     95 enum ACMCountries {
     96   ACMDisableCountryDetection = -1, // disable CPT detection
     97   ACMUSA = 0,
     98   ACMJapan,
     99   ACMCanada,
    100   ACMFrance,
    101   ACMGermany,
    102   ACMAustria,
    103   ACMBelgium,
    104   ACMUK,
    105   ACMCzech,
    106   ACMDenmark,
    107   ACMFinland,
    108   ACMGreece,
    109   ACMHungary,
    110   ACMIceland,
    111   ACMIreland,
    112   ACMItaly,
    113   ACMLuxembourg,
    114   ACMMexico,
    115   ACMNorway,
    116   ACMPoland,
    117   ACMPortugal,
    118   ACMSpain,
    119   ACMSweden,
    120   ACMTurkey,
    121   ACMChina,
    122   ACMHongkong,
    123   ACMTaiwan,
    124   ACMKorea,
    125   ACMSingapore,
    126   ACMNonStandard1
    127 // non-standard countries
    128 };
    129 
    130 ///////////////////////////////////////////////////////////////////////////
    131 // enum ACMAMRPackingFormat
    132 // An enumerator for different bit-packing format of AMR codec according to
    133 // RFC 3267.
    134 //
    135 // -AMRUndefined           : undefined.
    136 // -AMRBandwidthEfficient  : bandwidth-efficient mode.
    137 // -AMROctetAlligned       : Octet-alligned mode.
    138 // -AMRFileStorage         : file-storage mode.
    139 //
    140 enum ACMAMRPackingFormat {
    141   AMRUndefined = -1,
    142   AMRBandwidthEfficient = 0,
    143   AMROctetAlligned = 1,
    144   AMRFileStorage = 2
    145 };
    146 
    147 
    148 ///////////////////////////////////////////////////////////////////////////
    149 //
    150 //   Struct containing network statistics
    151 //
    152 // -currentBufferSize      : current jitter buffer size in ms
    153 // -preferredBufferSize    : preferred (optimal) buffer size in ms
    154 // -jitterPeaksFound       : indicate if peaky-jitter mode is engaged, that is,
    155 //                           if severe but sparse network delays have occurred.
    156 // -currentPacketLossRate  : loss rate (network + late) (in Q14)
    157 // -currentDiscardRate     : late loss rate (in Q14)
    158 // -currentExpandRate      : fraction (of original stream) of synthesized
    159 //                           speech inserted through expansion (in Q14)
    160 // -currentPreemptiveRate  : fraction of synthesized speech inserted through
    161 //                           pre-emptive expansion (in Q14)
    162 // -currentAccelerateRate  : fraction of data removed through acceleration
    163 //                           (in Q14)
    164 // -clockDriftPPM          : clock-drift between sender and receiver in parts-
    165 //                           per-million. Positive means that receiver sample
    166 //                           rate is higher than sender sample rate.
    167 // -meanWaitingTimeMs      : average packet waiting time in the buffer
    168 // -medianWaitingTimeMs    : median packet waiting time in the buffer
    169 // -minWaitingTimeMs       : min packet waiting time in the buffer
    170 // -maxWaitingTimeMs       : max packet waiting time in the buffer
    171 // -addedSamples           : samples inserted because of packet loss in off mode
    172 typedef struct {
    173   uint16_t currentBufferSize;
    174   uint16_t preferredBufferSize;
    175   bool jitterPeaksFound;
    176   uint16_t currentPacketLossRate;
    177   uint16_t currentDiscardRate;
    178   uint16_t currentExpandRate;
    179   uint16_t currentPreemptiveRate;
    180   uint16_t currentAccelerateRate;
    181   int32_t clockDriftPPM;
    182   int meanWaitingTimeMs;
    183   int medianWaitingTimeMs;
    184   int minWaitingTimeMs;
    185   int maxWaitingTimeMs;
    186   int addedSamples;
    187 } ACMNetworkStatistics;
    188 
    189 ///////////////////////////////////////////////////////////////////////////
    190 //
    191 // Enumeration of background noise mode a mapping from NetEQ interface.
    192 //
    193 // -On                  : default "normal" behavior with eternal noise
    194 // -Fade                : noise fades to zero after some time
    195 // -Off                 : background noise is always zero
    196 //
    197 enum ACMBackgroundNoiseMode {
    198   On,
    199   Fade,
    200   Off
    201 };
    202 
    203 }  // namespace webrtc
    204 
    205 #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_
    206