Home | History | Annotate | Download | only in voice_engine
      1 /*
      2  *  Copyright (c) 2012 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_VOICE_ENGINE_VOE_CODEC_IMPL_H
     12 #define WEBRTC_VOICE_ENGINE_VOE_CODEC_IMPL_H
     13 
     14 #include "webrtc/voice_engine/include/voe_codec.h"
     15 
     16 #include "webrtc/voice_engine/shared_data.h"
     17 
     18 namespace webrtc
     19 {
     20 
     21 class VoECodecImpl: public VoECodec
     22 {
     23 public:
     24     virtual int NumOfCodecs();
     25 
     26     virtual int GetCodec(int index, CodecInst& codec);
     27 
     28     virtual int SetSendCodec(int channel, const CodecInst& codec);
     29 
     30     virtual int GetSendCodec(int channel, CodecInst& codec);
     31 
     32     virtual int GetRecCodec(int channel, CodecInst& codec);
     33 
     34     virtual int SetSendCNPayloadType(
     35         int channel, int type,
     36         PayloadFrequencies frequency = kFreq16000Hz);
     37 
     38     virtual int SetRecPayloadType(int channel,
     39                                   const CodecInst& codec);
     40 
     41     virtual int GetRecPayloadType(int channel, CodecInst& codec);
     42 
     43     virtual int SetFECStatus(int channel, bool enable);
     44 
     45     virtual int GetFECStatus(int channel, bool& enabled);
     46 
     47     virtual int SetVADStatus(int channel,
     48                              bool enable,
     49                              VadModes mode = kVadConventional,
     50                              bool disableDTX = false);
     51 
     52     virtual int GetVADStatus(int channel,
     53                              bool& enabled,
     54                              VadModes& mode,
     55                              bool& disabledDTX);
     56 
     57     // Dual-streaming
     58     virtual int SetSecondarySendCodec(int channel, const CodecInst& codec,
     59                                       int red_payload_type);
     60 
     61     virtual int RemoveSecondarySendCodec(int channel);
     62 
     63     virtual int GetSecondarySendCodec(int channel, CodecInst& codec);
     64 
     65 protected:
     66     VoECodecImpl(voe::SharedData* shared);
     67     virtual ~VoECodecImpl();
     68 
     69 private:
     70     void ACMToExternalCodecRepresentation(CodecInst& toInst,
     71                                           const CodecInst& fromInst);
     72 
     73     void ExternalToACMCodecRepresentation(CodecInst& toInst,
     74                                           const CodecInst& fromInst);
     75 
     76     voe::SharedData* _shared;
     77 };
     78 
     79 }  // namespace webrtc
     80 
     81 #endif  // WEBRTC_VOICE_ENGINE_VOE_CODEC_IMPL_H
     82