This CL is divided in several patches, to make review easier.
Patch Set 1: Removing blanks at end of lines. Patch Set 2: Removing tabs. Patch Set 3: Fixing include-guards. Patch Set 4-7: Formatting files in the list. Patch Set 8: Formatting CNG. Patch Set 9: * Fixing comments from code review * Fixing formating in acm_dtmf_playout.cc * Started fixing formating of acm_g7221.cc. More work needed, so don't spend too much time reviewing. * Refactored constructor of ACMGenericCodec. Rest of file still to be fixed. * Fixing break; after return ...; in several files. Patch Set 10: * Chaning from reintepret_cast to static_cast in three files, acm_amr.cc, acm_cng.cc and acm_g722.cc NOTE! Not all files have the right format. That work will continue in separate CLs. Review URL: http://webrtc-codereview.appspot.com/175002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@881 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
		| @@ -8,62 +8,50 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef AUDIO_CODING_MODULE_H | ||||
| #define AUDIO_CODING_MODULE_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H | ||||
|  | ||||
| #include "module.h" | ||||
| #include "audio_coding_module_typedefs.h" | ||||
| #include "module.h" | ||||
| #include "module_common_types.h" | ||||
|  | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| // forward declarations | ||||
| struct CodecInst; | ||||
|  | ||||
|  | ||||
| #define WEBRTC_10MS_PCM_AUDIO 960 // 16 bits super wideband 48 Khz | ||||
|  | ||||
|  | ||||
| // Callback class used for sending data ready to be packetized | ||||
| class AudioPacketizationCallback | ||||
| { | ||||
| class AudioPacketizationCallback { | ||||
|  public: | ||||
|   virtual ~AudioPacketizationCallback() {} | ||||
|  | ||||
|   virtual WebRtc_Word32 SendData( | ||||
|         FrameType               frameType, | ||||
|         WebRtc_UWord8           payloadType, | ||||
|         WebRtc_UWord32          timeStamp, | ||||
|         const WebRtc_UWord8*          payloadData, | ||||
|         WebRtc_UWord16          payloadSize, | ||||
|       FrameType frameType, WebRtc_UWord8 payloadType, WebRtc_UWord32 timeStamp, | ||||
|       const WebRtc_UWord8* payloadData, WebRtc_UWord16 payloadSize, | ||||
|       const RTPFragmentationHeader* fragmentation) = 0; | ||||
| }; | ||||
|  | ||||
| // Callback class used for inband Dtmf detection | ||||
| class AudioCodingFeedback | ||||
| { | ||||
| class AudioCodingFeedback { | ||||
|  public: | ||||
|   virtual ~AudioCodingFeedback() {} | ||||
|  | ||||
|     virtual WebRtc_Word32 IncomingDtmf( | ||||
|         const WebRtc_UWord8 digitDtmf, | ||||
|   virtual WebRtc_Word32 IncomingDtmf(const WebRtc_UWord8 digitDtmf, | ||||
|                                      const bool end) = 0; | ||||
| }; | ||||
|  | ||||
| // Callback class used for reporting VAD decision | ||||
| class ACMVADCallback | ||||
| { | ||||
| class ACMVADCallback { | ||||
|  public: | ||||
|   virtual ~ACMVADCallback() {} | ||||
|     virtual WebRtc_Word32 InFrameType( | ||||
|         WebRtc_Word16 frameType) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 InFrameType(WebRtc_Word16 frameType) = 0; | ||||
| }; | ||||
|  | ||||
| // Callback class used for reporting receiver statistics | ||||
| class ACMVQMonCallback | ||||
| { | ||||
| class ACMVQMonCallback { | ||||
|  public: | ||||
|   virtual ~ACMVQMonCallback() {} | ||||
|  | ||||
| @@ -75,8 +63,7 @@ public: | ||||
|       const WebRtc_UWord16 delayMS) = 0; // average delay in ms | ||||
| }; | ||||
|  | ||||
| class AudioCodingModule: public Module | ||||
| { | ||||
| class AudioCodingModule: public Module { | ||||
|  protected: | ||||
|   AudioCodingModule() {} | ||||
|   virtual ~AudioCodingModule() {} | ||||
| @@ -85,11 +72,9 @@ public: | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // Creation and destruction of a ACM | ||||
|   // | ||||
|     static AudioCodingModule* Create( | ||||
|         const WebRtc_Word32 id); | ||||
|   static AudioCodingModule* Create(const WebRtc_Word32 id); | ||||
|  | ||||
|     static void Destroy( | ||||
|         AudioCodingModule* module); | ||||
|   static void Destroy(AudioCodingModule* module); | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   //   Utility functions | ||||
| @@ -110,12 +95,10 @@ public: | ||||
|   //   -1 if failed to write the whole version string, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     static WebRtc_Word32 GetVersion( | ||||
|         WebRtc_Word8*   version, | ||||
|   static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainBuffBytes, | ||||
|                                   WebRtc_UWord32& position); | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_UWord8 NumberOfCodecs() | ||||
|   // Returns number of supported codecs. | ||||
| @@ -125,7 +108,6 @@ public: | ||||
|   /// | ||||
|   static WebRtc_UWord8 NumberOfCodecs(); | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Codec() | ||||
|   // Get supported codec with list number. | ||||
| @@ -141,10 +123,7 @@ public: | ||||
|   //   -1 if the list number (listId) is invalid. | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     static WebRtc_Word32 Codec( | ||||
|         const WebRtc_UWord8 listId, | ||||
|         CodecInst&          codec); | ||||
|  | ||||
|   static WebRtc_Word32 Codec(const WebRtc_UWord8 listId, CodecInst& codec); | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Codec() | ||||
| @@ -164,12 +143,9 @@ public: | ||||
|   //   -1 if the list number (listId) is invalid. | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     static WebRtc_Word32 Codec( | ||||
|         const WebRtc_Word8* payloadName, | ||||
|         CodecInst&          codec, | ||||
|   static WebRtc_Word32 Codec(const WebRtc_Word8* payloadName, CodecInst& codec, | ||||
|                              const WebRtc_Word32 samplingFreqHz = -1); | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Codec() | ||||
|   // | ||||
| @@ -185,11 +161,9 @@ public: | ||||
|   //   if the codec is found, the index of the codec in the list, | ||||
|   //   -1 if the codec is not found. | ||||
|   // | ||||
|     static WebRtc_Word32 Codec( | ||||
|         const WebRtc_Word8* payloadName, | ||||
|   static WebRtc_Word32 Codec(const WebRtc_Word8* payloadName, | ||||
|                              const WebRtc_Word32 samplingFreqHz = -1); | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // bool IsCodecValid() | ||||
|   // Checks the validity of the parameters of the given codec. | ||||
| @@ -222,7 +196,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 InitializeSender() = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ResetEncoder() | ||||
|   // This API resets the states of encoder. All the encoder settings, such as | ||||
| @@ -234,7 +207,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 ResetEncoder() = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 RegisterSendCodec() | ||||
|   // Registers a codec, specified by "sendCodec," as sending codec. | ||||
| @@ -255,9 +227,7 @@ public: | ||||
|   //   -1 if failed to initialize, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     virtual WebRtc_Word32 RegisterSendCodec( | ||||
|         const CodecInst& sendCodec) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 RegisterSendCodec(const CodecInst& sendCodec) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SendCodec() | ||||
| @@ -270,9 +240,7 @@ public: | ||||
|   //   -1 if failed to get send codec, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     virtual WebRtc_Word32 SendCodec( | ||||
|         CodecInst& currentSendCodec) const = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 SendCodec(CodecInst& currentSendCodec) const = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SendFrequency() | ||||
| @@ -284,7 +252,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 SendFrequency() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Bitrate() | ||||
|   // Get encoding bit-rate in bits per second. | ||||
| @@ -295,7 +262,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 SendBitrate() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SetReceivedEstimatedBandwidth() | ||||
|   // Set available bandwidth [bits/sec] of the up-link channel. | ||||
| @@ -312,7 +278,6 @@ public: | ||||
|   virtual WebRtc_Word32 SetReceivedEstimatedBandwidth( | ||||
|       const WebRtc_Word32 bw) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 RegisterTransportCallback() | ||||
|   // Register a transport callback which will be called to deliver | ||||
| @@ -332,7 +297,6 @@ public: | ||||
|   virtual WebRtc_Word32 RegisterTransportCallback( | ||||
|       AudioPacketizationCallback* transport) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Add10MsData() | ||||
|   // Add 10MS of raw (PCM) audio data to the encoder. If the sampling | ||||
| @@ -351,9 +315,7 @@ public: | ||||
|   //   < -1   to add the frame to the buffer n samples had to be | ||||
|   //          overwritten, -n is the return value in this case. | ||||
|   // | ||||
|     virtual WebRtc_Word32 Add10MsData( | ||||
|         const AudioFrame& audioFrame) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 Add10MsData(const AudioFrame& audioFrame) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // (FEC) Forward Error Correction | ||||
| @@ -381,8 +343,7 @@ public: | ||||
|   //   -1 if failed to set FEC status, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     virtual WebRtc_Word32 SetFECStatus( | ||||
|         const bool enableFEC) = 0; | ||||
|   virtual WebRtc_Word32 SetFECStatus(const bool enableFEC) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // bool FECStatus() | ||||
| @@ -394,7 +355,6 @@ public: | ||||
|   // | ||||
|   virtual bool FECStatus() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   //   (VAD) Voice Activity Detection | ||||
|   // | ||||
| @@ -423,12 +383,10 @@ public: | ||||
|   //   -1 if failed to set up VAD/DTX, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|     virtual WebRtc_Word32 SetVAD( | ||||
|         const bool       enableDTX = true, | ||||
|   virtual WebRtc_Word32 SetVAD(const bool enableDTX = true, | ||||
|                                const bool enableVAD = false, | ||||
|                                const ACMVADMode vadMode = VADNormal) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 VAD() | ||||
|   // Get VAD status. | ||||
| @@ -444,12 +402,9 @@ public: | ||||
|   //   -1 if fails to retrieve the setting of DTX/VAD, | ||||
|   //    0 if succeeeded. | ||||
|   // | ||||
|     virtual WebRtc_Word32 VAD( | ||||
|         bool&       dtxEnabled, | ||||
|         bool&       vadEnabled, | ||||
|   virtual WebRtc_Word32 VAD(bool& dtxEnabled, bool& vadEnabled, | ||||
|                             ACMVADMode& vadMode) const = 0; | ||||
|  | ||||
|      | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ReplaceInternalDTXWithWebRtc() | ||||
|   // Used to replace codec internal DTX scheme with WebRtc. This is only | ||||
| @@ -467,7 +422,6 @@ public: | ||||
|   virtual WebRtc_Word32 ReplaceInternalDTXWithWebRtc( | ||||
|       const bool useWebRtcDTX = false) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 IsInternalDTXReplacedWithWebRtc() | ||||
|   // Get status if the codec internal DTX (when such exists) is replaced with | ||||
| @@ -485,7 +439,6 @@ public: | ||||
|   virtual WebRtc_Word32 IsInternalDTXReplacedWithWebRtc( | ||||
|       bool& usesWebRtcDTX) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 RegisterVADCallback() | ||||
|   // Call this method to register a callback function which is called | ||||
| @@ -500,9 +453,7 @@ public: | ||||
|   //   -1 if failed to register the callback function. | ||||
|   //    0 if the callback function is registered successfully. | ||||
|   // | ||||
|     virtual WebRtc_Word32 RegisterVADCallback( | ||||
|         ACMVADCallback* vadCallback) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vadCallback) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   //   Receiver | ||||
| @@ -523,7 +474,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 InitializeReceiver() = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ResetDecoder() | ||||
|   // This API resets the states of decoders. ACM will not lose any | ||||
| @@ -535,7 +485,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 ResetDecoder() = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ReceiveFrequency() | ||||
|   // Get sampling frequency of the last received payload. | ||||
| @@ -546,7 +495,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 ReceiveFrequency() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 PlayoutFrequency() | ||||
|   // Get sampling frequency of audio played out. | ||||
| @@ -556,7 +504,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 PlayoutFrequency() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 RegisterReceiveCodec() | ||||
|   // Register possible decoders, can be called multiple times for | ||||
| @@ -571,9 +518,7 @@ public: | ||||
|   //   -1 if failed to register the codec | ||||
|   //    0 if the codec registered successfully. | ||||
|   // | ||||
|     virtual WebRtc_Word32 RegisterReceiveCodec( | ||||
|         const CodecInst& receiveCodec) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receiveCodec) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 UnregisterReceiveCodec() | ||||
| @@ -591,7 +536,6 @@ public: | ||||
|   virtual WebRtc_Word32 UnregisterReceiveCodec( | ||||
|       const WebRtc_Word16 receiveCodec) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ReceiveCodec() | ||||
|   // Get the codec associated with last received payload. | ||||
| @@ -605,9 +549,7 @@ public: | ||||
|   //   -1 if failed to retrieve the codec, | ||||
|   //    0 if the codec is successfully retrieved. | ||||
|   // | ||||
|     virtual WebRtc_Word32 ReceiveCodec( | ||||
|         CodecInst& currRcvCodec) const = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 ReceiveCodec(CodecInst& currRcvCodec) const = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 IncomingPacket() | ||||
| @@ -623,12 +565,10 @@ public: | ||||
|   //   -1 if failed to push in the payload | ||||
|   //    0 if payload is successfully pushed in. | ||||
|   // | ||||
|     virtual WebRtc_Word32 IncomingPacket( | ||||
|         const WebRtc_Word8*    incomingPayload, | ||||
|   virtual WebRtc_Word32 IncomingPacket(const WebRtc_Word8* incomingPayload, | ||||
|                                        const WebRtc_Word32 payloadLengthByte, | ||||
|                                        const WebRtcRTPHeader& rtpInfo) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 IncomingPayload() | ||||
|   // Call this API to push incoming payloads when there is no rtp-info. | ||||
| @@ -653,13 +593,11 @@ public: | ||||
|   //   -1 if failed to push in the payload | ||||
|   //    0 if payload is successfully pushed in. | ||||
|   // | ||||
|     virtual WebRtc_Word32 IncomingPayload( | ||||
|         const WebRtc_Word8*  incomingPayload, | ||||
|   virtual WebRtc_Word32 IncomingPayload(const WebRtc_Word8* incomingPayload, | ||||
|                                         const WebRtc_Word32 payloadLengthByte, | ||||
|                                         const WebRtc_UWord8 payloadType, | ||||
|                                         const WebRtc_UWord32 timestamp = 0) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SetMinimumPlayoutDelay() | ||||
|   // Set Minimum playout delay, used for lip-sync. | ||||
| @@ -671,9 +609,7 @@ public: | ||||
|   //   -1 if failed to set the delay, | ||||
|   //    0 if the minimum delay is set. | ||||
|   // | ||||
|     virtual WebRtc_Word32 SetMinimumPlayoutDelay( | ||||
|         const WebRtc_Word32 timeMs) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 SetMinimumPlayoutDelay(const WebRtc_Word32 timeMs) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 Delay() | ||||
| @@ -688,7 +624,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 Delay(WebRtc_UWord16& delayMs) const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 RegisterIncomingMessagesCallback() | ||||
|   // Used by the module to deliver messages to the codec module/application | ||||
| @@ -707,11 +642,11 @@ public: | ||||
|   //   -1 if the message callback could not be registered | ||||
|   //    0 if registration is successful. | ||||
|   // | ||||
|     virtual WebRtc_Word32 RegisterIncomingMessagesCallback( | ||||
|   virtual WebRtc_Word32 | ||||
|       RegisterIncomingMessagesCallback( | ||||
|           AudioCodingFeedback* inMsgCallback, | ||||
|           const ACMCountries cpt = ACMDisableCountryDetection) = 0; | ||||
|  | ||||
|      | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SetDtmfPlayoutStatus() | ||||
|   // Configure Dtmf playout, i.e. whether out-of-band | ||||
| @@ -727,7 +662,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 SetDtmfPlayoutStatus(const bool enable) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // bool DtmfPlayoutStatus() | ||||
|   // Get Dtmf playout status. | ||||
| @@ -738,7 +672,6 @@ public: | ||||
|   // | ||||
|   virtual bool DtmfPlayoutStatus() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SetBackgroundNoiseMode() | ||||
|   // Sets the mode of the background noise playout in an event of long | ||||
| @@ -755,7 +688,6 @@ public: | ||||
|   virtual WebRtc_Word32 SetBackgroundNoiseMode( | ||||
|       const ACMBackgroundNoiseMode mode) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 BackgroundNoiseMode() | ||||
|   // Call this method to get the mode of the background noise playout. | ||||
| @@ -770,9 +702,7 @@ public: | ||||
|   //    0 if the output is a valid mode. | ||||
|   //   -1 if ACM failed to output a valid mode. | ||||
|   // | ||||
|     virtual WebRtc_Word32 BackgroundNoiseMode( | ||||
|         ACMBackgroundNoiseMode& mode) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 PlayoutTimestamp() | ||||
| @@ -788,9 +718,7 @@ public: | ||||
|   //   -1 if failed to output the correct timestamp. | ||||
|   // | ||||
|   // | ||||
|     virtual WebRtc_Word32 PlayoutTimestamp( | ||||
|         WebRtc_UWord32& timestamp) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 DecoderEstimatedBandwidth() | ||||
| @@ -805,7 +733,6 @@ public: | ||||
|   // | ||||
|   virtual WebRtc_Word32 DecoderEstimatedBandwidth() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 SetPlayoutMode() | ||||
|   // Call this API to set the playout mode. Playout mode could be optimized | ||||
| @@ -826,9 +753,7 @@ public: | ||||
|   //   -1 if failed to set the mode, | ||||
|   //    0 if succeeding. | ||||
|   // | ||||
|     virtual WebRtc_Word32 SetPlayoutMode( | ||||
|         const AudioPlayoutMode mode) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word32 SetPlayoutMode(const AudioPlayoutMode mode) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // AudioPlayoutMode PlayoutMode() | ||||
| @@ -845,7 +770,6 @@ public: | ||||
|   // | ||||
|   virtual AudioPlayoutMode PlayoutMode() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 PlayoutData10Ms( | ||||
|   // Get 10 milliseconds of raw audio data for playout, at the given sampling | ||||
| @@ -866,11 +790,10 @@ public: | ||||
|   //   -1 if the function fails, | ||||
|   //    0 if the function succeeds. | ||||
|   // | ||||
|     virtual WebRtc_Word32 PlayoutData10Ms( | ||||
|         const WebRtc_Word32 desiredFreqHz, | ||||
|   virtual WebRtc_Word32 | ||||
|       PlayoutData10Ms(const WebRtc_Word32 desiredFreqHz, | ||||
|                       AudioFrame &audioFrame) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   //   (CNG) Comfort Noise Generation | ||||
|   //   Generate comfort noise when receiving DTX packets | ||||
| @@ -890,9 +813,7 @@ public: | ||||
|   //   -1 if failed to enable/disable VAD, | ||||
|   //    0 if succeded to enable/disable VAD. | ||||
|   // | ||||
|     virtual WebRtc_Word16 SetReceiveVADStatus( | ||||
|         const bool enable)  = 0; | ||||
|  | ||||
|   virtual WebRtc_Word16 SetReceiveVADStatus(const bool enable) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // bool ReceiveVADStatus() | ||||
| @@ -906,7 +827,6 @@ public: | ||||
|   // | ||||
|   virtual bool ReceiveVADStatus() const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word16 SetReceiveVADMode() | ||||
|   // Configure VAD aggressiveness on the incoming stream. | ||||
| @@ -921,9 +841,7 @@ public: | ||||
|   //   -1 if fails to set the mode, | ||||
|   //    0 if the mode is set successfully. | ||||
|   // | ||||
|     virtual WebRtc_Word16 SetReceiveVADMode( | ||||
|         const ACMVADMode mode) = 0; | ||||
|  | ||||
|   virtual WebRtc_Word16 SetReceiveVADMode(const ACMVADMode mode) = 0; | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // ACMVADMode ReceiveVADMode() | ||||
| @@ -977,7 +895,6 @@ public: | ||||
|   virtual WebRtc_Word32 SetISACMaxPayloadSize( | ||||
|       const WebRtc_UWord16 maxPayloadLenBytes) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ConfigISACBandwidthEstimator() | ||||
|   // Call this function to configure the bandwidth estimator of ISAC. | ||||
| @@ -1007,7 +924,6 @@ public: | ||||
|       const WebRtc_UWord16 initRateBitPerSec, | ||||
|       const bool enforceFrameSize = false) = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   //   statistics | ||||
|   // | ||||
| @@ -1026,7 +942,6 @@ public: | ||||
|   virtual WebRtc_Word32 NetworkStatistics( | ||||
|       ACMNetworkStatistics& networkStatistics) const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32  JitterStatistics() | ||||
|   // Get the jitter statistics. | ||||
| @@ -1041,7 +956,6 @@ public: | ||||
|   virtual WebRtc_Word32 JitterStatistics( | ||||
|       ACMJitterStatistics& jitterStatistics) const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32  PreferredBufferSize() | ||||
|   // Get the optimal buffer size calculated for the current network | ||||
| @@ -1058,7 +972,6 @@ public: | ||||
|   virtual WebRtc_Word32 PreferredBufferSize( | ||||
|       WebRtc_UWord16& prefBufSize) const = 0; | ||||
|  | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 ResetJitterStatistics() | ||||
|   // Reset jitter statistics. | ||||
| @@ -1072,5 +985,4 @@ public: | ||||
|  | ||||
| }  // namespace webrtc | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H | ||||
|   | ||||
| @@ -8,13 +8,12 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef AUDIO_CODING_MODULE_TYPEDEFS_H | ||||
| #define AUDIO_CODING_MODULE_TYPEDEFS_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_ | ||||
|  | ||||
| #include "typedefs.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // enum AudioPlayoutMode | ||||
| @@ -36,14 +35,12 @@ namespace webrtc | ||||
| //                this mode can be used to improve the jitter robustness at | ||||
| //                the cost of increased delay. | ||||
| // | ||||
| enum AudioPlayoutMode | ||||
| { | ||||
| enum AudioPlayoutMode { | ||||
|   voice = 0, | ||||
|   fax = 1, | ||||
|   streaming = 2 | ||||
| }; | ||||
|  | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // enum ACMSpeechType | ||||
| // An enumerator for possible labels of a decoded frame. | ||||
| @@ -61,8 +58,7 @@ enum AudioPlayoutMode | ||||
| // -VADPassive  : the VAD at the receiver recognizes this frame as | ||||
| //                passive. | ||||
| // | ||||
| enum ACMSpeechType | ||||
| { | ||||
| enum ACMSpeechType { | ||||
|   normal = 0, | ||||
|   PLC = 1, | ||||
|   CNG = 2, | ||||
| @@ -70,7 +66,6 @@ enum ACMSpeechType | ||||
|   VADPassive = 4 | ||||
| }; | ||||
|  | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // enum ACMVADMode | ||||
| // An enumerator for aggressiveness of VAD | ||||
| @@ -80,21 +75,18 @@ enum ACMSpeechType | ||||
| // -VADAggr                  : an aggressive mode. | ||||
| // -VADVeryAggr              : the most agressive mode. | ||||
| // | ||||
| enum ACMVADMode | ||||
| { | ||||
| enum ACMVADMode { | ||||
|   VADNormal = 0, | ||||
|   VADLowBitrate = 1, | ||||
|   VADAggr = 2, | ||||
|   VADVeryAggr = 3 | ||||
| }; | ||||
|  | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // enum ACMCountries | ||||
| // An enumerator for countries, used when enabling CPT for a specific country. | ||||
| // | ||||
| enum ACMCountries | ||||
| { | ||||
| enum ACMCountries { | ||||
|   ACMDisableCountryDetection = -1, // disable CPT detection | ||||
|   ACMUSA = 0, | ||||
|   ACMJapan, | ||||
| @@ -125,7 +117,8 @@ enum ACMCountries | ||||
|   ACMTaiwan, | ||||
|   ACMKorea, | ||||
|   ACMSingapore, | ||||
|     ACMNonStandard1  // non-standard countries | ||||
|   ACMNonStandard1 | ||||
| // non-standard countries | ||||
| }; | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| @@ -138,8 +131,7 @@ enum ACMCountries | ||||
| // -AMROctetAlligned       : Octet-alligned mode. | ||||
| // -AMRFileStorage         : file-storage mode. | ||||
| // | ||||
| enum ACMAMRPackingFormat | ||||
| { | ||||
| enum ACMAMRPackingFormat { | ||||
|   AMRUndefined = -1, | ||||
|   AMRBandwidthEfficient = 0, | ||||
|   AMROctetAlligned = 1, | ||||
| @@ -155,13 +147,13 @@ enum ACMAMRPackingFormat | ||||
| // -preferredBufferSize    : preferred (optimal) buffer size in ms | ||||
| // -currentPacketLossRate  : loss rate (network + late) (in Q14) | ||||
| // -currentDiscardRate     : late loss rate (in Q14) | ||||
| // -currentExpandRate      : fraction (of original stream) of synthesized speech | ||||
| //                           inserted through expansion (in Q14) | ||||
| // -currentExpandRate      : fraction (of original stream) of synthesized | ||||
| //                           speech inserted through expansion (in Q14) | ||||
| // -currentPreemptiveRate  : fraction of synthesized speech inserted through | ||||
| //                           pre-emptive expansion (in Q14) | ||||
| // -currentAccelerateRate  : fraction of data removed through acceleration (in Q14) | ||||
| typedef struct  | ||||
| { | ||||
| // -currentAccelerateRate  : fraction of data removed through acceleration | ||||
| //                           (in Q14) | ||||
| typedef struct { | ||||
|   WebRtc_UWord16 currentBufferSize; | ||||
|   WebRtc_UWord16 preferredBufferSize; | ||||
|   WebRtc_UWord16 currentPacketLossRate; | ||||
| @@ -178,28 +170,37 @@ typedef struct | ||||
| // -jbMinSize               : smallest Jitter Buffer size during call in ms | ||||
| // -jbMaxSize               : largest Jitter Buffer size during call in ms | ||||
| // -jbAvgSize               : the average JB size, measured over time - ms | ||||
| // -jbChangeCount           : number of times the Jitter Buffer changed (using Accelerate or Pre-emptive Expand) | ||||
| // -jbChangeCount           : number of times the Jitter Buffer changed (using | ||||
| //                            Accelerate or Pre-emptive Expand) | ||||
| // -lateLossMs              : amount (in ms) of audio data received late | ||||
| // -accelerateMs            : milliseconds removed to reduce jitter buffer size | ||||
| // -flushedMs               : milliseconds discarded through buffer flushing | ||||
| // -generatedSilentMs       : milliseconds of generated silence | ||||
| // -interpolatedVoiceMs     : milliseconds of synthetic audio data (non-background noise) | ||||
| // -interpolatedSilentMs    : milliseconds of synthetic audio data (background noise level) | ||||
| // -numExpandTiny           : count of tiny expansions in output audio less than 250 ms*/ | ||||
| // -numExpandSmall          : count of small expansions in output audio 250 to 500 ms*/ | ||||
| // -numExpandMedium         : count of medium expansions in output audio 500 to 2000 ms*/ | ||||
| // -numExpandLong           : count of long expansions in output audio longer than 2000 | ||||
| // -interpolatedVoiceMs     : milliseconds of synthetic audio data | ||||
| //                           (non-background noise) | ||||
| // -interpolatedSilentMs    : milliseconds of synthetic audio data (background | ||||
| //                            noise level) | ||||
| // -numExpandTiny           : count of tiny expansions in output audio less | ||||
| //                            than 250 ms | ||||
| // -numExpandSmall          : count of small expansions in output audio 250 to | ||||
| //                            500 ms | ||||
| // -numExpandMedium         : count of medium expansions in output audio 500 to | ||||
| //                            2000 ms | ||||
| // -numExpandLong           : count of long expansions in output audio longer | ||||
| //                            than 2000 | ||||
| // -longestExpandDurationMs : duration of longest audio drop-out | ||||
| // -countIAT500ms           : count of times we got small network outage (inter-arrival time in [500, 1000) ms) | ||||
| // -countIAT1000ms          : count of times we got medium network outage (inter-arrival time in [1000, 2000) ms) | ||||
| // -countIAT2000ms          : count of times we got large network outage (inter-arrival time >= 2000 ms) | ||||
| // -countIAT500ms           : count of times we got small network outage | ||||
| //                            (inter-arrival time in [500, 1000) ms) | ||||
| // -countIAT1000ms          : count of times we got medium network outage | ||||
| //                            (inter-arrival time in [1000, 2000) ms) | ||||
| // -countIAT2000ms          : count of times we got large network outage | ||||
| //                            (inter-arrival time >= 2000 ms) | ||||
| // -longestIATms            : longest packet inter-arrival time in ms | ||||
| // -minPacketDelayMs        : min time incoming Packet "waited" to be played | ||||
| // -maxPacketDelayMs        : max time incoming Packet "waited" to be played | ||||
| // -avgPacketDelayMs        : avg time incoming Packet "waited" to be played | ||||
| // | ||||
| typedef struct  | ||||
| { | ||||
| typedef struct { | ||||
|   WebRtc_UWord32 jbMinSize; | ||||
|   WebRtc_UWord32 jbMaxSize; | ||||
|   WebRtc_UWord32 jbAvgSize; | ||||
| @@ -232,14 +233,12 @@ typedef struct | ||||
| // -Fade                : noise fades to zero after some time | ||||
| // -Off                 : background noise is always zero | ||||
| // | ||||
| enum ACMBackgroundNoiseMode | ||||
| { | ||||
| enum ACMBackgroundNoiseMode { | ||||
|   On, | ||||
|   Fade, | ||||
|   Off | ||||
| }; | ||||
|  | ||||
|  | ||||
| }  // namespace webrtc | ||||
|  | ||||
| #endif | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_TYPEDEFS_H_ | ||||
|   | ||||
| @@ -50,159 +50,98 @@ | ||||
| namespace webrtc { | ||||
|  | ||||
| #ifndef WEBRTC_CODEC_AMR | ||||
| ACMAMR::ACMAMR(WebRtc_Word16 /* codecID */) | ||||
| { | ||||
| ACMAMR::ACMAMR(WebRtc_Word16 /* codecID */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMAMR::~ACMAMR() | ||||
| { | ||||
| ACMAMR::~ACMAMR() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* /* bitStream */, | ||||
|                                      WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                  WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                  WebRtc_Word16* /* audio */, | ||||
|                                  WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                  WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::EnableDTX() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::EnableDTX() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::DisableDTX() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::DisableDTX() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMAMR::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */, | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */, | ||||
|                                const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMAMR::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMAMR::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::DestructEncoderSafe() | ||||
| { | ||||
| void ACMAMR::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::DestructDecoderSafe() | ||||
| { | ||||
| void ACMAMR::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetBitRateSafe( | ||||
|     const WebRtc_Word32 /* rate */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::SetBitRateSafe(const WebRtc_Word32 /* rate */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMAMR::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetAMREncoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMR::AMREncoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMR::AMREncoderPackingFormat() const { | ||||
|   return AMRUndefined; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetAMRDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMR::AMRDecoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMR::AMRDecoderPackingFormat() const { | ||||
|   return AMRUndefined; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     /* netEq       */, | ||||
|     WebRtc_Word16 /* payloadType */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::UnregisterFromNetEqSafe(ACMNetEQ* /* netEq */, | ||||
|                                               WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| @@ -218,12 +157,11 @@ ACMAMR::UnregisterFromNetEqSafe( | ||||
| #define WEBRTC_AMR_MR102  6 | ||||
| #define WEBRTC_AMR_MR122  7 | ||||
|  | ||||
| ACMAMR::ACMAMR(WebRtc_Word16 codecID): | ||||
| _encoderInstPtr(NULL), | ||||
| ACMAMR::ACMAMR(WebRtc_Word16 codecID) | ||||
|     : _encoderInstPtr(NULL), | ||||
|       _decoderInstPtr(NULL), | ||||
|       _encodingMode(-1), // invalid value | ||||
| _encodingRate(0)        // invalid value | ||||
| { | ||||
|       _encodingRate(0) { // invalid value | ||||
|   _codecID = codecID; | ||||
|   _hasInternalDTX = true; | ||||
|   _encoderPackingFormat = AMRBandwidthEfficient; | ||||
| @@ -231,50 +169,41 @@ _encodingRate(0)        // invalid value | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMAMR::~ACMAMR() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| ACMAMR::~ACMAMR() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcAmr_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcAmr_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalEncode( | ||||
|     WebRtc_UWord8* bitStream, | ||||
|     WebRtc_Word16* bitStreamLenByte) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitStream, | ||||
|                                      WebRtc_Word16* bitStreamLenByte) { | ||||
|   WebRtc_Word16 vadDecision = 1; | ||||
|   // sanity check, if the rate is set correctly. we might skip this | ||||
|   // sanity check. if rate is not set correctly, initialization flag | ||||
|   // should be false and should not be here. | ||||
|     if((_encodingMode < WEBRTC_AMR_MR475) || (_encodingMode > WEBRTC_AMR_MR122)) | ||||
|     { | ||||
|   if ((_encodingMode < WEBRTC_AMR_MR475) || | ||||
|       (_encodingMode > WEBRTC_AMR_MR122)) { | ||||
|     *bitStreamLenByte = 0; | ||||
|     return -1; | ||||
|   } | ||||
|   *bitStreamLenByte = WebRtcAmr_Encode(_encoderInstPtr, | ||||
|         &_inAudio[_inAudioIxRead], _frameLenSmpl, (WebRtc_Word16*)bitStream, | ||||
|                                        &_inAudio[_inAudioIxRead], | ||||
|                                        _frameLenSmpl, | ||||
|                                        (WebRtc_Word16*) bitStream, | ||||
|                                        _encodingMode); | ||||
|  | ||||
|   // Update VAD, if internal DTX is used | ||||
|     if(_hasInternalDTX && _dtxEnabled) | ||||
|     { | ||||
|         if(*bitStreamLenByte <= (7*_frameLenSmpl/160)) | ||||
|         { | ||||
|   if (_hasInternalDTX && _dtxEnabled) { | ||||
|     if (*bitStreamLenByte <= (7 * _frameLenSmpl / 160)) { | ||||
|       vadDecision = 0; | ||||
|     } | ||||
|         for(WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) | ||||
|         { | ||||
|     for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) { | ||||
|       _vadLabel[n] = vadDecision; | ||||
|     } | ||||
|   } | ||||
| @@ -283,100 +212,65 @@ ACMAMR::InternalEncode( | ||||
|   return *bitStreamLenByte; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                  WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                  WebRtc_Word16* /* audio */, | ||||
|                                  WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                  WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::EnableDTX() | ||||
| { | ||||
|     if(_dtxEnabled) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMR::EnableDTX() { | ||||
|   if (_dtxEnabled) { | ||||
|     return 0; | ||||
|     } | ||||
|     else if(_encoderExist)  // check if encoder exist | ||||
|     { | ||||
|   } else if (_encoderExist) { // check if encoder exist | ||||
|     // enable DTX | ||||
|         if(WebRtcAmr_EncoderInit(_encoderInstPtr, 1) < 0) | ||||
|         { | ||||
|     if (WebRtcAmr_EncoderInit(_encoderInstPtr, 1) < 0) { | ||||
|       return -1; | ||||
|     } | ||||
|     _dtxEnabled = true; | ||||
|     return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     return -1; | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::DisableDTX() | ||||
| { | ||||
|     if(!_dtxEnabled) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMR::DisableDTX() { | ||||
|   if (!_dtxEnabled) { | ||||
|     return 0; | ||||
|     } | ||||
|     else if(_encoderExist) // check if encoder exist | ||||
|     { | ||||
|   } else if (_encoderExist) { // check if encoder exist | ||||
|     // disable DTX | ||||
|         if(WebRtcAmr_EncoderInit(_encoderInstPtr, 0) < 0) | ||||
|         { | ||||
|     if (WebRtcAmr_EncoderInit(_encoderInstPtr, 0) < 0) { | ||||
|       return -1; | ||||
|     } | ||||
|     _dtxEnabled = false; | ||||
|     return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     // encoder doesn't exists, therefore disabling is harmless | ||||
|     return 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codecParams) { | ||||
|   WebRtc_Word16 status = SetBitRateSafe((codecParams->codecInstant).rate); | ||||
|     status += (WebRtcAmr_EncoderInit(_encoderInstPtr, | ||||
|         ((codecParams->enableDTX)? 1:0)) < 0)? -1:0; | ||||
|     status += (WebRtcAmr_EncodeBitmode(_encoderInstPtr, | ||||
|         _encoderPackingFormat ) < 0)? -1:0; | ||||
|   status += (WebRtcAmr_EncoderInit( | ||||
|       _encoderInstPtr, ((codecParams->enableDTX) ? 1 : 0)) < 0) ? -1 : 0; | ||||
|   status += (WebRtcAmr_EncodeBitmode( | ||||
|       _encoderInstPtr, _encoderPackingFormat) < 0) ? -1 : 0; | ||||
|   return (status < 0) ? -1 : 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
|     WebRtc_Word16 status = ( | ||||
|         (WebRtcAmr_DecoderInit(_decoderInstPtr) < 0)? -1:0); | ||||
|     status +=  | ||||
|             WebRtcAmr_DecodeBitmode(_decoderInstPtr, _decoderPackingFormat); | ||||
| WebRtc_Word16 ACMAMR::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   WebRtc_Word16 status = | ||||
|       ((WebRtcAmr_DecoderInit(_decoderInstPtr) < 0) ? -1 : 0); | ||||
|   status += WebRtcAmr_DecodeBitmode(_decoderInstPtr, _decoderPackingFormat); | ||||
|   return (status < 0) ? -1 : 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMAMR::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&      codecInst) | ||||
| { | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
| WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                const CodecInst& codecInst) { | ||||
|   if (!_decoderInitialized) { | ||||
|     // Todo: | ||||
|     // log error | ||||
|     return -1; | ||||
| @@ -385,32 +279,22 @@ ACMAMR::CodecDef( | ||||
|   // "SET_CODEC_PAR" & "SET_AMR_FUNCTION." | ||||
|   // Then call NetEQ to add the codec to it's | ||||
|   // database. | ||||
|     SET_CODEC_PAR((codecDef), kDecoderAMR, codecInst.pltype, | ||||
|         _decoderInstPtr, 8000); | ||||
|   SET_CODEC_PAR((codecDef), kDecoderAMR, codecInst.pltype, _decoderInstPtr, | ||||
|                 8000); | ||||
|   SET_AMR_FUNCTIONS((codecDef)); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMAMR::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMAMR::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalCreateEncoder() { | ||||
|   return WebRtcAmr_CreateEnc(&_encoderInstPtr); | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::DestructEncoderSafe() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMAMR::DestructEncoderSafe() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcAmr_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -421,19 +305,12 @@ ACMAMR::DestructEncoderSafe() | ||||
|   _encodingRate = 0; // invalid value | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::InternalCreateDecoder() { | ||||
|   return WebRtcAmr_CreateDec(&_decoderInstPtr); | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::DestructDecoderSafe() | ||||
| { | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMAMR::DestructDecoderSafe() { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcAmr_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -442,146 +319,114 @@ ACMAMR::DestructDecoderSafe() | ||||
|   _decoderInitialized = false; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetBitRateSafe(const WebRtc_Word32 rate) | ||||
| { | ||||
|     switch(rate) | ||||
|     { | ||||
|     case 4750: | ||||
| WebRtc_Word16 ACMAMR::SetBitRateSafe(const WebRtc_Word32 rate) { | ||||
|   switch (rate) { | ||||
|     case 4750: { | ||||
|       _encodingMode = WEBRTC_AMR_MR475; | ||||
|       _encodingRate = 4750; | ||||
|       break; | ||||
|     case 5150: | ||||
|     } | ||||
|     case 5150: { | ||||
|       _encodingMode = WEBRTC_AMR_MR515; | ||||
|       _encodingRate = 5150; | ||||
|       break; | ||||
|     case 5900: | ||||
|     } | ||||
|     case 5900: { | ||||
|       _encodingMode = WEBRTC_AMR_MR59; | ||||
|       _encodingRate = 5900; | ||||
|       break; | ||||
|     case 6700: | ||||
|     } | ||||
|     case 6700: { | ||||
|       _encodingMode = WEBRTC_AMR_MR67; | ||||
|       _encodingRate = 6700; | ||||
|       break; | ||||
|     case 7400: | ||||
|     } | ||||
|     case 7400: { | ||||
|       _encodingMode = WEBRTC_AMR_MR74; | ||||
|       _encodingRate = 7400; | ||||
|       break; | ||||
|     case 7950: | ||||
|     } | ||||
|     case 7950: { | ||||
|       _encodingMode = WEBRTC_AMR_MR795; | ||||
|       _encodingRate = 7950; | ||||
|       break; | ||||
|     case 10200: | ||||
|     } | ||||
|     case 10200: { | ||||
|       _encodingMode = WEBRTC_AMR_MR102; | ||||
|       _encodingRate = 10200; | ||||
|       break; | ||||
|     case 12200: | ||||
|     } | ||||
|     case 12200: { | ||||
|       _encodingMode = WEBRTC_AMR_MR122; | ||||
|       _encodingRate = 12200; | ||||
|       break; | ||||
|     default: | ||||
|     } | ||||
|     default: { | ||||
|       return -1; | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMAMR::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
| void ACMAMR::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   // Free the memory where ptrInst is pointing to | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
|         WebRtcAmr_FreeEnc((AMR_encinst_t_*)ptrInst); | ||||
|   if (ptrInst != NULL) { | ||||
|     WebRtcAmr_FreeEnc(reinterpret_cast<AMR_encinst_t_*>(ptrInst)); | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetAMREncoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) { | ||||
|   if ((packingFormat != AMRBandwidthEfficient) && | ||||
|       (packingFormat != AMROctetAlligned) && | ||||
|         (packingFormat != AMRFileStorage)) | ||||
|     { | ||||
|       (packingFormat != AMRFileStorage)) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "Invalid AMR Encoder packing-format."); | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         if(WebRtcAmr_EncodeBitmode(_encoderInstPtr, | ||||
|             packingFormat) < 0) | ||||
|         { | ||||
|   } else { | ||||
|     if (WebRtcAmr_EncodeBitmode(_encoderInstPtr, packingFormat) < 0) { | ||||
|       return -1; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|     } else { | ||||
|       _encoderPackingFormat = packingFormat; | ||||
|       return 0; | ||||
|     } | ||||
|  | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMR::AMREncoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMR::AMREncoderPackingFormat() const { | ||||
|   return _encoderPackingFormat; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::SetAMRDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) | ||||
| { | ||||
| WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) { | ||||
|   if ((packingFormat != AMRBandwidthEfficient) && | ||||
|       (packingFormat != AMROctetAlligned) && | ||||
|         (packingFormat != AMRFileStorage)) | ||||
|     { | ||||
|       (packingFormat != AMRFileStorage)) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "Invalid AMR decoder packing-format."); | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         if(WebRtcAmr_DecodeBitmode(_decoderInstPtr, | ||||
|             packingFormat) < 0) | ||||
|         { | ||||
|   } else { | ||||
|     if (WebRtcAmr_DecodeBitmode(_decoderInstPtr, packingFormat) < 0) { | ||||
|       return -1; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|     } else { | ||||
|       _decoderPackingFormat = packingFormat; | ||||
|       return 0; | ||||
|     } | ||||
|  | ||||
|   } | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMR::AMRDecoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMR::AMRDecoderPackingFormat() const { | ||||
|   return _decoderPackingFormat; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMAMR::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     netEq, | ||||
|     WebRtc_Word16 payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMR::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                               WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
|                  "Cannot unregister codec %s given payload-type %d does not " | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
| @@ -591,4 +436,3 @@ the stored payload type", | ||||
| #endif | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_AMR_H | ||||
| #define ACM_AMR_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMR_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMR_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -21,23 +21,19 @@ namespace webrtc { | ||||
|  | ||||
| enum ACMAMRPackingFormat; | ||||
|  | ||||
| class ACMAMR : public ACMGenericCodec | ||||
| { | ||||
| class ACMAMR: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMAMR(WebRtc_Word16 codecID); | ||||
|   ~ACMAMR(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream, | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|   WebRtc_Word16 SetAMREncoderPackingFormat( | ||||
|       const ACMAMRPackingFormat packingFormat); | ||||
| @@ -50,15 +46,12 @@ public: | ||||
|   ACMAMRPackingFormat AMRDecoderPackingFormat() const; | ||||
|  | ||||
|  protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio, | ||||
|         WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef, | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|   void DestructEncoderSafe(); | ||||
| @@ -69,18 +62,15 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
|  | ||||
|     WebRtc_Word16 SetBitRateSafe( | ||||
|         const WebRtc_Word32 rate); | ||||
|   WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate); | ||||
|  | ||||
|   WebRtc_Word16 EnableDTX(); | ||||
|  | ||||
|   WebRtc_Word16 DisableDTX(); | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ*     netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|   AMR_encinst_t_* _encoderInstPtr; | ||||
| @@ -93,4 +83,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_AMR_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMR_H_ | ||||
|   | ||||
| @@ -47,146 +47,100 @@ | ||||
| namespace webrtc { | ||||
|  | ||||
| #ifndef WEBRTC_CODEC_AMRWB | ||||
| ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codecID*/) | ||||
| { | ||||
| ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codecID*/) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMAMRwb::~ACMAMRwb() | ||||
| { | ||||
| ACMAMRwb::~ACMAMRwb() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* /* bitStream */, | ||||
|                                        WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                    WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                    WebRtc_Word16* /* audio */, | ||||
|                                    WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                    WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::EnableDTX() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::EnableDTX() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::DisableDTX() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::DisableDTX() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */)  | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMAMRwb::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */,  | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */, | ||||
|                                  const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMAMRwb::CreateInstance(void) | ||||
| { | ||||
| ACMAMRwb::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::DestructEncoderSafe() | ||||
| { | ||||
| void ACMAMRwb::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::DestructDecoderSafe() | ||||
| { | ||||
| void ACMAMRwb::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::SetBitRateSafe( | ||||
|     const WebRtc_Word32 /* rate */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::SetBitRateSafe(const WebRtc_Word32 /* rate */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMAMRwb::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::SetAMRwbEncoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMRwb::AMRwbEncoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMRwb::AMRwbEncoderPackingFormat() const { | ||||
|   return AMRUndefined; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat /* packingFormat */) | ||||
| { | ||||
|     ACMAMRPackingFormat /* packingFormat */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMRwb::AMRwbDecoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMRwb::AMRwbDecoderPackingFormat() const { | ||||
|   return AMRUndefined; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::UnregisterFromNetEqSafe( | ||||
| WebRtc_Word16 ACMAMRwb::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* /* netEq */, | ||||
|     WebRtc_Word16 /* payloadType */) | ||||
| { | ||||
|     WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| @@ -202,12 +156,11 @@ ACMAMRwb::UnregisterFromNetEqSafe( | ||||
| #define AMRWB_MODE_23k      7 | ||||
| #define AMRWB_MODE_24k      8 | ||||
|  | ||||
| ACMAMRwb::ACMAMRwb(WebRtc_Word16 codecID): | ||||
| _encoderInstPtr(NULL), | ||||
| ACMAMRwb::ACMAMRwb(WebRtc_Word16 codecID) | ||||
|     : _encoderInstPtr(NULL), | ||||
|       _decoderInstPtr(NULL), | ||||
|       _encodingMode(-1), // invalid value | ||||
| _encodingRate(0)        // invalid value | ||||
| { | ||||
|       _encodingRate(0) { // invalid value | ||||
|   _codecID = codecID; | ||||
|   _hasInternalDTX = true; | ||||
|   _encoderPackingFormat = AMRBandwidthEfficient; | ||||
| @@ -215,48 +168,40 @@ _encodingRate(0)        // invalid value | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMAMRwb::~ACMAMRwb() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| ACMAMRwb::~ACMAMRwb() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcAmrWb_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcAmrWb_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalEncode( | ||||
|     WebRtc_UWord8* bitStream,  | ||||
|     WebRtc_Word16* bitStreamLenByte) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitStream, | ||||
|                                        WebRtc_Word16* bitStreamLenByte) { | ||||
|   WebRtc_Word16 vadDecision = 1; | ||||
|   // sanity check, if the rate is set correctly. we might skip this | ||||
|   // sanity check. if rate is not set correctly, initialization flag | ||||
|   // should be false and should not be here. | ||||
|     if((_encodingMode < AMRWB_MODE_7k) || (_encodingMode > AMRWB_MODE_24k)) | ||||
|     { | ||||
|   if ((_encodingMode < AMRWB_MODE_7k) || (_encodingMode > AMRWB_MODE_24k)) { | ||||
|     *bitStreamLenByte = 0; | ||||
|     return -1; | ||||
|   } | ||||
|     *bitStreamLenByte =  | ||||
|         WebRtcAmrWb_Encode(_encoderInstPtr, &_inAudio[_inAudioIxRead], | ||||
|         _frameLenSmpl, (WebRtc_Word16*)bitStream, _encodingMode); | ||||
|   *bitStreamLenByte = WebRtcAmrWb_Encode(_encoderInstPtr, | ||||
|                                          &_inAudio[_inAudioIxRead], | ||||
|                                          _frameLenSmpl, | ||||
|                                          (WebRtc_Word16*) bitStream, | ||||
|                                          _encodingMode); | ||||
|  | ||||
|   // Update VAD, if internal DTX is used | ||||
|     if(_hasInternalDTX && _dtxEnabled) | ||||
|     { | ||||
|         if (*bitStreamLenByte <= (7*_frameLenSmpl/160)) | ||||
|         { | ||||
|   if (_hasInternalDTX && _dtxEnabled) { | ||||
|     if (*bitStreamLenByte <= (7 * _frameLenSmpl / 160)) { | ||||
|       vadDecision = 0; | ||||
|     } | ||||
|         for(WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) | ||||
|         { | ||||
|     for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) { | ||||
|       _vadLabel[n] = vadDecision; | ||||
|     } | ||||
|   } | ||||
| @@ -266,71 +211,48 @@ ACMAMRwb::InternalEncode( | ||||
|   return *bitStreamLenByte; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                    WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                    WebRtc_Word16* /* audio */, | ||||
|                                    WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                    WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::EnableDTX() | ||||
| { | ||||
|     if(_dtxEnabled) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMRwb::EnableDTX() { | ||||
|   if (_dtxEnabled) { | ||||
|     return 0; | ||||
|     } | ||||
|     else if(_encoderExist)  // check if encoder exist | ||||
|     { | ||||
|   } else if (_encoderExist) { // check if encoder exist | ||||
|     // enable DTX | ||||
|         if(WebRtcAmrWb_EncoderInit(_encoderInstPtr, 1) < 0) | ||||
|         { | ||||
|     if (WebRtcAmrWb_EncoderInit(_encoderInstPtr, 1) < 0) { | ||||
|       return -1; | ||||
|     } | ||||
|     _dtxEnabled = true; | ||||
|     return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     return -1; | ||||
|   } | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::DisableDTX() | ||||
| { | ||||
|     if(!_dtxEnabled) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMRwb::DisableDTX() { | ||||
|   if (!_dtxEnabled) { | ||||
|     return 0; | ||||
|     } | ||||
|     else if(_encoderExist)  // check if encoder exist | ||||
|     { | ||||
|   } else if (_encoderExist) { // check if encoder exist | ||||
|     // disable DTX | ||||
|         if(WebRtcAmrWb_EncoderInit(_encoderInstPtr, 0) < 0) | ||||
|         { | ||||
|     if (WebRtcAmrWb_EncoderInit(_encoderInstPtr, 0) < 0) { | ||||
|       return -1; | ||||
|     } | ||||
|     _dtxEnabled = false; | ||||
|     return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     // encoder doesn't exists, therefore disabling is harmless | ||||
|     return 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalInitEncoder(WebRtcACMCodecParams* codecParams) { | ||||
|   // sanity check | ||||
|     if (_encoderInstPtr == NULL) | ||||
|     { | ||||
|   if (_encoderInstPtr == NULL) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
| @@ -342,25 +264,17 @@ ACMAMRwb::InternalInitEncoder( | ||||
|   return (status < 0) ? -1 : 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
|     WebRtc_Word16 status = WebRtcAmrWb_DecodeBitmode( | ||||
|         _decoderInstPtr, _decoderPackingFormat); | ||||
| WebRtc_Word16 ACMAMRwb::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   WebRtc_Word16 status = WebRtcAmrWb_DecodeBitmode(_decoderInstPtr, | ||||
|                                                    _decoderPackingFormat); | ||||
|   status += ((WebRtcAmrWb_DecoderInit(_decoderInstPtr) < 0) ? -1 : 0); | ||||
|   return (status < 0) ? -1 : 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMAMRwb::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&  codecInst) | ||||
| { | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
|         // Todo: | ||||
|         // log error | ||||
| WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                  const CodecInst& codecInst) { | ||||
|   if (!_decoderInitialized) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
| @@ -368,29 +282,22 @@ ACMAMRwb::CodecDef( | ||||
|   // "SET_CODEC_PAR" & "SET_AMRWB_FUNCTION." | ||||
|   // Then call NetEQ to add the codec to it's | ||||
|   // database. | ||||
|     SET_CODEC_PAR((codecDef), kDecoderAMRWB, codecInst.pltype, | ||||
|         _decoderInstPtr, 16000); | ||||
|   SET_CODEC_PAR((codecDef), kDecoderAMRWB, codecInst.pltype, _decoderInstPtr, | ||||
|                 16000); | ||||
|   SET_AMRWB_FUNCTIONS((codecDef)); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMAMRwb::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMAMRwb::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalCreateEncoder() { | ||||
|   return WebRtcAmrWb_CreateEnc(&_encoderInstPtr); | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::DestructEncoderSafe() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMAMRwb::DestructEncoderSafe() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcAmrWb_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -401,18 +308,12 @@ ACMAMRwb::DestructEncoderSafe() | ||||
|   _encodingRate = 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::InternalCreateDecoder() { | ||||
|   return WebRtcAmrWb_CreateDec(&_decoderInstPtr); | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::DestructDecoderSafe() | ||||
| { | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMAMRwb::DestructDecoderSafe() { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcAmrWb_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -421,164 +322,118 @@ ACMAMRwb::DestructDecoderSafe() | ||||
|   _decoderInitialized = false; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::SetBitRateSafe( | ||||
|     const WebRtc_Word32 rate) | ||||
| { | ||||
|     switch(rate) | ||||
|     { | ||||
|     case 7000: | ||||
|         { | ||||
| WebRtc_Word16 ACMAMRwb::SetBitRateSafe(const WebRtc_Word32 rate) { | ||||
|   switch (rate) { | ||||
|     case 7000: { | ||||
|       _encodingMode = AMRWB_MODE_7k; | ||||
|       _encodingRate = 7000; | ||||
|       break; | ||||
|     } | ||||
|     case 9000: | ||||
|         { | ||||
|     case 9000: { | ||||
|       _encodingMode = AMRWB_MODE_9k; | ||||
|       _encodingRate = 9000; | ||||
|       break; | ||||
|     } | ||||
|     case 12000: | ||||
|         { | ||||
|     case 12000: { | ||||
|       _encodingMode = AMRWB_MODE_12k; | ||||
|       _encodingRate = 12000; | ||||
|       break; | ||||
|     } | ||||
|     case 14000: | ||||
|         { | ||||
|     case 14000: { | ||||
|       _encodingMode = AMRWB_MODE_14k; | ||||
|       _encodingRate = 14000; | ||||
|       break; | ||||
|     } | ||||
|     case 16000: | ||||
|         { | ||||
|     case 16000: { | ||||
|       _encodingMode = AMRWB_MODE_16k; | ||||
|       _encodingRate = 16000; | ||||
|       break; | ||||
|     } | ||||
|     case 18000: | ||||
|         { | ||||
|     case 18000: { | ||||
|       _encodingMode = AMRWB_MODE_18k; | ||||
|       _encodingRate = 18000; | ||||
|       break; | ||||
|     } | ||||
|     case 20000: | ||||
|         { | ||||
|     case 20000: { | ||||
|       _encodingMode = AMRWB_MODE_20k; | ||||
|       _encodingRate = 20000; | ||||
|       break; | ||||
|     } | ||||
|     case 23000: | ||||
|         { | ||||
|     case 23000: { | ||||
|       _encodingMode = AMRWB_MODE_23k; | ||||
|       _encodingRate = 23000; | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       _encodingMode = AMRWB_MODE_24k; | ||||
|       _encodingRate = 24000; | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMAMRwb::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
|         WebRtcAmrWb_FreeEnc((AMRWB_encinst_t_*)ptrInst); | ||||
| void ACMAMRwb::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   if (ptrInst != NULL) { | ||||
|     WebRtcAmrWb_FreeEnc(static_cast<AMRWB_encinst_t_*>(ptrInst)); | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::SetAMRwbEncoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) | ||||
| { | ||||
| WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) { | ||||
|   if ((packingFormat != AMRBandwidthEfficient) && | ||||
|       (packingFormat != AMROctetAlligned) && | ||||
|         (packingFormat != AMRFileStorage)) | ||||
|     { | ||||
|       (packingFormat != AMRFileStorage)) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "Invalid AMRwb encoder packing-format."); | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|          | ||||
|         if(WebRtcAmrWb_EncodeBitmode(_encoderInstPtr, | ||||
|             packingFormat) < 0) | ||||
|         { | ||||
|   } else { | ||||
|     if (WebRtcAmrWb_EncodeBitmode(_encoderInstPtr, packingFormat) < 0) { | ||||
|       return -1; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|     } else { | ||||
|       _encoderPackingFormat = packingFormat; | ||||
|       return 0; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMRwb::AMRwbEncoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMRwb::AMRwbEncoderPackingFormat() const { | ||||
|   return _encoderPackingFormat; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat( | ||||
|     ACMAMRPackingFormat packingFormat) | ||||
| { | ||||
|     ACMAMRPackingFormat packingFormat) { | ||||
|   if ((packingFormat != AMRBandwidthEfficient) && | ||||
|       (packingFormat != AMROctetAlligned) && | ||||
|         (packingFormat != AMRFileStorage)) | ||||
|     { | ||||
|       (packingFormat != AMRFileStorage)) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "Invalid AMRwb decoder packing-format."); | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         if(WebRtcAmrWb_DecodeBitmode(_decoderInstPtr, | ||||
|             packingFormat) < 0) | ||||
|         { | ||||
|   } else { | ||||
|     if (WebRtcAmrWb_DecodeBitmode(_decoderInstPtr, packingFormat) < 0) { | ||||
|       return -1; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|     } else { | ||||
|       _decoderPackingFormat = packingFormat; | ||||
|       return 0; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| ACMAMRPackingFormat | ||||
| ACMAMRwb::AMRwbDecoderPackingFormat() const | ||||
| { | ||||
| ACMAMRPackingFormat ACMAMRwb::AMRwbDecoderPackingFormat() const { | ||||
|   return _decoderPackingFormat; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMAMRwb::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     netEq, | ||||
|     WebRtc_Word16 payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
| WebRtc_Word16 ACMAMRwb::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                                 WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
|                  "Cannot unregister codec %s given payload-type %d does not" | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_AMRWB_H | ||||
| #define ACM_AMRWB_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMRWB_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMRWB_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -21,23 +21,19 @@ namespace webrtc { | ||||
|  | ||||
| enum ACMAMRPackingFormat; | ||||
|  | ||||
| class ACMAMRwb : public ACMGenericCodec | ||||
| { | ||||
| class ACMAMRwb: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMAMRwb(WebRtc_Word16 codecID); | ||||
|   ~ACMAMRwb(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream, | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams* codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams* codecParams); | ||||
|  | ||||
|   WebRtc_Word16 SetAMRwbEncoderPackingFormat( | ||||
|       const ACMAMRPackingFormat packingFormat); | ||||
| @@ -50,15 +46,12 @@ public: | ||||
|   ACMAMRPackingFormat AMRwbDecoderPackingFormat() const; | ||||
|  | ||||
|  protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio, | ||||
|         WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef,  | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|   void DestructEncoderSafe(); | ||||
| @@ -69,18 +62,15 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
|  | ||||
|     WebRtc_Word16 SetBitRateSafe( | ||||
|         const WebRtc_Word32 rate); | ||||
|   WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate); | ||||
|  | ||||
|   WebRtc_Word16 EnableDTX(); | ||||
|  | ||||
|   WebRtc_Word16 DisableDTX(); | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ* netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|   AMRWB_encinst_t_* _encoderInstPtr; | ||||
| @@ -94,4 +84,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_AMRWB_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMRWB_H_ | ||||
|   | ||||
| @@ -17,11 +17,9 @@ | ||||
| #include "webrtc_neteq.h" | ||||
| #include "webrtc_neteq_help_macros.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| ACMCNG::ACMCNG(WebRtc_Word16 codecID) | ||||
| { | ||||
| ACMCNG::ACMCNG(WebRtc_Word16 codecID) { | ||||
|   _encoderInstPtr = NULL; | ||||
|   _decoderInstPtr = NULL; | ||||
|   _codecID = codecID; | ||||
| @@ -29,74 +27,52 @@ ACMCNG::ACMCNG(WebRtc_Word16 codecID) | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMCNG::~ACMCNG() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| ACMCNG::~ACMCNG() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcCng_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcCng_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| // CNG is not like a regular encoder, this function | ||||
| // should not be called normally | ||||
| // instead the following function is called from inside | ||||
| // ACMGenericCodec::ProcessFrameVADDTX | ||||
| WebRtc_Word16 | ||||
| ACMCNG::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
| WebRtc_Word16 ACMCNG::InternalEncode(WebRtc_UWord8* /* bitStream */, | ||||
|                                      WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMCNG::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMCNG::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                  WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                  WebRtc_Word16* /* audio */, | ||||
|                                  WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                  WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| // CNG is not like a regular encoder, | ||||
| // this function should not be called normally | ||||
| // instead the following function is called from inside | ||||
| // ACMGenericCodec::ProcessFrameVADDTX | ||||
| WebRtc_Word16 | ||||
| ACMCNG::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMCNG::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMCNG::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMCNG::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return WebRtcCng_InitDec(_decoderInstPtr); | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMCNG::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&      codecInst) | ||||
| { | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
| WebRtc_Word32 ACMCNG::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                const CodecInst& codecInst) { | ||||
|   if (!_decoderInitialized) { | ||||
|     // TODO (tlegrand): log error | ||||
|     return -1; | ||||
|   } | ||||
| @@ -105,46 +81,31 @@ ACMCNG::CodecDef( | ||||
|   // Then return the structure back to NetEQ to add the codec to it's | ||||
|   // database. | ||||
|  | ||||
|     if (_sampFreqHz == 8000 || _sampFreqHz == 16000 || _sampFreqHz == 32000) | ||||
|     { | ||||
|   if (_sampFreqHz == 8000 || _sampFreqHz == 16000 || _sampFreqHz == 32000) { | ||||
|     SET_CODEC_PAR((codecDef), kDecoderCNG, codecInst.pltype, | ||||
|         _decoderInstPtr, _sampFreqHz); | ||||
|     SET_CNG_FUNCTIONS((codecDef)); | ||||
|     return 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     return -1; | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* ACMCNG::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMCNG::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMCNG::InternalCreateEncoder() | ||||
| { | ||||
|     if(WebRtcCng_CreateEnc(&_encoderInstPtr) < 0) | ||||
|     { | ||||
| WebRtc_Word16 ACMCNG::InternalCreateEncoder() { | ||||
|   if (WebRtcCng_CreateEnc(&_encoderInstPtr) < 0) { | ||||
|     _encoderInstPtr = NULL; | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     return 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| ACMCNG::DestructEncoderSafe() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMCNG::DestructEncoderSafe() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     WebRtcCng_FreeEnc(_encoderInstPtr); | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -152,27 +113,17 @@ ACMCNG::DestructEncoderSafe() | ||||
|   _encoderInitialized = false; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMCNG::InternalCreateDecoder() | ||||
| { | ||||
|     if(WebRtcCng_CreateDec(&_decoderInstPtr) < 0) | ||||
|     { | ||||
| WebRtc_Word16 ACMCNG::InternalCreateDecoder() { | ||||
|   if (WebRtcCng_CreateDec(&_decoderInstPtr) < 0) { | ||||
|     _decoderInstPtr = NULL; | ||||
|     return -1; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     return 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| ACMCNG::DestructDecoderSafe() | ||||
| { | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
| void ACMCNG::DestructDecoderSafe() { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     WebRtcCng_FreeDec(_decoderInstPtr); | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -180,30 +131,23 @@ ACMCNG::DestructDecoderSafe() | ||||
|   _decoderInitialized = false; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| ACMCNG::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
|         WebRtcCng_FreeEnc((CNG_enc_inst*)ptrInst); | ||||
| void ACMCNG::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   if (ptrInst != NULL) { | ||||
|     WebRtcCng_FreeEnc(static_cast<CNG_enc_inst*>(ptrInst)); | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMCNG::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     netEq, | ||||
|     WebRtc_Word16 payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type", | ||||
|             _decoderParams.codecInstant.plname, | ||||
|             payloadType, | ||||
| WebRtc_Word16 ACMCNG::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                               WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE( | ||||
|                  webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioCoding, | ||||
|                  _uniqueID, | ||||
|                  "Cannot unregister codec %s given payload-type %d does not " | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|   | ||||
| @@ -8,47 +8,38 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_CNG_H | ||||
| #define ACM_CNG_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CNG_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CNG_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
|  | ||||
| // forward declaration | ||||
| struct WebRtcCngEncInst; | ||||
| struct WebRtcCngDecInst; | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| class ACMCNG : public ACMGenericCodec | ||||
| { | ||||
| class ACMCNG: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMCNG(WebRtc_Word16 codecID); | ||||
|   ~ACMCNG(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream, | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
| protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio, | ||||
|         WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef, | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|   void DestructEncoderSafe(); | ||||
| @@ -59,21 +50,17 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
|  | ||||
|     WebRtc_Word16 EnableDTX() | ||||
|     { | ||||
|   WebRtc_Word16 EnableDTX() { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|     WebRtc_Word16 DisableDTX() | ||||
|     { | ||||
|   WebRtc_Word16 DisableDTX() { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ*     netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|   WebRtcCngEncInst* _encoderInstPtr; | ||||
| @@ -83,5 +70,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_CNG_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CNG_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef WEBRTC_ACM_COMMON_DEFS_H | ||||
| #define WEBRTC_ACM_COMMON_DEFS_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_ | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
| @@ -18,7 +18,6 @@ | ||||
| #include "engine_configurations.h" | ||||
| #include "typedefs.h" | ||||
|  | ||||
|  | ||||
| // Checks for enabled codecs, we prevent enabling codecs which are not | ||||
| // compatible. | ||||
| #if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX)) | ||||
| @@ -33,8 +32,7 @@ | ||||
| #define STR_CASE_CMP(x,y) ::strcasecmp(x,y) | ||||
| #endif | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| // 60 ms is the maximum block size we support. An extra 20 ms is considered | ||||
| // for safety if process() method is not called when it should be, i.e. we | ||||
| @@ -46,16 +44,16 @@ namespace webrtc | ||||
| // audio if the sampling frequency is 8000 Hz (80 samples per block). | ||||
| // Therefore, The size of the buffer where we keep timestamps | ||||
| // is defined as follows | ||||
| #define TIMESTAMP_BUFFER_SIZE_W32  AUDIO_BUFFER_SIZE_W16/80  | ||||
| #define TIMESTAMP_BUFFER_SIZE_W32  (AUDIO_BUFFER_SIZE_W16/80) | ||||
|  | ||||
| // The maximum size of a payload, that is 60 ms of PCM-16 @ 32 kHz stereo | ||||
| #define MAX_PAYLOAD_SIZE_BYTE   7680 | ||||
|  | ||||
| // General codec specific defines | ||||
| #define ISACWB_DEFAULT_RATE 32000 | ||||
| #define ISACSWB_DEFAULT_RATE 56000 | ||||
| #define ISACWB_PAC_SIZE 480 | ||||
| #define ISACSWB_PAC_SIZE 960 | ||||
| const int kIsacWbDefaultRate = 32000; | ||||
| const int kIsacSwbDefaultRate = 56000; | ||||
| const int kIsacPacSize480 = 480; | ||||
| const int kIsacPacSize960 = 960; | ||||
|  | ||||
| // An encoded bit-stream is labeled by one of the following enumerators. | ||||
| // | ||||
| @@ -66,8 +64,7 @@ namespace webrtc | ||||
| //   kPassiveDTXWB            : Passive audio frame coded by wide-band CN. | ||||
| //   kPassiveDTXSWB           : Passive audio frame coded by super-wide-band CN. | ||||
| // | ||||
| enum WebRtcACMEncodingType | ||||
| { | ||||
| enum WebRtcACMEncodingType { | ||||
|   kNoEncoding, | ||||
|   kActiveNormalEncoded, | ||||
|   kPassiveNormalEncoded, | ||||
| @@ -85,8 +82,7 @@ enum WebRtcACMEncodingType | ||||
| //   enableVAD               : set true to enable VAD. | ||||
| //   vadMode                 : VAD mode, c.f. audio_coding_module_typedefs.h | ||||
| //                             for possible values. | ||||
| struct WebRtcACMCodecParams | ||||
| { | ||||
| struct WebRtcACMCodecParams { | ||||
|   CodecInst codecInstant; | ||||
|   bool enableDTX; | ||||
|   bool enableVAD; | ||||
| @@ -104,8 +100,7 @@ struct WebRtcACMCodecParams | ||||
| //   lastTimestamp           : same as ACMGenericCodec::_lastTimestamp | ||||
| //   lastInTimestamp         : same as AudioCodingModuleImpl::_lastInTimestamp | ||||
| // | ||||
| struct WebRtcACMAudioBuff | ||||
| { | ||||
| struct WebRtcACMAudioBuff { | ||||
|   WebRtc_Word16 inAudio[AUDIO_BUFFER_SIZE_W16]; | ||||
|   WebRtc_Word16 inAudioIxRead; | ||||
|   WebRtc_Word16 inAudioIxWrite; | ||||
| @@ -117,4 +112,4 @@ struct WebRtcACMAudioBuff | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_ | ||||
|   | ||||
| @@ -8,56 +8,36 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "acm_dtmf_detection.h" | ||||
| #include "audio_coding_module_typedefs.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| ACMDTMFDetection::ACMDTMFDetection() | ||||
| { | ||||
| } | ||||
| ACMDTMFDetection::ACMDTMFDetection() {} | ||||
|  | ||||
| ACMDTMFDetection::~ACMDTMFDetection() {} | ||||
|  | ||||
| ACMDTMFDetection::~ACMDTMFDetection() | ||||
| { | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFDetection::Enable( | ||||
|     ACMCountries /* cpt */) | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFDetection::Enable(ACMCountries /* cpt */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFDetection::Disable() | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFDetection::Disable() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFDetection::Detect( | ||||
| WebRtc_Word16 ACMDTMFDetection::Detect( | ||||
|     const WebRtc_Word16* /* inAudioBuff */, | ||||
|     const WebRtc_UWord16 /* inBuffLenWord16 */, | ||||
|     const WebRtc_Word32 /* inFreqHz */, | ||||
|     bool& /* toneDetected */, | ||||
|     WebRtc_Word16&       /* tone            */) | ||||
| { | ||||
|     WebRtc_Word16& /* tone  */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFDetection::GetVersion( | ||||
| WebRtc_Word16 ACMDTMFDetection::GetVersion( | ||||
|     WebRtc_Word8* /* version */, | ||||
|     WebRtc_UWord32& /* remainingBufferInBytes */, | ||||
|     WebRtc_UWord32& /* position               */) | ||||
| { | ||||
|     WebRtc_UWord32& /* position */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -8,32 +8,28 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_DTMF_DETECTION_H | ||||
| #define ACM_DTMF_DETECTION_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_DETECTION_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_DETECTION_H_ | ||||
|  | ||||
| #include "acm_resampler.h" | ||||
| #include "audio_coding_module_typedefs.h" | ||||
| #include "typedefs.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| class ACMDTMFDetection | ||||
| { | ||||
| class ACMDTMFDetection { | ||||
|  public: | ||||
|   ACMDTMFDetection(); | ||||
|   ~ACMDTMFDetection(); | ||||
|   WebRtc_Word16 Enable(ACMCountries cpt = ACMDisableCountryDetection); | ||||
|   WebRtc_Word16 Disable(); | ||||
|     WebRtc_Word16 Detect( | ||||
|         const WebRtc_Word16* inAudioBuff, | ||||
|   WebRtc_Word16 Detect(const WebRtc_Word16* inAudioBuff, | ||||
|                        const WebRtc_UWord16 inBuffLenWord16, | ||||
|                        const WebRtc_Word32 inFreqHz, | ||||
|                        bool& toneDetected, | ||||
|                        WebRtc_Word16& tone); | ||||
|  | ||||
|     static WebRtc_Word16 GetVersion( | ||||
|         WebRtc_Word8*   version, | ||||
|   static WebRtc_Word16 GetVersion(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position); | ||||
|  | ||||
| @@ -44,4 +40,4 @@ private: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_DTMF_DETECTION_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_DETECTION_H_ | ||||
|   | ||||
| @@ -8,187 +8,125 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #include "acm_common_defs.h" | ||||
| #include "acm_dtmf_playout.h" | ||||
| #include "acm_common_defs.h" | ||||
| #include "acm_neteq.h" | ||||
| #include "trace.h" | ||||
| #include "webrtc_neteq.h" | ||||
| #include "webrtc_neteq_help_macros.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| #ifndef WEBRTC_CODEC_AVT | ||||
|  | ||||
| ACMDTMFPlayout::ACMDTMFPlayout( | ||||
|     WebRtc_Word16 /* codecID */) | ||||
| { | ||||
|     WebRtc_Word16 /* codecID */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMDTMFPlayout::~ACMDTMFPlayout() | ||||
| { | ||||
| ACMDTMFPlayout::~ACMDTMFPlayout() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalEncode( | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                          WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                          WebRtc_Word16* /* audio */, | ||||
|                                          WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                          WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMDTMFPlayout::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */,  | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */, | ||||
|                                        const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMDTMFPlayout::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMDTMFPlayout::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMDTMFPlayout::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMDTMFPlayout::DestructEncoderSafe() | ||||
| { | ||||
| void ACMDTMFPlayout::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMDTMFPlayout::DestructDecoderSafe() | ||||
| { | ||||
| void ACMDTMFPlayout::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::UnregisterFromNetEqSafe( | ||||
| WebRtc_Word16 ACMDTMFPlayout::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* /* netEq */, | ||||
|     WebRtc_Word16   /* payloadType */) | ||||
| { | ||||
|     WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| #else     //===================== Actual Implementation ======================= | ||||
|  | ||||
| ACMDTMFPlayout::ACMDTMFPlayout( | ||||
|     WebRtc_Word16 codecID) | ||||
| { | ||||
| ACMDTMFPlayout::ACMDTMFPlayout(WebRtc_Word16 codecID) { | ||||
|   _codecID = codecID; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMDTMFPlayout::~ACMDTMFPlayout() | ||||
| { | ||||
| ACMDTMFPlayout::~ACMDTMFPlayout() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalEncode( | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                          WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                          WebRtc_Word16* /* audio */, | ||||
|                                          WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                          WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   // This codec does not need initialization, | ||||
|   // DTMFPlayout has no instance | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   // This codec does not need initialization, | ||||
|   // DTMFPlayout has no instance | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMDTMFPlayout::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&  codecInst) | ||||
| { | ||||
| WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                        const CodecInst& codecInst) { | ||||
|   // Fill up the structure by calling | ||||
|   // "SET_CODEC_PAR" & "SET_AVT_FUNCTION." | ||||
|   // Then call NetEQ to add the codec to it's | ||||
| @@ -198,66 +136,45 @@ ACMDTMFPlayout::CodecDef( | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMDTMFPlayout::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMDTMFPlayout::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalCreateEncoder() { | ||||
|   // DTMFPlayout has no instance | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMDTMFPlayout::InternalCreateDecoder() { | ||||
|   // DTMFPlayout has no instance | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMDTMFPlayout::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   // DTMFPlayout has no instance | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMDTMFPlayout::DestructEncoderSafe() | ||||
| { | ||||
| void ACMDTMFPlayout::DestructEncoderSafe() { | ||||
|   // DTMFPlayout has no instance | ||||
|   return; | ||||
| } | ||||
|  | ||||
| void | ||||
| ACMDTMFPlayout::DestructDecoderSafe() | ||||
| { | ||||
| void ACMDTMFPlayout::DestructDecoderSafe() { | ||||
|   // DTMFPlayout has no instance | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMDTMFPlayout::UnregisterFromNetEqSafe( | ||||
| WebRtc_Word16 ACMDTMFPlayout::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* netEq, | ||||
|     WebRtc_Word16   payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,  | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
|     WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioCoding, | ||||
|                  _uniqueID, | ||||
|                  "Cannot unregister codec %s given payload-type %d does not " | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|   | ||||
| @@ -8,42 +8,34 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_DTMF_PLAYOUT_H | ||||
| #define ACM_DTMF_PLAYOUT_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_PLAYOUT_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_PLAYOUT_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| namespace webrtc | ||||
| { | ||||
| namespace webrtc { | ||||
|  | ||||
| class ACMDTMFPlayout : public ACMGenericCodec | ||||
| { | ||||
| class ACMDTMFPlayout: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMDTMFPlayout(WebRtc_Word16 codecID); | ||||
|   ~ACMDTMFPlayout(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream, | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|  protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio, | ||||
|         WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef,  | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|   void DestructEncoderSafe(); | ||||
| @@ -54,15 +46,12 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ* netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
| }; | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_DTMF_PLAYOUT_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_PLAYOUT_H_ | ||||
|   | ||||
| @@ -21,131 +21,81 @@ namespace webrtc { | ||||
|  | ||||
| #ifndef WEBRTC_CODEC_G722 | ||||
|  | ||||
| ACMG722::ACMG722( | ||||
|     WebRtc_Word16 /* codecID */) | ||||
| { | ||||
| ACMG722::ACMG722(WebRtc_Word16 /* codecID */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMG722::~ACMG722() | ||||
| { | ||||
| ACMG722::~ACMG722() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMG722::Add10MsDataSafe( | ||||
|     const WebRtc_UWord32 /* timestamp    */, | ||||
| WebRtc_Word32 ACMG722::Add10MsDataSafe(const WebRtc_UWord32 /* timestamp */, | ||||
|                                        const WebRtc_Word16* /* data */, | ||||
|                                        const WebRtc_UWord16 /* lengthSmpl */, | ||||
|     const WebRtc_UWord8  /* audioChannel */) | ||||
| { | ||||
|                                        const WebRtc_UWord8 /* audioChannel */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* /* bitStream */, | ||||
|                                       WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                   WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                   WebRtc_Word16* /* audio */, | ||||
|                                   WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                   WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMG722::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */,  | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */, | ||||
|                                 const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMG722::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMG722::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722::DestructEncoderSafe() | ||||
| { | ||||
| void ACMG722::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMG722::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::UnregisterFromNetEqSafe( | ||||
| WebRtc_Word16 ACMG722::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* /* netEq */, | ||||
|     WebRtc_Word16 /* payloadType */) | ||||
| { | ||||
|     WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| #else     //===================== Actual Implementation ======================= | ||||
|  | ||||
|  | ||||
| // Encoder and decoder memory | ||||
| struct ACMG722EncStr { | ||||
|   G722EncInst* inst; // instance for left channel in case of stereo | ||||
| @@ -156,20 +106,16 @@ struct ACMG722DecStr { | ||||
|   G722DecInst* instRight; // instance for right channel in case of stereo | ||||
| }; | ||||
|  | ||||
| ACMG722::ACMG722( | ||||
|     WebRtc_Word16 codecID) | ||||
| { | ||||
| ACMG722::ACMG722(WebRtc_Word16 codecID) { | ||||
|   // Encoder | ||||
|   _ptrEncStr = new ACMG722EncStr; | ||||
|     if(_ptrEncStr != NULL) | ||||
|     { | ||||
|   if (_ptrEncStr != NULL) { | ||||
|     _ptrEncStr->inst = NULL; | ||||
|     _ptrEncStr->instRight = NULL; | ||||
|   } | ||||
|   // Decoder | ||||
|   _ptrDecStr = new ACMG722DecStr; | ||||
|     if(_ptrDecStr != NULL) | ||||
|     { | ||||
|   if (_ptrDecStr != NULL) { | ||||
|     _ptrDecStr->inst = NULL; | ||||
|     _ptrDecStr->instRight = NULL; // Not used | ||||
|   } | ||||
| @@ -177,62 +123,46 @@ ACMG722::ACMG722( | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMG722::~ACMG722() | ||||
| { | ||||
|     if(_ptrEncStr != NULL) | ||||
|     { | ||||
|         if(_ptrEncStr->inst != NULL) | ||||
|         { | ||||
| ACMG722::~ACMG722() { | ||||
|   // Encoder | ||||
|   if (_ptrEncStr != NULL) { | ||||
|     if (_ptrEncStr->inst != NULL) { | ||||
|       WebRtcG722_FreeEncoder(_ptrEncStr->inst); | ||||
|       _ptrEncStr->inst = NULL; | ||||
|     } | ||||
|          | ||||
|         if(_ptrEncStr->instRight != NULL) | ||||
|         { | ||||
|     if (_ptrEncStr->instRight != NULL) { | ||||
|       WebRtcG722_FreeEncoder(_ptrEncStr->instRight); | ||||
|       _ptrEncStr->instRight = NULL; | ||||
|     } | ||||
|  | ||||
|     delete _ptrEncStr; | ||||
|     _ptrEncStr = NULL; | ||||
|   } | ||||
|     if(_ptrDecStr != NULL) | ||||
|     { | ||||
|         if(_ptrDecStr->inst != NULL) | ||||
|         { | ||||
|   // Decoder | ||||
|   if (_ptrDecStr != NULL) { | ||||
|     if (_ptrDecStr->inst != NULL) { | ||||
|       WebRtcG722_FreeDecoder(_ptrDecStr->inst); | ||||
|       _ptrDecStr->inst = NULL; | ||||
|     } | ||||
|         if(_ptrDecStr->instRight != NULL) | ||||
|         { | ||||
|     if (_ptrDecStr->instRight != NULL) { | ||||
|       WebRtcG722_FreeDecoder(_ptrDecStr->instRight); | ||||
|       _ptrDecStr->instRight = NULL; | ||||
|     } | ||||
|  | ||||
|     delete _ptrDecStr; | ||||
|     _ptrDecStr = NULL; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMG722::Add10MsDataSafe( | ||||
|     const WebRtc_UWord32 timestamp, | ||||
| WebRtc_Word32 ACMG722::Add10MsDataSafe(const WebRtc_UWord32 timestamp, | ||||
|                                        const WebRtc_Word16* data, | ||||
|                                        const WebRtc_UWord16 lengthSmpl, | ||||
|     const WebRtc_UWord8  audioChannel) | ||||
| { | ||||
|                                        const WebRtc_UWord8 audioChannel) { | ||||
|   return ACMGenericCodec::Add10MsDataSafe((timestamp >> 1), data, lengthSmpl, | ||||
|                                           audioChannel); | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalEncode( | ||||
|     WebRtc_UWord8* bitStream, | ||||
|     WebRtc_Word16* bitStreamLenByte) | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitStream, | ||||
|                                       WebRtc_Word16* bitStreamLenByte) { | ||||
|   // If stereo, split input signal in left and right channel before encoding | ||||
|   if (_noChannels == 2) { | ||||
|     WebRtc_Word16 leftChannel[960]; | ||||
| @@ -244,21 +174,22 @@ ACMG722::InternalEncode( | ||||
|       leftChannel[j] = _inAudio[_inAudioIxRead + i]; | ||||
|       rightChannel[j] = _inAudio[_inAudioIxRead + i + 1]; | ||||
|     } | ||||
|         lenInBytes = WebRtcG722_Encode(_encoderInstPtr, | ||||
|             leftChannel, _frameLenSmpl, (WebRtc_Word16*)outLeft); | ||||
|         lenInBytes += WebRtcG722_Encode(_encoderInstPtrRight, | ||||
|             rightChannel, _frameLenSmpl, (WebRtc_Word16*)outRight); | ||||
|     lenInBytes = WebRtcG722_Encode(_encoderInstPtr, leftChannel, _frameLenSmpl, | ||||
|                                    (WebRtc_Word16*) outLeft); | ||||
|     lenInBytes += WebRtcG722_Encode(_encoderInstPtrRight, rightChannel, | ||||
|                                     _frameLenSmpl, (WebRtc_Word16*) outRight); | ||||
|     *bitStreamLenByte = lenInBytes; | ||||
|  | ||||
|     // Interleave the 4 bits per sample from left and right channel | ||||
|         for (int i=0, j=0; i<lenInBytes; i+=2, j++) | ||||
|         { | ||||
|     for (int i = 0, j = 0; i < lenInBytes; i += 2, j++) { | ||||
|       bitStream[i] = (outRight[j] & 0xF0) + (outLeft[j] >> 4); | ||||
|       bitStream[i + 1] = ((outRight[j] & 0x0F) << 4) + (outLeft[j] & 0x0F); | ||||
|     } | ||||
|   } else { | ||||
|     *bitStreamLenByte = WebRtcG722_Encode(_encoderInstPtr, | ||||
|             &_inAudio[_inAudioIxRead], _frameLenSmpl, (WebRtc_Word16*)bitStream); | ||||
|                                           &_inAudio[_inAudioIxRead], | ||||
|                                           _frameLenSmpl, | ||||
|                                           (WebRtc_Word16*) bitStream); | ||||
|   } | ||||
|  | ||||
|   // increment the read index this tell the caller how far | ||||
| @@ -267,37 +198,25 @@ ACMG722::InternalEncode( | ||||
|   return *bitStreamLenByte; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */, | ||||
| WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                   WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                   WebRtc_Word16* /* audio */, | ||||
|                                   WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                   WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) | ||||
| { | ||||
|     if(codecParams->codecInstant.channels == 2)  | ||||
|     { | ||||
| WebRtc_Word16 ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codecParams) { | ||||
|   if (codecParams->codecInstant.channels == 2) { | ||||
|     // Create codec struct for right channel | ||||
|         if (_ptrEncStr->instRight == NULL) | ||||
|         { | ||||
|     if (_ptrEncStr->instRight == NULL) { | ||||
|       WebRtcG722_CreateEncoder(&_ptrEncStr->instRight); | ||||
|             if(_ptrEncStr->instRight == NULL) | ||||
|             { | ||||
|       if (_ptrEncStr->instRight == NULL) { | ||||
|         return -1; | ||||
|       } | ||||
|     } | ||||
|         _encoderInstPtrRight = (G722EncInst*)_ptrEncStr->instRight; | ||||
|         if (WebRtcG722_EncoderInit(_encoderInstPtrRight) < 0) | ||||
|         { | ||||
|     _encoderInstPtrRight = _ptrEncStr->instRight; | ||||
|     if (WebRtcG722_EncoderInit(_encoderInstPtrRight) < 0) { | ||||
|       return -1; | ||||
|     } | ||||
|   } | ||||
| @@ -305,22 +224,14 @@ ACMG722::InternalInitEncoder( | ||||
|   return WebRtcG722_EncoderInit(_encoderInstPtr); | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return WebRtcG722_DecoderInit(_decoderInstPtr); | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ACMG722::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&      codecInst) | ||||
| { | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
| WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                 const CodecInst& codecInst) { | ||||
|   if (!_decoderInitialized) { | ||||
|     // TODO: log error | ||||
|     return -1; | ||||
|   } | ||||
| @@ -328,61 +239,44 @@ ACMG722::CodecDef( | ||||
|   // "SET_CODEC_PAR" & "SET_G722_FUNCTION." | ||||
|   // Then call NetEQ to add the codec to it's | ||||
|   // database. | ||||
|     SET_CODEC_PAR((codecDef), kDecoderG722, codecInst.pltype,  | ||||
|         _decoderInstPtr, 16000); | ||||
|   SET_CODEC_PAR((codecDef), kDecoderG722, codecInst.pltype, _decoderInstPtr, | ||||
|                 16000); | ||||
|   SET_G722_FUNCTIONS((codecDef)); | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMG722::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMG722::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalCreateEncoder() | ||||
| { | ||||
|     if(_ptrEncStr == NULL) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722::InternalCreateEncoder() { | ||||
|   if (_ptrEncStr == NULL) { | ||||
|     // this structure must be created at the costructor | ||||
|     // if it is still NULL then there is a probelm and | ||||
|     // we dont continue | ||||
|     return -1; | ||||
|   } | ||||
|   WebRtcG722_CreateEncoder(&_ptrEncStr->inst); | ||||
|     if(_ptrEncStr->inst == NULL) | ||||
|     { | ||||
|   if (_ptrEncStr->inst == NULL) { | ||||
|     return -1; | ||||
|   } | ||||
|     _encoderInstPtr = (G722EncInst*)_ptrEncStr->inst; | ||||
|   _encoderInstPtr = _ptrEncStr->inst; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722::DestructEncoderSafe() | ||||
| { | ||||
|     if(_ptrEncStr != NULL) | ||||
|     { | ||||
|         if(_ptrEncStr->inst != NULL) | ||||
|         { | ||||
| void ACMG722::DestructEncoderSafe() { | ||||
|   if (_ptrEncStr != NULL) { | ||||
|     if (_ptrEncStr->inst != NULL) { | ||||
|       WebRtcG722_FreeEncoder(_ptrEncStr->inst); | ||||
|       _ptrEncStr->inst = NULL; | ||||
|     } | ||||
|   } | ||||
|   _encoderExist = false; | ||||
|   _encoderInitialized = false; | ||||
|  | ||||
| } | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::InternalCreateDecoder() | ||||
| { | ||||
|     if(_ptrDecStr == NULL) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722::InternalCreateDecoder() { | ||||
|   if (_ptrDecStr == NULL) { | ||||
|     // this structure must be created at the costructor | ||||
|     // if it is still NULL then there is a probelm and | ||||
|     // we dont continue | ||||
| @@ -390,54 +284,40 @@ ACMG722::InternalCreateDecoder() | ||||
|   } | ||||
|  | ||||
|   WebRtcG722_CreateDecoder(&_ptrDecStr->inst); | ||||
|     if(_ptrDecStr->inst == NULL) | ||||
|     { | ||||
|   if (_ptrDecStr->inst == NULL) { | ||||
|     return -1; | ||||
|   } | ||||
|     _decoderInstPtr = (G722DecInst*)_ptrDecStr->inst; | ||||
|   _decoderInstPtr = _ptrDecStr->inst; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void  | ||||
| ACMG722::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722::DestructDecoderSafe() { | ||||
|   _decoderExist = false; | ||||
|   _decoderInitialized = false; | ||||
|     if(_ptrDecStr != NULL) | ||||
|     { | ||||
|         if(_ptrDecStr->inst != NULL) | ||||
|         { | ||||
|   if (_ptrDecStr != NULL) { | ||||
|     if (_ptrDecStr->inst != NULL) { | ||||
|       WebRtcG722_FreeDecoder(_ptrDecStr->inst); | ||||
|       _ptrDecStr->inst = NULL; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
|         WebRtcG722_FreeEncoder((G722EncInst*)ptrInst); | ||||
| void ACMG722::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   if (ptrInst != NULL) { | ||||
|     WebRtcG722_FreeEncoder(static_cast<G722EncInst*>(ptrInst)); | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16 | ||||
| ACMG722::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* netEq, | ||||
|     WebRtc_Word16   payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,  | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
| WebRtc_Word16 ACMG722::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                                WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioCoding, | ||||
|                  _uniqueID, | ||||
|                  "Cannot unregister codec %s given payload-type %d does not " | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_G722_H | ||||
| #define ACM_G722_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -22,38 +22,30 @@ namespace webrtc { | ||||
| struct ACMG722EncStr; | ||||
| struct ACMG722DecStr; | ||||
|  | ||||
| class ACMG722 : public ACMGenericCodec | ||||
| { | ||||
| class ACMG722: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMG722(WebRtc_Word16 codecID); | ||||
|   ~ACMG722(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream, | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|  protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio, | ||||
|         WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef,  | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|     WebRtc_Word32 Add10MsDataSafe( | ||||
|         const WebRtc_UWord32 timestamp, | ||||
|   WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timestamp, | ||||
|                                 const WebRtc_Word16* data, | ||||
|                                 const WebRtc_UWord16 lengthSmpl, | ||||
|                                 const WebRtc_UWord8 audioChannel); | ||||
| @@ -66,11 +58,9 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ*     netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|   ACMG722EncStr* _ptrEncStr; | ||||
| @@ -83,4 +73,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_G722_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_H_ | ||||
|   | ||||
| @@ -88,117 +88,72 @@ namespace webrtc { | ||||
|  | ||||
| #ifndef WEBRTC_CODEC_G722_1 | ||||
|  | ||||
| ACMG722_1::ACMG722_1( | ||||
|     WebRtc_Word16 /* codecID */) | ||||
| { | ||||
| ACMG722_1::ACMG722_1(WebRtc_Word16 /* codecID */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMG722_1::~ACMG722_1() | ||||
| { | ||||
| ACMG722_1::~ACMG722_1() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* /* bitStream */, | ||||
|                                         WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
| WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitStream  */, | ||||
|                                     WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                     WebRtc_Word16* /* audio */, | ||||
|                                     WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                     WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMG722_1::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */,  | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef  */, | ||||
|                                   const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec*  | ||||
| ACMG722_1::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMG722_1::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::DestructEncoderSafe() | ||||
| { | ||||
| void ACMG722_1::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722_1::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMG722_1::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     /* netEq       */, | ||||
|     WebRtc_Word16 /* payloadType */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* /* netEq */,  WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| #else     //===================== Actual Implementation ======================= | ||||
|  | ||||
| ACMG722_1::ACMG722_1( | ||||
|     WebRtc_Word16 codecID): | ||||
|     _encoderInstPtr(NULL), | ||||
| @@ -212,91 +167,69 @@ _encoderInst32Ptr(NULL), | ||||
|     _encoderInst32PtrR(NULL), | ||||
|     _decoderInst16Ptr(NULL), | ||||
|     _decoderInst24Ptr(NULL), | ||||
| _decoderInst32Ptr(NULL) | ||||
| { | ||||
|     _decoderInst32Ptr(NULL) { | ||||
|   _codecID = codecID; | ||||
|     if(_codecID == ACMCodecDB::kG722_1_16) | ||||
|     { | ||||
|   if (_codecID == ACMCodecDB::kG722_1_16) { | ||||
|     _operationalRate = 16000; | ||||
|     } | ||||
|     else if(_codecID == ACMCodecDB::kG722_1_24) | ||||
|     { | ||||
|   } else if (_codecID == ACMCodecDB::kG722_1_24) { | ||||
|     _operationalRate = 24000; | ||||
|     } | ||||
|     else if(_codecID == ACMCodecDB::kG722_1_32) | ||||
|     {  | ||||
|   } else if (_codecID == ACMCodecDB::kG722_1_32) { | ||||
|     _operationalRate = 32000; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     _operationalRate = -1; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMG722_1::~ACMG722_1() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| ACMG722_1::~ACMG722_1() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     delete _encoderInstPtr; | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_encoderInstPtrRight != NULL) | ||||
|     {Inst | ||||
|   if (_encoderInstPtrRight != NULL) { | ||||
|     delete _encoderInstPtrRight; | ||||
|     _encoderInstPtrRight = NULL; | ||||
|   } | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     delete _decoderInstPtr; | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       _encoderInst16Ptr = NULL; | ||||
|       _encoderInst16PtrR = NULL; | ||||
|       _decoderInst16Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       _encoderInst24Ptr = NULL; | ||||
|       _encoderInst24PtrR = NULL; | ||||
|       _decoderInst24Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       _encoderInst32Ptr = NULL; | ||||
|       _encoderInst32PtrR = NULL; | ||||
|       _decoderInst32Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalEncode( | ||||
|     WebRtc_UWord8* bitStream,  | ||||
|     WebRtc_Word16* bitStreamLenByte) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* bitStream, | ||||
|                                         WebRtc_Word16* bitStreamLenByte) { | ||||
|   WebRtc_Word16 leftChannel[320]; | ||||
|   WebRtc_Word16 rightChannel[320]; | ||||
|   WebRtc_Word16 lenInBytes; | ||||
|   WebRtc_Word16 outB[160]; | ||||
|  | ||||
|   // If stereo, split input signal in left and right channel before encoding | ||||
|     if(_noChannels == 2)  | ||||
|     { | ||||
|   if (_noChannels == 2) { | ||||
|     for (int i = 0, j = 0; i < _frameLenSmpl * 2; i += 2, j++) { | ||||
|       leftChannel[j] = _inAudio[_inAudioIxRead + i]; | ||||
|       rightChannel[j] = _inAudio[_inAudioIxRead + i + 1]; | ||||
| @@ -305,47 +238,38 @@ ACMG722_1::InternalEncode( | ||||
|     memcpy(leftChannel, &_inAudio[_inAudioIxRead], 320); | ||||
|   } | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         {Inst | ||||
|             lenInBytes = WebRtcG7221_Encode16(_encoderInst16Ptr, | ||||
|                 leftChannel, 320, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221_Encode16(_encoderInst16PtrR, | ||||
|                     rightChannel, 320, &outB[lenInBytes/2]); | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       Inst lenInBytes = WebRtcG7221_Encode16(_encoderInst16Ptr, leftChannel, | ||||
|                                              320, &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221_Encode16(_encoderInst16PtrR, rightChannel, | ||||
|                                            320, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|             lenInBytes = WebRtcG7221_Encode24(_encoderInst24Ptr, | ||||
|                 leftChannel, 320, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221_Encode24(_encoderInst24PtrR, | ||||
|                     rightChannel, 320, &outB[lenInBytes/2]); | ||||
|     case 24000: { | ||||
|       lenInBytes = WebRtcG7221_Encode24(_encoderInst24Ptr, leftChannel, 320, | ||||
|                                         &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221_Encode24(_encoderInst24PtrR, rightChannel, | ||||
|                                            320, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|             lenInBytes = WebRtcG7221_Encode32(_encoderInst32Ptr, | ||||
|                 leftChannel, 320, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221_Encode32(_encoderInst32PtrR, | ||||
|                     rightChannel, 320, &outB[lenInBytes/2]); | ||||
|     case 32000: { | ||||
|       lenInBytes = WebRtcG7221_Encode32(_encoderInst32Ptr, leftChannel, 320, | ||||
|                                         &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221_Encode32(_encoderInst32PtrR, rightChannel, | ||||
|                                            320, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalInitEncode: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   memcpy(bitStream, outB, lenInBytes); | ||||
| @@ -357,208 +281,152 @@ ACMG722_1::InternalEncode( | ||||
|   return *bitStreamLenByte; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
| WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                     WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                     WebRtc_Word16* /* audio */, | ||||
|                                     WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                     WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) { | ||||
|   WebRtc_Word16 ret; | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       ret = WebRtcG7221_EncoderInit16(_encoderInst16PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221_EncoderInit16(_encoderInst16Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       ret = WebRtcG7221_EncoderInit24(_encoderInst24PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221_EncoderInit24(_encoderInst24Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       ret = WebRtcG7221_EncoderInit32(_encoderInst32PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221_EncoderInit32(_encoderInst32Ptr); | ||||
|             break; | ||||
|     } | ||||
|     default: | ||||
|         {  | ||||
|             WEBRTC_TRACE(webrtc::kTraceError,Inst webrtc::kTraceAudioCoding, _uniqueID, | ||||
| 				"InternalInitEncoder: Wrong rate for G722_1."); | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError,Inst webrtc::kTraceAudioCoding, | ||||
|                    _uniqueID, "InternalInitEncoder: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
| WebRtc_Word16 ACMG722_1::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       return WebRtcG7221_DecoderInit16(_decoderInst16Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       return WebRtcG7221_DecoderInit24(_decoderInst24Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       return WebRtcG7221_DecoderInit32(_decoderInst32Ptr); | ||||
|             break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalInitDecoder: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMG722_1::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&      codecInst) | ||||
| { | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
| WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                   const CodecInst& codecInst) { | ||||
|   if (!_decoderInitialized) { | ||||
|     // Todo: | ||||
|     // log error | ||||
|     return -1; | ||||
|   } | ||||
|   // NetEq has an array of pointers to WebRtcNetEQ_CodecDef. | ||||
|     // get an entry of that array (neteq wrapper will allocate memory) | ||||
|   // Get an entry of that array (neteq wrapper will allocate memory) | ||||
|   // by calling "netEq->CodecDef", where "NETEQ_CODEC_G722_1_XX" would | ||||
|   // be the index of the entry. | ||||
|   // Fill up the given structure by calling | ||||
|   // "SET_CODEC_PAR" & "SET_G722_1_XX_FUNCTION." | ||||
|   // Then return the structure back to NetEQ to add the codec to it's | ||||
|   // database. | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1_16, codecInst.pltype, | ||||
|           _decoderInst16Ptr, 16000); | ||||
|       SET_G722_1_16_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1_24, codecInst.pltype, | ||||
|           _decoderInst24Ptr, 16000); | ||||
|       SET_G722_1_24_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1_32, codecInst.pltype, | ||||
|           _decoderInst32Ptr, 16000); | ||||
|       SET_G722_1_32_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "CodecDef: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec*  | ||||
| ACMG722_1::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMG722_1::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalCreateEncoder() | ||||
| { | ||||
|     if((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722_1::InternalCreateEncoder() { | ||||
|   if ((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) { | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       WebRtcG7221_CreateEnc16(&_encoderInst16Ptr); | ||||
|       WebRtcG7221_CreateEnc16(&_encoderInst16PtrR); | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       WebRtcG7221_CreateEnc24(&_encoderInst24Ptr); | ||||
|       WebRtcG7221_CreateEnc24(&_encoderInst24PtrR); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       WebRtcG7221_CreateEnc32(&_encoderInst32Ptr); | ||||
|       WebRtcG7221_CreateEnc32(&_encoderInst32PtrR); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalCreateEncoder: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::DestructEncoderSafe() | ||||
| { | ||||
| void ACMG722_1::DestructEncoderSafe() { | ||||
|   _encoderExist = false; | ||||
|   _encoderInitialized = false; | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     delete _encoderInstPtr; | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_encoderInstPtrRight != NULL) | ||||
|     { | ||||
|   if (_encoderInstPtrRight != NULL) { | ||||
|     delete _encoderInstPtrRight; | ||||
|     _encoderInstPtrRight = NULL; | ||||
|   } | ||||
| @@ -567,50 +435,36 @@ ACMG722_1::DestructEncoderSafe() | ||||
|   _encoderInst32Ptr = NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::InternalCreateDecoder() | ||||
| { | ||||
|    if(_decoderInstPtr == NULL) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722_1::InternalCreateDecoder() { | ||||
|   if (_decoderInstPtr == NULL) { | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       WebRtcG7221_CreateDec16(&_decoderInst16Ptr); | ||||
|       break; | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       WebRtcG7221_CreateDec24(&_decoderInst24Ptr); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       WebRtcG7221_CreateDec32(&_decoderInst32Ptr); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalCreateDecoder: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722_1::DestructDecoderSafe() { | ||||
|   _decoderExist = false; | ||||
|   _decoderInitialized = false; | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     delete _decoderInstPtr; | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -619,50 +473,36 @@ ACMG722_1::DestructDecoderSafe() | ||||
|   _decoderInst32Ptr = NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
| void ACMG722_1::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   if (ptrInst != NULL) { | ||||
|     delete ptrInst; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     netEq, | ||||
|     WebRtc_Word16 payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,  | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
| WebRtc_Word16 ACMG722_1::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                                  WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioCoding, | ||||
|                  _uniqueID, | ||||
|                  "Cannot unregister codec %s given payload-type %d does not " | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 16000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 16000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1_16); | ||||
|     } | ||||
|     case 24000: | ||||
|         { | ||||
|     case 24000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1_24); | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1_32); | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "UnregisterFromNetEqSafe: Wrong rate for G722_1."); | ||||
|       return -1; | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_G722_1_H | ||||
| #define ACM_G722_1_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -24,34 +24,27 @@ struct G722_1_Inst_t_; | ||||
|  | ||||
| namespace webrtc { | ||||
|  | ||||
| class ACMG722_1 : public ACMGenericCodec | ||||
| { | ||||
| class ACMG722_1: public ACMGenericCodec { | ||||
|  public: | ||||
|   ACMG722_1(WebRtc_Word16 codecID); | ||||
|   ~ACMG722_1(); | ||||
|   // for FEC | ||||
|   ACMGenericCodec* CreateInstance(void); | ||||
|  | ||||
|     WebRtc_Word16 InternalEncode( | ||||
|         WebRtc_UWord8* bitstream,  | ||||
|   WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream, | ||||
|                                WebRtc_Word16* bitStreamLenByte); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitEncoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|     WebRtc_Word16 InternalInitDecoder( | ||||
|         WebRtcACMCodecParams *codecParams); | ||||
|   WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams); | ||||
|  | ||||
|  protected: | ||||
|     WebRtc_Word16 DecodeSafe( | ||||
|         WebRtc_UWord8* bitStream, | ||||
|   WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream, | ||||
|                            WebRtc_Word16 bitStreamLenByte, | ||||
|         WebRtc_Word16* audio,  | ||||
|         WebRtc_Word16* audioSamples,  | ||||
|                            WebRtc_Word16* audio, WebRtc_Word16* audioSamples, | ||||
|                            WebRtc_Word8* speechType); | ||||
|  | ||||
|     WebRtc_Word32 CodecDef( | ||||
|         WebRtcNetEQ_CodecDef& codecDef,  | ||||
|   WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                          const CodecInst& codecInst); | ||||
|  | ||||
|   void DestructEncoderSafe(); | ||||
| @@ -62,11 +55,9 @@ protected: | ||||
|  | ||||
|   WebRtc_Word16 InternalCreateDecoder(); | ||||
|  | ||||
|     void InternalDestructEncoderInst( | ||||
|         void* ptrInst); | ||||
|   void InternalDestructEncoderInst(void* ptrInst); | ||||
|  | ||||
|     WebRtc_Word16 UnregisterFromNetEqSafe( | ||||
|         ACMNetEQ*     netEq, | ||||
|   WebRtc_Word16 UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                         WebRtc_Word16 payloadType); | ||||
|  | ||||
|   WebRtc_Word32 _operationalRate; | ||||
| @@ -91,4 +82,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_G722_1_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_ | ||||
|   | ||||
| @@ -89,197 +89,128 @@ namespace webrtc { | ||||
| #ifndef WEBRTC_CODEC_G722_1C | ||||
|  | ||||
| ACMG722_1C::ACMG722_1C( | ||||
|     WebRtc_Word16 /* codecID */) | ||||
| { | ||||
|     WebRtc_Word16 /* codecID */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMG722_1C::~ACMG722_1C() | ||||
| { | ||||
| ACMG722_1C::~ACMG722_1C() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalEncode( | ||||
| WebRtc_Word16 ACMG722_1C::InternalEncode( | ||||
|     WebRtc_UWord8* /* bitStream */, | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) | ||||
| { | ||||
|     WebRtc_Word16* /* bitStreamLenByte */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
| WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|     WebRtc_Word16 /* bitStreamLenByte */, | ||||
|     WebRtc_Word16* /* audio */, | ||||
|     WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|     WebRtc_Word8* /* speechType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMG722_1C::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& /* codecDef  */,  | ||||
|     const CodecInst&      /* codecInst */) | ||||
| { | ||||
| WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */, | ||||
|     const CodecInst& /* codecInst */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec*  | ||||
| ACMG722_1C::CreateInstance(void) | ||||
| { | ||||
| ACMGenericCodec* ACMG722_1C::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalCreateEncoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalCreateEncoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::DestructEncoderSafe() | ||||
| { | ||||
| void ACMG722_1C::DestructEncoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalCreateDecoder() | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalCreateDecoder() { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722_1C::DestructDecoderSafe() { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::InternalDestructEncoderInst( | ||||
|     void* /* ptrInst */) | ||||
| { | ||||
| void ACMG722_1C::InternalDestructEncoderInst(void* /* ptrInst */) { | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::UnregisterFromNetEqSafe( | ||||
| WebRtc_Word16 ACMG722_1C::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ* /* netEq */, | ||||
|     WebRtc_Word16 /* payloadType */) | ||||
| { | ||||
|     WebRtc_Word16 /* payloadType */) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
|  | ||||
| #else     //===================== Actual Implementation ======================= | ||||
|  | ||||
| ACMG722_1C::ACMG722_1C( | ||||
|     WebRtc_Word16 codecID): | ||||
| _encoderInstPtr(NULL), | ||||
| _encoderInstPtrRight(NULL), | ||||
| _decoderInstPtr(NULL), | ||||
| _encoderInst24Ptr(NULL), | ||||
| _encoderInst24PtrR(NULL), | ||||
| _encoderInst32Ptr(NULL), | ||||
| _encoderInst32PtrR(NULL), | ||||
| _encoderInst48Ptr(NULL), | ||||
| _encoderInst48PtrR(NULL), | ||||
| _decoderInst24Ptr(NULL), | ||||
| _decoderInst32Ptr(NULL), | ||||
| _decoderInst48Ptr(NULL) | ||||
| {		 | ||||
| ACMG722_1C::ACMG722_1C(WebRtc_Word16 codecID) : | ||||
|   _encoderInstPtr(NULL), _encoderInstPtrRight(NULL), _decoderInstPtr(NULL), | ||||
|       _encoderInst24Ptr(NULL), _encoderInst24PtrR(NULL), _encoderInst32Ptr(NULL), | ||||
|       _encoderInst32PtrR(NULL), _encoderInst48Ptr(NULL), _encoderInst48PtrR(NULL), | ||||
|       _decoderInst24Ptr(NULL), _decoderInst32Ptr(NULL), _decoderInst48Ptr(NULL) { | ||||
|   _codecID = codecID; | ||||
|     if(_codecID == ACMCodecDB::kG722_1C_24) | ||||
|     { | ||||
|   if (_codecID == ACMCodecDB::kG722_1C_24) { | ||||
|     _operationalRate = 24000; | ||||
|     } | ||||
|     else if(_codecID == ACMCodecDB::kG722_1C_32) | ||||
|     { | ||||
|   } else if (_codecID == ACMCodecDB::kG722_1C_32) { | ||||
|     _operationalRate = 32000; | ||||
|     } | ||||
|     else if(_codecID == ACMCodecDB::kG722_1C_48) | ||||
|     {  | ||||
|   } else if (_codecID == ACMCodecDB::kG722_1C_48) { | ||||
|     _operationalRate = 48000; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|   } else { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "Wrong codec id for G722_1c."); | ||||
|  | ||||
|     _operationalRate = -1; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
| ACMG722_1C::~ACMG722_1C() | ||||
| { | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
| ACMG722_1C::~ACMG722_1C() { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     delete _encoderInstPtr; | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_encoderInstPtrRight != NULL) | ||||
|     { | ||||
|   if (_encoderInstPtrRight != NULL) { | ||||
|     delete _encoderInstPtrRight; | ||||
|     _encoderInstPtrRight = NULL; | ||||
|   } | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     delete _decoderInstPtr; | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       _encoderInst24Ptr = NULL; | ||||
|       _encoderInst24PtrR = NULL; | ||||
|       _decoderInst24Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       _encoderInst32Ptr = NULL; | ||||
|       _encoderInst32PtrR = NULL; | ||||
|       _decoderInst32Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       _encoderInst48Ptr = NULL; | ||||
|       _encoderInst48PtrR = NULL; | ||||
|       _decoderInst48Ptr = NULL; | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "Wrong rate for G722_1c."); | ||||
|       break; | ||||
| @@ -288,20 +219,15 @@ ACMG722_1C::~ACMG722_1C() | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalEncode( | ||||
|     WebRtc_UWord8* bitStream,  | ||||
|     WebRtc_Word16* bitStreamLenByte) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalEncode(WebRtc_UWord8* bitStream, | ||||
|                                          WebRtc_Word16* bitStreamLenByte) { | ||||
|   WebRtc_Word16 leftChannel[640]; | ||||
|   WebRtc_Word16 rightChannel[640]; | ||||
|   WebRtc_Word16 lenInBytes; | ||||
|   WebRtc_Word16 outB[240]; | ||||
|  | ||||
|   // If stereo, split input signal in left and right channel before encoding | ||||
|     if(_noChannels == 2)  | ||||
|     { | ||||
|   if (_noChannels == 2) { | ||||
|     for (int i = 0, j = 0; i < _frameLenSmpl * 2; i += 2, j++) { | ||||
|       leftChannel[j] = _inAudio[_inAudioIxRead + i]; | ||||
|       rightChannel[j] = _inAudio[_inAudioIxRead + i + 1]; | ||||
| @@ -310,47 +236,38 @@ ACMG722_1C::InternalEncode( | ||||
|     memcpy(leftChannel, &_inAudio[_inAudioIxRead], 640); | ||||
|   } | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|             lenInBytes = WebRtcG7221C_Encode24(_encoderInst24Ptr, | ||||
|                 leftChannel, 640, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221C_Encode24(_encoderInst24PtrR, | ||||
|                     rightChannel, 640, &outB[lenInBytes/2]); | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       lenInBytes = WebRtcG7221C_Encode24(_encoderInst24Ptr, leftChannel, 640, | ||||
|                                          &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221C_Encode24(_encoderInst24PtrR, rightChannel, | ||||
|                                             640, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|             lenInBytes = WebRtcG7221C_Encode32(_encoderInst32Ptr, | ||||
|                 leftChannel, 640, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221C_Encode32(_encoderInst32PtrR, | ||||
|                     rightChannel, 640, &outB[lenInBytes/2]); | ||||
|     case 32000: { | ||||
|       lenInBytes = WebRtcG7221C_Encode32(_encoderInst32Ptr, leftChannel, 640, | ||||
|                                          &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221C_Encode32(_encoderInst32PtrR, rightChannel, | ||||
|                                             640, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|             lenInBytes = WebRtcG7221C_Encode48(_encoderInst48Ptr, | ||||
|                 leftChannel, 640, &outB[0]); | ||||
|             if (_noChannels == 2)  | ||||
|             {                 | ||||
|                 lenInBytes += WebRtcG7221C_Encode48(_encoderInst48PtrR, | ||||
|                     rightChannel, 640, &outB[lenInBytes/2]); | ||||
|     case 48000: { | ||||
|       lenInBytes = WebRtcG7221C_Encode48(_encoderInst48Ptr, leftChannel, 640, | ||||
|                                          &outB[0]); | ||||
|       if (_noChannels == 2) { | ||||
|         lenInBytes += WebRtcG7221C_Encode48(_encoderInst48PtrR, rightChannel, | ||||
|                                             640, &outB[lenInBytes / 2]); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalEncode: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @@ -364,104 +281,72 @@ ACMG722_1C::InternalEncode( | ||||
|   return *bitStreamLenByte; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::DecodeSafe( | ||||
|     WebRtc_UWord8* /* bitStream        */,  | ||||
| WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitStream */, | ||||
|                                      WebRtc_Word16 /* bitStreamLenByte */, | ||||
|                                      WebRtc_Word16* /* audio */, | ||||
|                                      WebRtc_Word16* /* audioSamples */, | ||||
|     WebRtc_Word8*  /* speechType       */) | ||||
| { | ||||
|                                      WebRtc_Word8* /* speechType */) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) | ||||
| { | ||||
| WebRtc_Word16 ACMG722_1C::InternalInitEncoder( | ||||
|     WebRtcACMCodecParams* codecParams) { | ||||
|   WebRtc_Word16 ret; | ||||
|  | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       ret = WebRtcG7221C_EncoderInit24(_encoderInst24PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221C_EncoderInit24(_encoderInst24Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       ret = WebRtcG7221C_EncoderInit32(_encoderInst32PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221C_EncoderInit32(_encoderInst32Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       ret = WebRtcG7221C_EncoderInit48(_encoderInst48PtrR); | ||||
|       if (ret < 0) { | ||||
|         return ret; | ||||
|       } | ||||
|       return WebRtcG7221C_EncoderInit48(_encoderInst48Ptr); | ||||
|             break; | ||||
|     } | ||||
|     default: | ||||
|         {	 | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalInitEncode: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) | ||||
| { | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
| WebRtc_Word16 ACMG722_1C::InternalInitDecoder( | ||||
|     WebRtcACMCodecParams* /* codecParams */) { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       return WebRtcG7221C_DecoderInit24(_decoderInst24Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       return WebRtcG7221C_DecoderInit32(_decoderInst32Ptr); | ||||
|             break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       return WebRtcG7221C_DecoderInit48(_decoderInst48Ptr); | ||||
|             break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalInitDecoder: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& codecDef, | ||||
|                                    const CodecInst& codecInst) { | ||||
|  | ||||
| WebRtc_Word32  | ||||
| ACMG722_1C::CodecDef( | ||||
|     WebRtcNetEQ_CodecDef& codecDef, | ||||
|     const CodecInst&      codecInst) | ||||
| {	 | ||||
|  | ||||
|     if (!_decoderInitialized) | ||||
|     { | ||||
|   if (!_decoderInitialized) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "CodeDef: decoder not initialized for G722_1c"); | ||||
|     return -1; | ||||
| @@ -474,98 +359,76 @@ ACMG722_1C::CodecDef( | ||||
|   // "SET_CODEC_PAR" & "SET_G722_1_XX_FUNCTION." | ||||
|   // Then return the structure back to NetEQ to add the codec to it's | ||||
|   // database. | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         {		 | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1C_24, codecInst.pltype, | ||||
|           _decoderInst24Ptr, 32000); | ||||
|       SET_G722_1C_24_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1C_32, codecInst.pltype, | ||||
|           _decoderInst32Ptr, 32000); | ||||
|       SET_G722_1C_32_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     case 48000: | ||||
|         {		 | ||||
|     case 48000: { | ||||
|       SET_CODEC_PAR((codecDef), kDecoderG722_1C_32, codecInst.pltype, | ||||
|           _decoderInst48Ptr, 32000); | ||||
|       SET_G722_1C_48_FUNCTIONS((codecDef)); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         {		 | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "CodeDef: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| ACMGenericCodec* | ||||
| ACMG722_1C::CreateInstance(void) | ||||
| { | ||||
| ACMG722_1C::CreateInstance(void) { | ||||
|   return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalCreateEncoder() | ||||
| {	 | ||||
|     if((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722_1C::InternalCreateEncoder() { | ||||
|   if ((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) { | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       WebRtcG7221C_CreateEnc24(&_encoderInst24Ptr); | ||||
|       WebRtcG7221C_CreateEnc24(&_encoderInst24PtrR); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       WebRtcG7221C_CreateEnc32(&_encoderInst32Ptr); | ||||
|       WebRtcG7221C_CreateEnc32(&_encoderInst32PtrR); | ||||
|       break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       WebRtcG7221C_CreateEnc48(&_encoderInst48Ptr); | ||||
|       WebRtcG7221C_CreateEnc48(&_encoderInst48PtrR); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalCreateEncoder: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::DestructEncoderSafe() | ||||
| { | ||||
| void ACMG722_1C::DestructEncoderSafe() { | ||||
|   _encoderExist = false; | ||||
|   _encoderInitialized = false; | ||||
|     if(_encoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_encoderInstPtr != NULL) { | ||||
|     delete _encoderInstPtr; | ||||
|     _encoderInstPtr = NULL; | ||||
|   } | ||||
|     if(_encoderInstPtrRight != NULL) | ||||
|     { | ||||
|   if (_encoderInstPtrRight != NULL) { | ||||
|     delete _encoderInstPtrRight; | ||||
|     _encoderInstPtrRight = NULL; | ||||
|   } | ||||
| @@ -574,52 +437,38 @@ ACMG722_1C::DestructEncoderSafe() | ||||
|   _encoderInst48Ptr = NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::InternalCreateDecoder() | ||||
| {	 | ||||
|     if(_decoderInstPtr == NULL) | ||||
|     { | ||||
| WebRtc_Word16 ACMG722_1C::InternalCreateDecoder() { | ||||
|   if (_decoderInstPtr == NULL) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                  "InternalCreateEncoder: cannot create decoder"); | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       WebRtcG7221C_CreateDec24(&_decoderInst24Ptr); | ||||
|       break; | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       WebRtcG7221C_CreateDec32(&_decoderInst32Ptr); | ||||
|       break; | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       WebRtcG7221C_CreateDec48(&_decoderInst48Ptr); | ||||
|       break; | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                    "InternalCreateEncoder: Wrong rate for G722_1c."); | ||||
|       return -1; | ||||
|             break; | ||||
|     } | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::DestructDecoderSafe() | ||||
| { | ||||
| void ACMG722_1C::DestructDecoderSafe() { | ||||
|   _decoderExist = false; | ||||
|   _decoderInitialized = false; | ||||
|     if(_decoderInstPtr != NULL) | ||||
|     { | ||||
|   if (_decoderInstPtr != NULL) { | ||||
|     delete _decoderInstPtr; | ||||
|     _decoderInstPtr = NULL; | ||||
|   } | ||||
| @@ -628,53 +477,39 @@ ACMG722_1C::DestructDecoderSafe() | ||||
|   _decoderInst48Ptr = NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void  | ||||
| ACMG722_1C::InternalDestructEncoderInst( | ||||
|     void* ptrInst) | ||||
| { | ||||
|     if(ptrInst != NULL) | ||||
|     { | ||||
| void ACMG722_1C::InternalDestructEncoderInst(void* ptrInst) { | ||||
|   if (ptrInst != NULL) { | ||||
|     delete ptrInst; | ||||
|   } | ||||
|   return; | ||||
| } | ||||
|  | ||||
|  | ||||
| WebRtc_Word16  | ||||
| ACMG722_1C::UnregisterFromNetEqSafe( | ||||
|     ACMNetEQ*     netEq, | ||||
|     WebRtc_Word16 payloadType) | ||||
| { | ||||
|     if(payloadType != _decoderParams.codecInstant.pltype) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,  | ||||
|             "Cannot unregister codec %s given payload-type %d does not match \ | ||||
| the stored payload type",  | ||||
|             _decoderParams.codecInstant.plname,  | ||||
|             payloadType,  | ||||
| WebRtc_Word16 ACMG722_1C::UnregisterFromNetEqSafe(ACMNetEQ* netEq, | ||||
|                                                   WebRtc_Word16 payloadType) { | ||||
|   if (payloadType != _decoderParams.codecInstant.pltype) { | ||||
|     WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioCoding, | ||||
|                  _uniqueID, | ||||
|                  "Cannot unregister codec %s given payload-type %d does not" | ||||
|                  "match the stored payload type", | ||||
|                  _decoderParams.codecInstant.plname, payloadType, | ||||
|                  _decoderParams.codecInstant.pltype); | ||||
|     return -1; | ||||
|   } | ||||
|     switch(_operationalRate) | ||||
|     { | ||||
|     case 24000: | ||||
|         { | ||||
|   switch (_operationalRate) { | ||||
|     case 24000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1C_24); | ||||
|     } | ||||
|     case 32000: | ||||
|         { | ||||
|     case 32000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1C_32); | ||||
|     } | ||||
|     case 48000: | ||||
|         { | ||||
|     case 48000: { | ||||
|       return netEq->RemoveCodec(kDecoderG722_1C_48); | ||||
|     } | ||||
|     default: | ||||
|         { | ||||
|     default: { | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
| 				"Could not remove codec from NetEQ for G722_1c. \ | ||||
| Sampling frequency doesn't match"); | ||||
|                    "Could not remove codec from NetEQ for G722_1c." | ||||
|                    "Sampling frequency doesn't match"); | ||||
|       return -1; | ||||
|     } | ||||
|   } | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_G722_1C_H | ||||
| #define ACM_G722_1C_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -91,4 +91,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc; | ||||
|  | ||||
| #endif // ACM_G722_1C_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_G729_H | ||||
| #define ACM_G729_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -81,5 +81,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_G729_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_H_ | ||||
|   | ||||
| @@ -482,7 +482,6 @@ ACMG729_1::SetBitRateSafe( | ||||
|       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|         "SetBitRateSafe: Invalid rate G729_1"); | ||||
|             return -1; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_G729_1_H | ||||
| #define ACM_G729_1_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -82,5 +82,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_G729_1_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_ | ||||
|   | ||||
| @@ -34,8 +34,8 @@ enum | ||||
| // We set some of the variables to invalid values as a check point | ||||
| // if a proper initialization has happened. Another approach is | ||||
| // to initialize to a default codec that we are sure is always included. | ||||
| ACMGenericCodec::ACMGenericCodec(): | ||||
| _inAudioIxWrite(0), | ||||
| ACMGenericCodec::ACMGenericCodec() | ||||
|     : _inAudioIxWrite(0), | ||||
|       _inAudioIxRead(0), | ||||
|       _inTimestampIxWrite(0), | ||||
|       _inAudio(NULL), | ||||
| @@ -63,8 +63,7 @@ _codecWrapperLock(*RWLockWrapper::CreateRWLock()), | ||||
|       _lastEncodedTimestamp(0), | ||||
|       _lastTimestamp(0), | ||||
|       _isAudioBuffFresh(true), | ||||
| _uniqueID(0) | ||||
| { | ||||
|       _uniqueID(0) { | ||||
|   _lastTimestamp = 0xD87F3F9F; | ||||
|   //NullifyCodecInstance(); | ||||
| } | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_GENERIC_CODEC_H | ||||
| #define ACM_GENERIC_CODEC_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GENERIC_CODEC_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GENERIC_CODEC_H_ | ||||
|  | ||||
| #include "acm_common_defs.h" | ||||
| #include "audio_coding_module_typedefs.h" | ||||
| @@ -1256,7 +1256,6 @@ protected: | ||||
|     virtual void CurrentRate( | ||||
|         WebRtc_Word32& /* rateBitPerSec */) | ||||
|     { | ||||
|          | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -1330,4 +1329,4 @@ protected: | ||||
|  | ||||
| } // namespace webrt | ||||
|  | ||||
| #endif // ACM_GENERIC_CODEC_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GENERIC_CODEC_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_GSMFR_H | ||||
| #define ACM_GSMFR_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GSMFR_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GSMFR_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -74,5 +74,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_GSMFR_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GSMFR_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_ILBC_H | ||||
| #define ACM_ILBC_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ILBC_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ILBC_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -75,5 +75,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_ILBC_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ILBC_H_ | ||||
|   | ||||
| @@ -644,8 +644,8 @@ ACMISAC::InternalInitDecoder( | ||||
|     { | ||||
|         // Since we don't require a valid rate or a valid packet size when initializing | ||||
|         // the decoder, we set valid values before initializing encoder | ||||
|         codecParams->codecInstant.rate = ISACWB_DEFAULT_RATE; | ||||
|         codecParams->codecInstant.pacsize = ISACSWB_PAC_SIZE; | ||||
|         codecParams->codecInstant.rate = kIsacWbDefaultRate; | ||||
|         codecParams->codecInstant.pacsize = kIsacPacSize960; | ||||
|         if(InternalInitEncoder(codecParams) < 0) | ||||
|         { | ||||
|             return -1; | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_ISAC_H | ||||
| #define ACM_ISAC_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -150,4 +150,4 @@ protected: | ||||
|  | ||||
| } //namespace | ||||
|  | ||||
| #endif // ACM_ISAC_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_ISAC_MACROS_H | ||||
| #define ACM_ISAC_MACROS_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_MACROS_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_MACROS_H_ | ||||
|  | ||||
| #include "engine_configurations.h" | ||||
|  | ||||
| @@ -72,5 +72,5 @@ namespace webrtc | ||||
|  | ||||
| } //namespace | ||||
|  | ||||
| #endif // ACM_ISAC_MACROS_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_ISAC_MACROS_H_ | ||||
|  | ||||
|   | ||||
| @@ -413,7 +413,6 @@ ACMNetEQ::SetPlayoutMode( | ||||
|                 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id, | ||||
|                     "SetPlayoutMode: NetEq Error playout mode not recognized"); | ||||
|                 return -1; | ||||
|                 break; | ||||
|             } | ||||
|             if(WebRtcNetEQ_SetPlayoutMode(_inst[idx], playoutMode) < 0) | ||||
|             { | ||||
| @@ -1335,7 +1334,6 @@ ACMNetEQ::AddSlave( | ||||
|             WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id, | ||||
|                 "AddSlave: NetEq Error, playout mode not recognized"); | ||||
|             return -1; | ||||
|             break; | ||||
|         } | ||||
|         if(WebRtcNetEQ_SetPlayoutMode(_inst[slaveIdx], playoutMode) < 0) | ||||
|         { | ||||
| @@ -1365,4 +1363,3 @@ ACMNetEQ::NumSlaves() | ||||
| } | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_NETEQ_H | ||||
| #define ACM_NETEQ_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_NETEQ_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_NETEQ_H_ | ||||
|  | ||||
| #include "audio_coding_module.h" | ||||
| #include "audio_coding_module_typedefs.h" | ||||
| @@ -443,4 +443,4 @@ private: | ||||
|  | ||||
| } //namespace webrtc | ||||
|  | ||||
| #endif //ACM_NETEQ_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_NETEQ_H_ | ||||
|   | ||||
| @@ -459,7 +459,6 @@ ACMOPUS::SetBitRateSafe( | ||||
|             WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID, | ||||
|                 "SetBitRateSafe: Invalid rate Opus"); | ||||
|             return -1; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_OPUS_H | ||||
| #define ACM_OPUS_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_OPUS_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_OPUS_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -80,5 +80,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_OPUS_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_OPUS_H_ | ||||
|   | ||||
| @@ -313,17 +313,14 @@ the stored payload type", | ||||
|     case 8000: | ||||
|         { | ||||
|             return netEq->RemoveCodec(kDecoderPCM16B); | ||||
|             break; | ||||
|         } | ||||
|     case 16000: | ||||
|         { | ||||
|             return netEq->RemoveCodec(kDecoderPCM16Bwb); | ||||
|             break; | ||||
|         } | ||||
|     case 32000: | ||||
|         { | ||||
|             return netEq->RemoveCodec(kDecoderPCM16Bswb32kHz); | ||||
|             break; | ||||
|         } | ||||
|     default: | ||||
|         { | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_PCM16B_H | ||||
| #define ACM_PCM16B_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCM16B_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCM16B_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -66,5 +66,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_PCM16B_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCM16B_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_PCMA_H | ||||
| #define ACM_PCMA_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMA_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMA_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -64,5 +64,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_PCMA_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMA_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_PCMU_H | ||||
| #define ACM_PCMU_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMU_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMU_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -64,5 +64,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_PCMU_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_PCMU_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_RED_H | ||||
| #define ACM_RED_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RED_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RED_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -64,5 +64,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_RED_H | ||||
|  | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RED_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_RESAMPLER_H | ||||
| #define ACM_RESAMPLER_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RESAMPLER_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RESAMPLER_H_ | ||||
|  | ||||
| #include "resampler.h" | ||||
| #include "typedefs.h" | ||||
| @@ -44,4 +44,4 @@ private: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif //ACM_RESAMPLER_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_RESAMPLER_H_ | ||||
|   | ||||
| @@ -443,7 +443,6 @@ ACMSPEEX::CodecDef( | ||||
|             "Unsupported sampling frequency for Speex"); | ||||
|  | ||||
|             return -1; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -662,4 +661,3 @@ ACMSPEEX::SetComplMode( | ||||
| #endif | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef ACM_SPEEX_H | ||||
| #define ACM_SPEEX_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_SPEEX_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_SPEEX_H_ | ||||
|  | ||||
| #include "acm_generic_codec.h" | ||||
|  | ||||
| @@ -91,4 +91,4 @@ protected: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif // ACM_SPEEX_H | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_SPEEX_H_ | ||||
|   | ||||
| @@ -8,8 +8,8 @@ | ||||
|  *  be found in the AUTHORS file in the root of the source tree. | ||||
|  */ | ||||
|  | ||||
| #ifndef AUDIO_CODING_MODULE_IMPL_H | ||||
| #define AUDIO_CODING_MODULE_IMPL_H | ||||
| #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_AUDIO_CODING_MODULE_IMPL_H_ | ||||
| #define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_AUDIO_CODING_MODULE_IMPL_H_ | ||||
|  | ||||
| #include "acm_codec_database.h" | ||||
| #include "acm_neteq.h" | ||||
| @@ -397,4 +397,4 @@ private: | ||||
|  | ||||
| } // namespace webrtc | ||||
|  | ||||
| #endif | ||||
| #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_AUDIO_CODING_MODULE_IMPL_H_ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 tina.legrand@webrtc.org
					tina.legrand@webrtc.org