Reformatting ACM. All changes are bit-exact in this CL.
TEST=VoE auto-test, audio_coding_module_test;
only 15 ms of teststereo_out_1.pcm is not bit-exact with output file of the head revision
Review URL: https://webrtc-codereview.appspot.com/937035
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3287 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/interface/audio_coding_module.h b/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
index 2d38c3f..8679b36 100644
--- a/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
+++ b/webrtc/modules/audio_coding/main/interface/audio_coding_module.h
@@ -11,18 +11,20 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_INTERFACE_AUDIO_CODING_MODULE_H
-#include "audio_coding_module_typedefs.h"
-#include "module.h"
-// TODO(turajs): If possible, forward declare and remove the following include.
-#include "module_common_types.h"
-
+#include "webrtc/common_types.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/interface/module.h"
+#include "webrtc/typedefs.h"
namespace webrtc {
// forward declarations
struct CodecInst;
+struct WebRtcRTPHeader;
+class AudioFrame;
+class RTPFragmentationHeader;
-#define WEBRTC_10MS_PCM_AUDIO 960 // 16 bits super wideband 48 Khz
+#define WEBRTC_10MS_PCM_AUDIO 960 // 16 bits super wideband 48 kHz
// Callback class used for sending data ready to be packetized
class AudioPacketizationCallback {
@@ -30,8 +32,11 @@
virtual ~AudioPacketizationCallback() {}
virtual WebRtc_Word32 SendData(
- FrameType frameType, WebRtc_UWord8 payloadType, WebRtc_UWord32 timeStamp,
- const WebRtc_UWord8* payloadData, WebRtc_UWord16 payloadSize,
+ FrameType frame_type,
+ WebRtc_UWord8 payload_type,
+ WebRtc_UWord32 timestamp,
+ const WebRtc_UWord8* payload_data,
+ WebRtc_UWord16 payload_len_bytes,
const RTPFragmentationHeader* fragmentation) = 0;
};
@@ -40,7 +45,7 @@
public:
virtual ~AudioCodingFeedback() {}
- virtual WebRtc_Word32 IncomingDtmf(const WebRtc_UWord8 digitDtmf,
+ virtual WebRtc_Word32 IncomingDtmf(const WebRtc_UWord8 digit_dtmf,
const bool end) = 0;
};
@@ -96,17 +101,17 @@
// Get supported codec with list number.
//
// Input:
- // -listId : list number.
+ // -list_id : list number.
//
// Output:
// -codec : a structure where the parameters of the codec,
// given by list number is written to.
//
// Return value:
- // -1 if the list number (listId) is invalid.
+ // -1 if the list number (list_id) is invalid.
// 0 if succeeded.
//
- static WebRtc_Word32 Codec(const WebRtc_UWord8 listId, CodecInst& codec);
+ static WebRtc_Word32 Codec(const WebRtc_UWord8 list_id, CodecInst& codec);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 Codec()
@@ -124,7 +129,7 @@
// default parameters of the codec.
//
// Return value:
- // -1 if the list number (listId) is invalid.
+ // -1 if no codec matches the given parameters.
// 0 if succeeded.
//
static WebRtc_Word32 Codec(const char* payload_name, CodecInst& codec,
@@ -154,10 +159,10 @@
// Checks the validity of the parameters of the given codec.
//
// Input:
- // -codec : the structur which keeps the parameters of the
+ // -codec : the structure which keeps the parameters of the
// codec.
//
- // Reurn value:
+ // Return value:
// true if the parameters are valid,
// false if any parameter is not valid.
//
@@ -194,7 +199,7 @@
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterSendCodec()
- // Registers a codec, specified by "sendCodec," as sending codec.
+ // Registers a codec, specified by |send_codec|, as sending codec.
// This API can be called multiple of times to register Codec. The last codec
// registered overwrites the previous ones.
// The API can also be used to change payload type for CNG and RED, which are
@@ -211,7 +216,7 @@
// secondary encoder will be unregistered.
//
// Input:
- // -sendCodec : Parameters of the codec to be registered, c.f.
+ // -send_codec : Parameters of the codec to be registered, c.f.
// common_types.h for the definition of
// CodecInst.
//
@@ -219,7 +224,7 @@
// -1 if failed to initialize,
// 0 if succeeded.
//
- virtual WebRtc_Word32 RegisterSendCodec(const CodecInst& sendCodec) = 0;
+ virtual WebRtc_Word32 RegisterSendCodec(const CodecInst& send_codec) = 0;
///////////////////////////////////////////////////////////////////////////
// int RegisterSecondarySendCodec()
@@ -253,13 +258,13 @@
// Get parameters for the codec currently registered as send codec.
//
// Output:
- // -currentSendCodec : parameters of the send codec.
+ // -current_send_codec : parameters of the send codec.
//
// Return value:
// -1 if failed to get send codec,
// 0 if succeeded.
//
- virtual WebRtc_Word32 SendCodec(CodecInst& currentSendCodec) const = 0;
+ virtual WebRtc_Word32 SendCodec(CodecInst& current_send_codec) const = 0;
///////////////////////////////////////////////////////////////////////////
// int SecondarySendCodec()
@@ -336,7 +341,7 @@
// current encoder ACM will resample the audio.
//
// Input:
- // -audioFrame : the input audio frame, containing raw audio
+ // -audio_frame : the input audio frame, containing raw audio
// sampling frequency etc.,
// c.f. module_common_types.h for definition of
// AudioFrame.
@@ -347,7 +352,7 @@
// < -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& audio_frame) = 0;
///////////////////////////////////////////////////////////////////////////
// (FEC) Forward Error Correction
@@ -368,14 +373,14 @@
// This means that FEC is actually a RED scheme.
//
// Input:
- // -enableFEC : if true FEC is enabled, otherwise FEC is
+ // -enable_fec : if true FEC is enabled, otherwise FEC is
// disabled.
//
// Return value:
// -1 if failed to set FEC status,
// 0 if succeeded.
//
- virtual WebRtc_Word32 SetFECStatus(const bool enableFEC) = 0;
+ virtual WebRtc_Word32 SetFECStatus(const bool enable_fec) = 0;
///////////////////////////////////////////////////////////////////////////
// bool FECStatus()
@@ -394,7 +399,7 @@
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetVAD()
// If DTX is enabled & the codec does not have internal DTX/VAD
- // WebRtc VAD will be automatically enabled and 'enableVAD' is ignored.
+ // WebRtc VAD will be automatically enabled and |enable_vad| is ignored.
//
// If DTX is disabled but VAD is enabled no DTX packets are send,
// regardless of whether the codec has internal DTX/VAD or not. In this
@@ -403,11 +408,11 @@
// NOTE! VAD/DTX is not supported when sending stereo.
//
// Inputs:
- // -enableDTX : if true DTX is enabled,
+ // -enable_dtx : if true DTX is enabled,
// otherwise DTX is disabled.
- // -enableVAD : if true VAD is enabled,
+ // -enable_vad : if true VAD is enabled,
// otherwise VAD is disabled.
- // -vadMode : determines the aggressiveness of VAD. A more
+ // -vad_mode : determines the aggressiveness of VAD. A more
// aggressive mode results in more frames labeled
// as in-active, c.f. definition of
// ACMVADMode in audio_coding_module_typedefs.h
@@ -417,27 +422,27 @@
// -1 if failed to set up VAD/DTX,
// 0 if succeeded.
//
- virtual WebRtc_Word32 SetVAD(const bool enableDTX = true,
- const bool enableVAD = false,
- const ACMVADMode vadMode = VADNormal) = 0;
+ virtual WebRtc_Word32 SetVAD(const bool enable_dtx = true,
+ const bool enable_vad = false,
+ const ACMVADMode vad_mode = VADNormal) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 VAD()
// Get VAD status.
//
// Outputs:
- // -dtxEnabled : is set to true if DTX is enabled, otherwise
+ // -dtx_enabled : is set to true if DTX is enabled, otherwise
// is set to false.
- // -vadEnabled : is set to true if VAD is enabled, otherwise
+ // -vad_enabled : is set to true if VAD is enabled, otherwise
// is set to false.
- // -vadMode : is set to the current aggressiveness of VAD.
+ // -vad_mode : is set to the current aggressiveness of VAD.
//
// Return value:
// -1 if fails to retrieve the setting of DTX/VAD,
- // 0 if succeeeded.
+ // 0 if succeeded.
//
- virtual WebRtc_Word32 VAD(bool& dtxEnabled, bool& vadEnabled,
- ACMVADMode& vadMode) const = 0;
+ virtual WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled,
+ ACMVADMode& vad_mode) const = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ReplaceInternalDTXWithWebRtc()
@@ -445,7 +450,7 @@
// supported for G729, where this call replaces AnnexB with WebRtc DTX.
//
// Input:
- // -useWebRtcDTX : if false (default) the codec built-in DTX/VAD
+ // -use_webrtc_dtx : if false (default) the codec built-in DTX/VAD
// scheme is used, otherwise the internal DTX is
// replaced with WebRtc DTX/VAD.
//
@@ -454,7 +459,7 @@
// 0 if succeeded.
//
virtual WebRtc_Word32 ReplaceInternalDTXWithWebRtc(
- const bool useWebRtcDTX = false) = 0;
+ const bool use_webrtc_dtx = false) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 IsInternalDTXReplacedWithWebRtc()
@@ -462,7 +467,7 @@
// WebRtc DTX. This is only supported for G729.
//
// Output:
- // -usesWebRtcDTX : is set to true if the codec internal DTX is
+ // -uses_webrtc_dtx : is set to true if the codec internal DTX is
// replaced with WebRtc DTX/VAD, otherwise it is set
// to false.
//
@@ -471,7 +476,7 @@
// 0 if succeeded.
//
virtual WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(
- bool& usesWebRtcDTX) = 0;
+ bool& uses_webrtc_dtx) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterVADCallback()
@@ -481,13 +486,13 @@
// VAD is employed to identify a frame as active/inactive.
//
// Input:
- // -vadCallback : pointer to a callback function.
+ // -vad_callback : pointer to a callback function.
//
// Return value:
// -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* vad_callback) = 0;
///////////////////////////////////////////////////////////////////////////
// Receiver
@@ -544,7 +549,7 @@
// codecs, CNG-NB, CNG-WB, CNG-SWB, AVT and RED.
//
// Input:
- // -receiveCodec : parameters of the codec to be registered, c.f.
+ // -receive_codec : parameters of the codec to be registered, c.f.
// common_types.h for the definition of
// CodecInst.
//
@@ -552,7 +557,8 @@
// -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& receive_codec) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 UnregisterReceiveCodec()
@@ -560,22 +566,22 @@
// from the list of possible receive codecs.
//
// Input:
- // -payloadType : The number representing the payload type to
+ // -payload_type : The number representing the payload type to
// unregister.
//
// Output:
- // -1 if the unregistration fails.
+ // -1 if fails to unregister.
// 0 if the given codec is successfully unregistered.
//
virtual WebRtc_Word32 UnregisterReceiveCodec(
- const WebRtc_Word16 receiveCodec) = 0;
+ const WebRtc_Word16 payload_type) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ReceiveCodec()
// Get the codec associated with last received payload.
//
// Output:
- // -currRcvCodec : parameters of the codec associated with the last
+ // -curr_receive_codec : parameters of the codec associated with the last
// received payload, c.f. common_types.h for
// the definition of CodecInst.
//
@@ -583,25 +589,25 @@
// -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& curr_receive_codec) const = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 IncomingPacket()
// Call this function to insert a parsed RTP packet into ACM.
//
// Inputs:
- // -incomingPayload : received payload.
- // -payloadLengthByte : the length of payload in bytes.
- // -rtpInfo : the relevant information retrieved from RTP
+ // -incoming_payload : received payload.
+ // -payload_len_bytes : the length of payload in bytes.
+ // -rtp_info : the relevant information retrieved from RTP
// header.
//
// Return value:
// -1 if failed to push in the payload
// 0 if payload is successfully pushed in.
//
- virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPayload,
- const WebRtc_Word32 payloadLengthByte,
- const WebRtcRTPHeader& rtpInfo) = 0;
+ virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_payload,
+ const WebRtc_Word32 payload_len_bytes,
+ const WebRtcRTPHeader& rtp_info) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 IncomingPayload()
@@ -610,9 +616,9 @@
// pre-encoded files are pushed in ACM
//
// Inputs:
- // -incomingPayload : received payload.
- // -payloadLenghtByte : the length, in bytes, of the received payload.
- // -payloadType : the payload-type. This specifies which codec has
+ // -incoming_payload : received payload.
+ // -payload_len_byte : the length, in bytes, of the received payload.
+ // -payload_type : the payload-type. This specifies which codec has
// to be used to decode the payload.
// -timestamp : send timestamp of the payload. ACM starts with
// a random value and increment it by the
@@ -627,9 +633,9 @@
// -1 if failed to push in the payload
// 0 if payload is successfully pushed in.
//
- virtual WebRtc_Word32 IncomingPayload(const WebRtc_UWord8* incomingPayload,
- const WebRtc_Word32 payloadLengthByte,
- const WebRtc_UWord8 payloadType,
+ virtual WebRtc_Word32 IncomingPayload(const WebRtc_UWord8* incoming_payload,
+ const WebRtc_Word32 payload_len_byte,
+ const WebRtc_UWord8 payload_type,
const WebRtc_UWord32 timestamp = 0) = 0;
///////////////////////////////////////////////////////////////////////////
@@ -637,22 +643,22 @@
// Set Minimum playout delay, used for lip-sync.
//
// Input:
- // -timeMs : minimum delay in milliseconds.
+ // -time_ms : minimum delay in milliseconds.
//
// Return value:
// -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 time_ms) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterIncomingMessagesCallback()
// Used by the module to deliver messages to the codec module/application
- // when a Dtmf tone is detected, as well as when it stopped.
+ // when a DTMF tone is detected, as well as when it stopped.
//
// Inputs:
- // -inMsgCallback : pointer to callback function which will be called
- // if Dtmf is detected.
+ // -in_message_callback: pointer to callback function which will be called
+ // if DTMF is detected.
// -cpt : enables CPT (Call Progress Tone) detection for the
// specified country. c.f. definition of ACMCountries
// in audio_coding_module_typedefs.h for valid
@@ -665,20 +671,20 @@
//
virtual WebRtc_Word32
RegisterIncomingMessagesCallback(
- AudioCodingFeedback* inMsgCallback,
+ AudioCodingFeedback* in_message_callback,
const ACMCountries cpt = ACMDisableCountryDetection) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetDtmfPlayoutStatus()
- // Configure Dtmf playout, i.e. whether out-of-band
- // Dtmf tones are played or not.
+ // Configure DTMF playout, i.e. whether out-of-band
+ // DTMF tones are played or not.
//
// Input:
- // -enable : if true to enable playout out-of-band Dtmf tones,
+ // -enable : if true to enable playout out-of-band DTMF tones,
// false to disable.
//
// Return value:
- // -1 if the method fails, e.g. Dtmf playout is not supported.
+ // -1 if the method fails, e.g. DTMF playout is not supported.
// 0 if the status is set successfully.
//
virtual WebRtc_Word32 SetDtmfPlayoutStatus(const bool enable) = 0;
@@ -696,7 +702,7 @@
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetBackgroundNoiseMode()
// Sets the mode of the background noise playout in an event of long
- // packetloss burst. For the valid modes see the declaration of
+ // packet loss burst. For the valid modes see the declaration of
// ACMBackgroundNoiseMode in audio_coding_module_typedefs.h.
//
// Input:
@@ -712,7 +718,7 @@
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 BackgroundNoiseMode()
// Call this method to get the mode of the background noise playout.
- // Playout of background noise is a result of a long packetloss burst.
+ // Playout of background noise is a result of a long packet loss burst.
// See ACMBackgroundNoiseMode in audio_coding_module_typedefs.h for
// possible modes.
//
@@ -746,7 +752,7 @@
// Get the estimate of the Bandwidth, in bits/second, based on the incoming
// stream. This API is useful in one-way communication scenarios, where
// the bandwidth information is sent in an out-of-band fashion.
- // Currently only supported if iSAC is registered as a reciever.
+ // Currently only supported if iSAC is registered as a receiver.
//
// Return value:
// >0 bandwidth in bits/second.
@@ -762,7 +768,7 @@
// delay. In FAX mode, NetEQ is optimized to have few delay changes as
// possible and maintain a constant delay, perhaps large relative to voice
// mode, to avoid PLC. In streaming mode, we tolerate a little more delay
- // to acheive better jitter robustness.
+ // to achieve better jitter robustness.
//
// Input:
// -mode : playout mode. Possible inputs are:
@@ -786,7 +792,7 @@
// fax: a mode that is optimized for receiving FAX signals.
// In this mode NetEq tries to maintain a constant high
// delay to avoid PLC if possible.
- // streaming: a mode that is suitable for streaminq. In this mode we
+ // streaming: a mode that is suitable for streaming. In this mode we
// accept longer delay to improve jitter robustness.
//
virtual AudioPlayoutMode PlayoutMode() const = 0;
@@ -797,12 +803,12 @@
// frequency. ACM will perform a resampling if required.
//
// Input:
- // -desiredFreqHz : the desired sampling frequency, in Hertz, of the
+ // -desired_freq_hz : the desired sampling frequency, in Hertz, of the
// output audio. If set to -1, the function returns the
// audio at the current sampling frequency.
//
// Output:
- // -audioFrame : output audio frame which contains raw audio data
+ // -audio_frame : output audio frame which contains raw audio data
// and other relevant parameters, c.f.
// module_common_types.h for the definition of
// AudioFrame.
@@ -812,8 +818,8 @@
// 0 if the function succeeds.
//
virtual WebRtc_Word32
- PlayoutData10Ms(const WebRtc_Word32 desiredFreqHz,
- AudioFrame &audioFrame) = 0;
+ PlayoutData10Ms(const WebRtc_Word32 desired_freq_hz,
+ AudioFrame &audio_frame) = 0;
///////////////////////////////////////////////////////////////////////////
// (CNG) Comfort Noise Generation
@@ -855,43 +861,43 @@
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetISACMaxRate()
// Set the maximum instantaneous rate of iSAC. For a payload of B bits
- // with a frame-size of T sec the instantaneous rate is B/T bist per
- // second. Therefore, (B/T < maxRateBitPerSec) and
- // (B < maxPayloadLenBytes * 8) are always satisfied for iSAC payloads,
+ // with a frame-size of T sec the instantaneous rate is B/T bits per
+ // second. Therefore, (B/T < |max_rate_bps|) and
+ // (B < |max_payload_len_bytes| * 8) are always satisfied for iSAC payloads,
// c.f SetISACMaxPayloadSize().
//
// Input:
- // -maxRateBitPerSec : maximum instantaneous bit-rate given in bits/sec.
+ // -max_rate_bps : maximum instantaneous bit-rate given in bits/sec.
//
// Return value:
// -1 if failed to set the maximum rate.
// 0 if the maximum rate is set successfully.
//
virtual WebRtc_Word32 SetISACMaxRate(
- const WebRtc_UWord32 maxRateBitPerSec) = 0;
+ const WebRtc_UWord32 max_rate_bps) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetISACMaxPayloadSize()
// Set the maximum payload size of iSAC packets. No iSAC payload,
// regardless of its frame-size, may exceed the given limit. For
- // an iSAC payload of size B bits and frame-size T sec we have;
- // (B < maxPayloadLenBytes * 8) and (B/T < maxRateBitPerSec), c.f.
+ // an iSAC payload of size B bits and frame-size T seconds we have;
+ // (B < |max_payload_len_bytes| * 8) and (B/T < |max_rate_bps|), c.f.
// SetISACMaxRate().
//
// Input:
- // -maxPayloadLenBytes : maximum payload size in bytes.
+ // -max_payload_len_bytes : maximum payload size in bytes.
//
// Return value:
- // -1 if failed to set the maximm payload-size.
- // 0 if the given linit is seet successfully.
+ // -1 if failed to set the maximum payload-size.
+ // 0 if the given length is set successfully.
//
virtual WebRtc_Word32 SetISACMaxPayloadSize(
- const WebRtc_UWord16 maxPayloadLenBytes) = 0;
+ const WebRtc_UWord16 max_payload_len_bytes) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ConfigISACBandwidthEstimator()
// Call this function to configure the bandwidth estimator of ISAC.
- // During the adaptation of bit-rate, iSAC atomatically adjusts the
+ // During the adaptation of bit-rate, iSAC automatically adjusts the
// frame-size (either 30 or 60 ms) to save on RTP header. The initial
// frame-size can be specified by the first argument. The configuration also
// regards the initial estimate of bandwidths. The estimator starts from
@@ -900,22 +906,22 @@
// adaptation of frame-size. This is specified by the last parameter.
//
// Input:
- // -initFrameSizeMsec : initial frame-size in milisecods. For iSAC-wb
+ // -init_frame_size_ms : initial frame-size in milliseconds. For iSAC-wb
// 30 ms and 60 ms (default) are acceptable values,
// and for iSAC-swb 30 ms is the only acceptable
- // value. Zero indiates default value.
- // -initRateBitPerSec : initial estimate of the bandwidth. Values
+ // value. Zero indicates default value.
+ // -init_rate_bps : initial estimate of the bandwidth. Values
// between 10000 and 58000 are acceptable.
- // -enforceFrameSize : if true, the frame-size will not be adapted.
+ // -enforce_srame_size : if true, the frame-size will not be adapted.
//
// Return value:
// -1 if failed to configure the bandwidth estimator,
// 0 if the configuration was successfully applied.
//
virtual WebRtc_Word32 ConfigISACBandwidthEstimator(
- const WebRtc_UWord8 initFrameSizeMsec,
- const WebRtc_UWord16 initRateBitPerSec,
- const bool enforceFrameSize = false) = 0;
+ const WebRtc_UWord8 init_frame_size_ms,
+ const WebRtc_UWord16 init_rate_bps,
+ const bool enforce_frame_size = false) = 0;
///////////////////////////////////////////////////////////////////////////
// statistics
@@ -926,14 +932,14 @@
// Get network statistics.
//
// Input:
- // -networkStatistics : a structure that contains network statistics.
+ // -network_statistics : a structure that contains network statistics.
//
// Return value:
// -1 if failed to set the network statistics,
// 0 if statistics are set successfully.
//
virtual WebRtc_Word32 NetworkStatistics(
- ACMNetworkStatistics& networkStatistics) const = 0;
+ ACMNetworkStatistics& network_statistics) const = 0;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h b/webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h
index 1cb28f6..cc89151 100644
--- a/webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h
+++ b/webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/typedefs.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/main/source/acm_amr.cc b/webrtc/modules/audio_coding/main/source/acm_amr.cc
index 067e7f0..249fe7b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_amr.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_amr.cc
@@ -8,14 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_amr.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "audio_coding_module_typedefs.h"
-#include "rw_lock_wrapper.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_amr.h"
+
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_AMR
// NOTE! GSM AMR is not included in the open-source package. The following
@@ -25,23 +26,23 @@
//
// The API in the header file should match the one below.
//
-// int16_t WebRtcAmr_CreateEnc(AMR_encinst_t_** encInst);
-// int16_t WebRtcAmr_CreateDec(AMR_decinst_t_** decInst);
-// int16_t WebRtcAmr_FreeEnc(AMR_encinst_t_* encInst);
-// int16_t WebRtcAmr_FreeDec(AMR_decinst_t_* decInst);
-// int16_t WebRtcAmr_Encode(AMR_encinst_t_* encInst,
+// int16_t WebRtcAmr_CreateEnc(AMR_encinst_t_** enc_inst);
+// int16_t WebRtcAmr_CreateDec(AMR_decinst_t_** dec_inst);
+// int16_t WebRtcAmr_FreeEnc(AMR_encinst_t_* enc_inst);
+// int16_t WebRtcAmr_FreeDec(AMR_decinst_t_* dec_inst);
+// int16_t WebRtcAmr_Encode(AMR_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t*output,
// int16_t mode);
-// int16_t WebRtcAmr_EncoderInit(AMR_encinst_t_* encInst,
-// int16_t dtxMode);
-// int16_t WebRtcAmr_EncodeBitmode(AMR_encinst_t_* encInst,
+// int16_t WebRtcAmr_EncoderInit(AMR_encinst_t_* enc_inst,
+// int16_t dtx_mode);
+// int16_t WebRtcAmr_EncodeBitmode(AMR_encinst_t_* enc_inst,
// int format);
-// int16_t WebRtcAmr_Decode(AMR_decinst_t_* decInst);
-// int16_t WebRtcAmr_DecodePlc(AMR_decinst_t_* decInst);
-// int16_t WebRtcAmr_DecoderInit(AMR_decinst_t_* decInst);
-// int16_t WebRtcAmr_DecodeBitmode(AMR_decinst_t_* decInst,
+// int16_t WebRtcAmr_Decode(AMR_decinst_t_* dec_inst);
+// int16_t WebRtcAmr_DecodePlc(AMR_decinst_t_* dec_inst);
+// int16_t WebRtcAmr_DecoderInit(AMR_decinst_t_* dec_inst);
+// int16_t WebRtcAmr_DecodeBitmode(AMR_decinst_t_* dec_inst,
// int format);
#include "amr_interface.h"
#endif
@@ -49,13 +50,13 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_AMR
-ACMAMR::ACMAMR(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _encodingMode(-1), // Invalid value.
- _encodingRate(0), // Invalid value.
- _encoderPackingFormat(AMRBandwidthEfficient),
- _decoderPackingFormat(AMRBandwidthEfficient) {
+ACMAMR::ACMAMR(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoding_mode_(-1), // Invalid value.
+ encoding_rate_(0), // Invalid value.
+ encoder_packing_format_(AMRBandwidthEfficient),
+ decoder_packing_format_(AMRBandwidthEfficient) {
return;
}
@@ -63,16 +64,16 @@
return;
}
-WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
@@ -85,17 +86,17 @@
}
WebRtc_Word16 ACMAMR::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMAMR::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -123,12 +124,12 @@
return -1;
}
-void ACMAMR::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMAMR::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat(
- ACMAMRPackingFormat /* packingFormat */) {
+ ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@@ -137,7 +138,7 @@
}
WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat(
- ACMAMRPackingFormat /* packingFormat */) {
+ ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@@ -156,78 +157,78 @@
#define WEBRTC_AMR_MR102 6
#define WEBRTC_AMR_MR122 7
-ACMAMR::ACMAMR(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _encodingMode(-1), // invalid value
- _encodingRate(0) { // invalid value
- _codecID = codecID;
- _hasInternalDTX = true;
- _encoderPackingFormat = AMRBandwidthEfficient;
- _decoderPackingFormat = AMRBandwidthEfficient;
+ACMAMR::ACMAMR(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoding_mode_(-1), // invalid value
+ encoding_rate_(0) { // invalid value
+ codec_id_ = codec_id;
+ has_internal_dtx_ = true;
+ encoder_packing_format_ = AMRBandwidthEfficient;
+ decoder_packing_format_ = AMRBandwidthEfficient;
return;
}
ACMAMR::~ACMAMR() {
- if (_encoderInstPtr != NULL) {
- WebRtcAmr_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcAmr_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcAmr_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcAmr_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- WebRtc_Word16 vadDecision = 1;
+WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ WebRtc_Word16 vad_decision = 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)) {
- *bitStreamLenByte = 0;
+ if ((encoding_mode_ < WEBRTC_AMR_MR475) ||
+ (encoding_mode_ > WEBRTC_AMR_MR122)) {
+ *bitstream_len_byte = 0;
return -1;
}
- *bitStreamLenByte = WebRtcAmr_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- (WebRtc_Word16*) bitStream,
- _encodingMode);
+ *bitstream_len_byte = WebRtcAmr_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ (WebRtc_Word16*)bitstream,
+ encoding_mode_);
// Update VAD, if internal DTX is used
- if (_hasInternalDTX && _dtxEnabled) {
- if (*bitStreamLenByte <= (7 * _frameLenSmpl / 160)) {
- vadDecision = 0;
+ if (has_internal_dtx_ && dtx_enabled_) {
+ if (*bitstream_len_byte <= (7 * frame_len_smpl_ / 160)) {
+ vad_decision = 0;
}
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
- _vadLabel[n] = vadDecision;
+ vad_label_[n] = vad_decision;
}
}
// increment the read index
- _inAudioIxRead += _frameLenSmpl;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMAMR::EnableDTX() {
- if (_dtxEnabled) {
+ if (dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// enable DTX
- if (WebRtcAmr_EncoderInit(_encoderInstPtr, 1) < 0) {
+ if (WebRtcAmr_EncoderInit(encoder_inst_ptr_, 1) < 0) {
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
return 0;
} else {
return -1;
@@ -235,14 +236,14 @@
}
WebRtc_Word16 ACMAMR::DisableDTX() {
- if (!_dtxEnabled) {
+ if (!dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// disable DTX
- if (WebRtcAmr_EncoderInit(_encoderInstPtr, 0) < 0) {
+ if (WebRtcAmr_EncoderInit(encoder_inst_ptr_, 0) < 0) {
return -1;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -250,26 +251,26 @@
}
}
-WebRtc_Word16 ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
- WebRtc_Word16 status = SetBitRateSafe((codecParams->codecInstant).rate);
+WebRtc_Word16 ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
+ WebRtc_Word16 status = SetBitRateSafe((codec_params->codec_inst).rate);
status += (WebRtcAmr_EncoderInit(
- _encoderInstPtr, ((codecParams->enableDTX) ? 1 : 0)) < 0) ? -1 : 0;
+ encoder_inst_ptr_, ((codec_params->enable_dtx) ? 1 : 0)) < 0) ? -1 : 0;
status += (WebRtcAmr_EncodeBitmode(
- _encoderInstPtr, _encoderPackingFormat) < 0) ? -1 : 0;
+ encoder_inst_ptr_, encoder_packing_format_) < 0) ? -1 : 0;
return (status < 0) ? -1 : 0;
}
WebRtc_Word16 ACMAMR::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
WebRtc_Word16 status =
- ((WebRtcAmr_DecoderInit(_decoderInstPtr) < 0) ? -1 : 0);
- status += WebRtcAmr_DecodeBitmode(_decoderInstPtr, _decoderPackingFormat);
+ ((WebRtcAmr_DecoderInit(decoder_inst_ptr_) < 0) ? -1 : 0);
+ status += WebRtcAmr_DecodeBitmode(decoder_inst_ptr_, decoder_packing_format_);
return (status < 0) ? -1 : 0;
}
-WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
+WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
// Todo:
// log error
return -1;
@@ -278,9 +279,9 @@
// "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,
+ SET_CODEC_PAR((codec_def), kDecoderAMR, codec_inst.pltype, decoder_inst_ptr_,
8000);
- SET_AMR_FUNCTIONS((codecDef));
+ SET_AMR_FUNCTIONS((codec_def));
return 0;
}
@@ -289,75 +290,75 @@
}
WebRtc_Word16 ACMAMR::InternalCreateEncoder() {
- return WebRtcAmr_CreateEnc(&_encoderInstPtr);
+ return WebRtcAmr_CreateEnc(&encoder_inst_ptr_);
}
void ACMAMR::DestructEncoderSafe() {
- if (_encoderInstPtr != NULL) {
- WebRtcAmr_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcAmr_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
// there is no encoder set the following
- _encoderExist = false;
- _encoderInitialized = false;
- _encodingMode = -1; // invalid value
- _encodingRate = 0; // invalid value
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ encoding_mode_ = -1; // invalid value
+ encoding_rate_ = 0; // invalid value
}
WebRtc_Word16 ACMAMR::InternalCreateDecoder() {
- return WebRtcAmr_CreateDec(&_decoderInstPtr);
+ return WebRtcAmr_CreateDec(&decoder_inst_ptr_);
}
void ACMAMR::DestructDecoderSafe() {
- if (_decoderInstPtr != NULL) {
- WebRtcAmr_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcAmr_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
// there is no encoder instance set the followings
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
}
WebRtc_Word16 ACMAMR::SetBitRateSafe(const WebRtc_Word32 rate) {
switch (rate) {
case 4750: {
- _encodingMode = WEBRTC_AMR_MR475;
- _encodingRate = 4750;
+ encoding_mode_ = WEBRTC_AMR_MR475;
+ encoding_rate_ = 4750;
break;
}
case 5150: {
- _encodingMode = WEBRTC_AMR_MR515;
- _encodingRate = 5150;
+ encoding_mode_ = WEBRTC_AMR_MR515;
+ encoding_rate_ = 5150;
break;
}
case 5900: {
- _encodingMode = WEBRTC_AMR_MR59;
- _encodingRate = 5900;
+ encoding_mode_ = WEBRTC_AMR_MR59;
+ encoding_rate_ = 5900;
break;
}
case 6700: {
- _encodingMode = WEBRTC_AMR_MR67;
- _encodingRate = 6700;
+ encoding_mode_ = WEBRTC_AMR_MR67;
+ encoding_rate_ = 6700;
break;
}
case 7400: {
- _encodingMode = WEBRTC_AMR_MR74;
- _encodingRate = 7400;
+ encoding_mode_ = WEBRTC_AMR_MR74;
+ encoding_rate_ = 7400;
break;
}
case 7950: {
- _encodingMode = WEBRTC_AMR_MR795;
- _encodingRate = 7950;
+ encoding_mode_ = WEBRTC_AMR_MR795;
+ encoding_rate_ = 7950;
break;
}
case 10200: {
- _encodingMode = WEBRTC_AMR_MR102;
- _encodingRate = 10200;
+ encoding_mode_ = WEBRTC_AMR_MR102;
+ encoding_rate_ = 10200;
break;
}
case 12200: {
- _encodingMode = WEBRTC_AMR_MR122;
- _encodingRate = 12200;
+ encoding_mode_ = WEBRTC_AMR_MR122;
+ encoding_rate_ = 12200;
break;
}
default: {
@@ -367,58 +368,57 @@
return 0;
}
-void ACMAMR::InternalDestructEncoderInst(void* ptrInst) {
- // Free the memory where ptrInst is pointing to
- if (ptrInst != NULL) {
- WebRtcAmr_FreeEnc(reinterpret_cast<AMR_encinst_t_*>(ptrInst));
+void ACMAMR::InternalDestructEncoderInst(void* ptr_inst) {
+ // Free the memory where ptr_inst is pointing to
+ if (ptr_inst != NULL) {
+ WebRtcAmr_FreeEnc(reinterpret_cast<AMR_encinst_t_*>(ptr_inst));
}
return;
}
WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat(
- ACMAMRPackingFormat packingFormat) {
- if ((packingFormat != AMRBandwidthEfficient) &&
- (packingFormat != AMROctetAlligned) &&
- (packingFormat != AMRFileStorage)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ ACMAMRPackingFormat packing_format) {
+ if ((packing_format != AMRBandwidthEfficient) &&
+ (packing_format != AMROctetAlligned) &&
+ (packing_format != AMRFileStorage)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Invalid AMR Encoder packing-format.");
return -1;
} else {
- if (WebRtcAmr_EncodeBitmode(_encoderInstPtr, packingFormat) < 0) {
+ if (WebRtcAmr_EncodeBitmode(encoder_inst_ptr_, packing_format) < 0) {
return -1;
} else {
- _encoderPackingFormat = packingFormat;
+ encoder_packing_format_ = packing_format;
return 0;
}
}
}
ACMAMRPackingFormat ACMAMR::AMREncoderPackingFormat() const {
- return _encoderPackingFormat;
+ return encoder_packing_format_;
}
WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat(
- ACMAMRPackingFormat packingFormat) {
- if ((packingFormat != AMRBandwidthEfficient) &&
- (packingFormat != AMROctetAlligned) &&
- (packingFormat != AMRFileStorage)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ ACMAMRPackingFormat packing_format) {
+ if ((packing_format != AMRBandwidthEfficient) &&
+ (packing_format != AMROctetAlligned) &&
+ (packing_format != AMRFileStorage)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Invalid AMR decoder packing-format.");
return -1;
} else {
- if (WebRtcAmr_DecodeBitmode(_decoderInstPtr, packingFormat) < 0) {
+ if (WebRtcAmr_DecodeBitmode(decoder_inst_ptr_, packing_format) < 0) {
return -1;
} else {
- _decoderPackingFormat = packingFormat;
+ decoder_packing_format_ = packing_format;
return 0;
}
}
}
ACMAMRPackingFormat ACMAMR::AMRDecoderPackingFormat() const {
- return _decoderPackingFormat;
+ return decoder_packing_format_;
}
#endif
-
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_amr.h b/webrtc/modules/audio_coding/main/source/acm_amr.h
index d3c175c..ebff0bb 100644
--- a/webrtc/modules/audio_coding/main/source/acm_amr.h
+++ b/webrtc/modules/audio_coding/main/source/acm_amr.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct AMR_encinst_t_;
@@ -23,36 +23,37 @@
class ACMAMR: public ACMGenericCodec {
public:
- ACMAMR(WebRtc_Word16 codecID);
+ explicit ACMAMR(WebRtc_Word16 codec_id);
~ACMAMR();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 SetAMREncoderPackingFormat(
- const ACMAMRPackingFormat packingFormat);
+ const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMREncoderPackingFormat() const;
WebRtc_Word16 SetAMRDecoderPackingFormat(
- const ACMAMRPackingFormat packingFormat);
+ const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRDecoderPackingFormat() const;
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -62,7 +63,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
@@ -70,14 +71,14 @@
WebRtc_Word16 DisableDTX();
- AMR_encinst_t_* _encoderInstPtr;
- AMR_decinst_t_* _decoderInstPtr;
- WebRtc_Word16 _encodingMode;
- WebRtc_Word16 _encodingRate;
- ACMAMRPackingFormat _encoderPackingFormat;
- ACMAMRPackingFormat _decoderPackingFormat;
+ AMR_encinst_t_* encoder_inst_ptr_;
+ AMR_decinst_t_* decoder_inst_ptr_;
+ WebRtc_Word16 encoding_mode_;
+ WebRtc_Word16 encoding_rate_;
+ ACMAMRPackingFormat encoder_packing_format_;
+ ACMAMRPackingFormat decoder_packing_format_;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMR_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_amrwb.cc b/webrtc/modules/audio_coding/main/source/acm_amrwb.cc
index 4187a1f..caa9494 100644
--- a/webrtc/modules/audio_coding/main/source/acm_amrwb.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_amrwb.cc
@@ -8,14 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_amrwb.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "audio_coding_module_typedefs.h"
-#include "rw_lock_wrapper.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_amrwb.h"
+
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_AMRWB
// NOTE! GSM AMR-wb is not included in the open-source package. The
@@ -25,20 +26,20 @@
//
// The API in the header file should match the one below.
//
-// int16_t WebRtcAmrWb_CreateEnc(AMRWB_encinst_t_** encInst);
-// int16_t WebRtcAmrWb_CreateDec(AMRWB_decinst_t_** decInst);
-// int16_t WebRtcAmrWb_FreeEnc(AMRWB_encinst_t_* encInst);
-// int16_t WebRtcAmrWb_FreeDec(AMRWB_decinst_t_* decInst);
-// int16_t WebRtcAmrWb_Encode(AMRWB_encinst_t_* encInst, int16_t* input,
+// int16_t WebRtcAmrWb_CreateEnc(AMRWB_encinst_t_** enc_inst);
+// int16_t WebRtcAmrWb_CreateDec(AMRWB_decinst_t_** dec_inst);
+// int16_t WebRtcAmrWb_FreeEnc(AMRWB_encinst_t_* enc_inst);
+// int16_t WebRtcAmrWb_FreeDec(AMRWB_decinst_t_* dec_inst);
+// int16_t WebRtcAmrWb_Encode(AMRWB_encinst_t_* enc_inst, int16_t* input,
// int16_t len, int16_t* output, int16_t mode);
-// int16_t WebRtcAmrWb_EncoderInit(AMRWB_encinst_t_* encInst,
-// int16_t dtxMode);
-// int16_t WebRtcAmrWb_EncodeBitmode(AMRWB_encinst_t_* encInst,
+// int16_t WebRtcAmrWb_EncoderInit(AMRWB_encinst_t_* enc_inst,
+// int16_t dtx_mode);
+// int16_t WebRtcAmrWb_EncodeBitmode(AMRWB_encinst_t_* enc_inst,
// int format);
-// int16_t WebRtcAmrWb_Decode(AMRWB_decinst_t_* decInst);
-// int16_t WebRtcAmrWb_DecodePlc(AMRWB_decinst_t_* decInst);
-// int16_t WebRtcAmrWb_DecoderInit(AMRWB_decinst_t_* decInst);
-// int16_t WebRtcAmrWb_DecodeBitmode(AMRWB_decinst_t_* decInst,
+// int16_t WebRtcAmrWb_Decode(AMRWB_decinst_t_* dec_inst);
+// int16_t WebRtcAmrWb_DecodePlc(AMRWB_decinst_t_* dec_inst);
+// int16_t WebRtcAmrWb_DecoderInit(AMRWB_decinst_t_* dec_inst);
+// int16_t WebRtcAmrWb_DecodeBitmode(AMRWB_decinst_t_* dec_inst,
// int format);
#include "amrwb_interface.h"
#endif
@@ -46,30 +47,29 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_AMRWB
-ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codecID*/)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _encodingMode(-1), // invalid value
- _encodingRate(0), // invalid value
- _encoderPackingFormat(AMRBandwidthEfficient),
- _decoderPackingFormat(AMRBandwidthEfficient) {
- return;
+ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoding_mode_(-1), // invalid value
+ encoding_rate_(0), // invalid value
+ encoder_packing_format_(AMRBandwidthEfficient),
+ decoder_packing_format_(AMRBandwidthEfficient) {
}
ACMAMRwb::~ACMAMRwb() {
- return;
}
-WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMAMRwb::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
@@ -82,17 +82,17 @@
}
WebRtc_Word16 ACMAMRwb::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMAMRwb::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -121,12 +121,12 @@
return -1;
}
-void ACMAMRwb::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMAMRwb::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat(
- ACMAMRPackingFormat /* packingFormat */) {
+ ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@@ -135,7 +135,7 @@
}
WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat(
- ACMAMRPackingFormat /* packingFormat */) {
+ ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@@ -155,78 +155,78 @@
#define AMRWB_MODE_23k 7
#define AMRWB_MODE_24k 8
-ACMAMRwb::ACMAMRwb(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _encodingMode(-1), // invalid value
- _encodingRate(0) { // invalid value
- _codecID = codecID;
- _hasInternalDTX = true;
- _encoderPackingFormat = AMRBandwidthEfficient;
- _decoderPackingFormat = AMRBandwidthEfficient;
+ACMAMRwb::ACMAMRwb(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoding_mode_(-1), // invalid value
+ encoding_rate_(0) { // invalid value
+ codec_id_ = codec_id;
+ has_internal_dtx_ = true;
+ encoder_packing_format_ = AMRBandwidthEfficient;
+ decoder_packing_format_ = AMRBandwidthEfficient;
return;
}
ACMAMRwb::~ACMAMRwb() {
- if (_encoderInstPtr != NULL) {
- WebRtcAmrWb_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcAmrWb_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcAmrWb_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcAmrWb_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- WebRtc_Word16 vadDecision = 1;
+WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ WebRtc_Word16 vad_decision = 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)) {
- *bitStreamLenByte = 0;
+ if ((encoding_mode_ < AMRWB_MODE_7k) || (encoding_mode_ > AMRWB_MODE_24k)) {
+ *bitstream_len_byte = 0;
return -1;
}
- *bitStreamLenByte = WebRtcAmrWb_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- (WebRtc_Word16*) bitStream,
- _encodingMode);
+ *bitstream_len_byte = WebRtcAmrWb_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ (WebRtc_Word16*)bitstream,
+ encoding_mode_);
// Update VAD, if internal DTX is used
- if (_hasInternalDTX && _dtxEnabled) {
- if (*bitStreamLenByte <= (7 * _frameLenSmpl / 160)) {
- vadDecision = 0;
+ if (has_internal_dtx_ && dtx_enabled_) {
+ if (*bitstream_len_byte <= (7 * frame_len_smpl_ / 160)) {
+ vad_decision = 0;
}
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
- _vadLabel[n] = vadDecision;
+ vad_label_[n] = vad_decision;
}
}
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _frameLenSmpl;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMAMRwb::EnableDTX() {
- if (_dtxEnabled) {
+ if (dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// enable DTX
- if (WebRtcAmrWb_EncoderInit(_encoderInstPtr, 1) < 0) {
+ if (WebRtcAmrWb_EncoderInit(encoder_inst_ptr_, 1) < 0) {
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
return 0;
} else {
return -1;
@@ -234,14 +234,14 @@
}
WebRtc_Word16 ACMAMRwb::DisableDTX() {
- if (!_dtxEnabled) {
+ if (!dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// disable DTX
- if (WebRtcAmrWb_EncoderInit(_encoderInstPtr, 0) < 0) {
+ if (WebRtcAmrWb_EncoderInit(encoder_inst_ptr_, 0) < 0) {
return -1;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -249,31 +249,32 @@
}
}
-WebRtc_Word16 ACMAMRwb::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMAMRwb::InternalInitEncoder(
+ WebRtcACMCodecParams* codec_params) {
// sanity check
- if (_encoderInstPtr == NULL) {
+ if (encoder_inst_ptr_ == NULL) {
return -1;
}
- WebRtc_Word16 status = SetBitRateSafe((codecParams->codecInstant).rate);
+ WebRtc_Word16 status = SetBitRateSafe((codec_params->codec_inst).rate);
status += (WebRtcAmrWb_EncoderInit(
- _encoderInstPtr, ((codecParams->enableDTX) ? 1 : 0)) < 0) ? -1 : 0;
+ encoder_inst_ptr_, ((codec_params->enable_dtx) ? 1 : 0)) < 0) ? -1 : 0;
status += (WebRtcAmrWb_EncodeBitmode(
- _encoderInstPtr, _encoderPackingFormat) < 0) ? -1 : 0;
+ encoder_inst_ptr_, encoder_packing_format_) < 0) ? -1 : 0;
return (status < 0) ? -1 : 0;
}
WebRtc_Word16 ACMAMRwb::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- WebRtc_Word16 status = WebRtcAmrWb_DecodeBitmode(_decoderInstPtr,
- _decoderPackingFormat);
- status += ((WebRtcAmrWb_DecoderInit(_decoderInstPtr) < 0) ? -1 : 0);
+ WebRtcACMCodecParams* /* codec_params */) {
+ WebRtc_Word16 status = WebRtcAmrWb_DecodeBitmode(decoder_inst_ptr_,
+ decoder_packing_format_);
+ status += ((WebRtcAmrWb_DecoderInit(decoder_inst_ptr_) < 0) ? -1 : 0);
return (status < 0) ? -1 : 0;
}
-WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
+WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
return -1;
}
@@ -281,9 +282,9 @@
// "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_AMRWB_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderAMRWB, codec_inst.pltype,
+ decoder_inst_ptr_, 16000);
+ SET_AMRWB_FUNCTIONS((codec_def));
return 0;
}
@@ -292,80 +293,80 @@
}
WebRtc_Word16 ACMAMRwb::InternalCreateEncoder() {
- return WebRtcAmrWb_CreateEnc(&_encoderInstPtr);
+ return WebRtcAmrWb_CreateEnc(&encoder_inst_ptr_);
}
void ACMAMRwb::DestructEncoderSafe() {
- if (_encoderInstPtr != NULL) {
- WebRtcAmrWb_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcAmrWb_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
// there is no encoder set the following
- _encoderExist = false;
- _encoderInitialized = false;
- _encodingMode = -1; // invalid value
- _encodingRate = 0;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ encoding_mode_ = -1; // invalid value
+ encoding_rate_ = 0;
}
WebRtc_Word16 ACMAMRwb::InternalCreateDecoder() {
- return WebRtcAmrWb_CreateDec(&_decoderInstPtr);
+ return WebRtcAmrWb_CreateDec(&decoder_inst_ptr_);
}
void ACMAMRwb::DestructDecoderSafe() {
- if (_decoderInstPtr != NULL) {
- WebRtcAmrWb_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcAmrWb_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
// there is no encoder instance set the followings
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
}
WebRtc_Word16 ACMAMRwb::SetBitRateSafe(const WebRtc_Word32 rate) {
switch (rate) {
case 7000: {
- _encodingMode = AMRWB_MODE_7k;
- _encodingRate = 7000;
+ encoding_mode_ = AMRWB_MODE_7k;
+ encoding_rate_ = 7000;
break;
}
case 9000: {
- _encodingMode = AMRWB_MODE_9k;
- _encodingRate = 9000;
+ encoding_mode_ = AMRWB_MODE_9k;
+ encoding_rate_ = 9000;
break;
}
case 12000: {
- _encodingMode = AMRWB_MODE_12k;
- _encodingRate = 12000;
+ encoding_mode_ = AMRWB_MODE_12k;
+ encoding_rate_ = 12000;
break;
}
case 14000: {
- _encodingMode = AMRWB_MODE_14k;
- _encodingRate = 14000;
+ encoding_mode_ = AMRWB_MODE_14k;
+ encoding_rate_ = 14000;
break;
}
case 16000: {
- _encodingMode = AMRWB_MODE_16k;
- _encodingRate = 16000;
+ encoding_mode_ = AMRWB_MODE_16k;
+ encoding_rate_ = 16000;
break;
}
case 18000: {
- _encodingMode = AMRWB_MODE_18k;
- _encodingRate = 18000;
+ encoding_mode_ = AMRWB_MODE_18k;
+ encoding_rate_ = 18000;
break;
}
case 20000: {
- _encodingMode = AMRWB_MODE_20k;
- _encodingRate = 20000;
+ encoding_mode_ = AMRWB_MODE_20k;
+ encoding_rate_ = 20000;
break;
}
case 23000: {
- _encodingMode = AMRWB_MODE_23k;
- _encodingRate = 23000;
+ encoding_mode_ = AMRWB_MODE_23k;
+ encoding_rate_ = 23000;
break;
}
case 24000: {
- _encodingMode = AMRWB_MODE_24k;
- _encodingRate = 24000;
+ encoding_mode_ = AMRWB_MODE_24k;
+ encoding_rate_ = 24000;
break;
}
default: {
@@ -375,57 +376,57 @@
return 0;
}
-void ACMAMRwb::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcAmrWb_FreeEnc(static_cast<AMRWB_encinst_t_*>(ptrInst));
+void ACMAMRwb::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcAmrWb_FreeEnc(static_cast<AMRWB_encinst_t_*>(ptr_inst));
}
return;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat(
- ACMAMRPackingFormat packingFormat) {
- if ((packingFormat != AMRBandwidthEfficient) &&
- (packingFormat != AMROctetAlligned) &&
- (packingFormat != AMRFileStorage)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ ACMAMRPackingFormat packing_format) {
+ if ((packing_format != AMRBandwidthEfficient) &&
+ (packing_format != AMROctetAlligned) &&
+ (packing_format != AMRFileStorage)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Invalid AMRwb encoder packing-format.");
return -1;
} else {
- if (WebRtcAmrWb_EncodeBitmode(_encoderInstPtr, packingFormat) < 0) {
+ if (WebRtcAmrWb_EncodeBitmode(encoder_inst_ptr_, packing_format) < 0) {
return -1;
} else {
- _encoderPackingFormat = packingFormat;
+ encoder_packing_format_ = packing_format;
return 0;
}
}
}
ACMAMRPackingFormat ACMAMRwb::AMRwbEncoderPackingFormat() const {
- return _encoderPackingFormat;
+ return encoder_packing_format_;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat(
- ACMAMRPackingFormat packingFormat) {
- if ((packingFormat != AMRBandwidthEfficient) &&
- (packingFormat != AMROctetAlligned) &&
- (packingFormat != AMRFileStorage)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ ACMAMRPackingFormat packing_format) {
+ if ((packing_format != AMRBandwidthEfficient) &&
+ (packing_format != AMROctetAlligned) &&
+ (packing_format != AMRFileStorage)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Invalid AMRwb decoder packing-format.");
return -1;
} else {
- if (WebRtcAmrWb_DecodeBitmode(_decoderInstPtr, packingFormat) < 0) {
+ if (WebRtcAmrWb_DecodeBitmode(decoder_inst_ptr_, packing_format) < 0) {
return -1;
} else {
- _decoderPackingFormat = packingFormat;
+ decoder_packing_format_ = packing_format;
return 0;
}
}
}
ACMAMRPackingFormat ACMAMRwb::AMRwbDecoderPackingFormat() const {
- return _decoderPackingFormat;
+ return decoder_packing_format_;
}
#endif
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_amrwb.h b/webrtc/modules/audio_coding/main/source/acm_amrwb.h
index 126302c..0f8d0bb 100644
--- a/webrtc/modules/audio_coding/main/source/acm_amrwb.h
+++ b/webrtc/modules/audio_coding/main/source/acm_amrwb.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct AMRWB_encinst_t_;
@@ -19,40 +19,39 @@
namespace webrtc {
-enum ACMAMRPackingFormat;
-
class ACMAMRwb: public ACMGenericCodec {
public:
- ACMAMRwb(WebRtc_Word16 codecID);
+ explicit ACMAMRwb(WebRtc_Word16 codec_id);
~ACMAMRwb();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams* codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams* codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams* codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams* codec_params);
WebRtc_Word16 SetAMRwbEncoderPackingFormat(
- const ACMAMRPackingFormat packingFormat);
+ const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRwbEncoderPackingFormat() const;
WebRtc_Word16 SetAMRwbDecoderPackingFormat(
- const ACMAMRPackingFormat packingFormat);
+ const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRwbDecoderPackingFormat() const;
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -62,7 +61,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
@@ -70,15 +69,15 @@
WebRtc_Word16 DisableDTX();
- AMRWB_encinst_t_* _encoderInstPtr;
- AMRWB_decinst_t_* _decoderInstPtr;
+ AMRWB_encinst_t_* encoder_inst_ptr_;
+ AMRWB_decinst_t_* decoder_inst_ptr_;
- WebRtc_Word16 _encodingMode;
- WebRtc_Word16 _encodingRate;
- ACMAMRPackingFormat _encoderPackingFormat;
- ACMAMRPackingFormat _decoderPackingFormat;
+ WebRtc_Word16 encoding_mode_;
+ WebRtc_Word16 encoding_rate_;
+ ACMAMRPackingFormat encoder_packing_format_;
+ ACMAMRPackingFormat decoder_packing_format_;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_AMRWB_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_celt.cc b/webrtc/modules/audio_coding/main/source/acm_celt.cc
index d9678fd..e6ceda4 100644
--- a/webrtc/modules/audio_coding/main/source/acm_celt.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_celt.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "acm_celt.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
-// TODO(tlegrand): Add full paths.
+#include "webrtc/modules/audio_coding/main/source/acm_celt.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_CELT
// NOTE! Celt is not included in the open-source package. Modify this file or
@@ -26,7 +26,7 @@
#ifndef WEBRTC_CODEC_CELT
-ACMCELT::ACMCELT(int16_t /* codecID */)
+ACMCELT::ACMCELT(int16_t /* codec_id */)
: enc_inst_ptr_(NULL),
dec_inst_ptr_(NULL),
sampling_freq_(0),
@@ -40,29 +40,29 @@
return;
}
-int16_t ACMCELT::InternalEncode(uint8_t* /* bitStream */,
- int16_t* /* bitStreamLenByte */) {
+int16_t ACMCELT::InternalEncode(uint8_t* /* bitstream */,
+ int16_t* /* bitstream_len_byte */) {
return -1;
}
-int16_t ACMCELT::DecodeSafe(uint8_t* /* bitStream */,
- int16_t /* bitStreamLenByte */,
+int16_t ACMCELT::DecodeSafe(uint8_t* /* bitstream */,
+ int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
- int16_t* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ int16_t* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
-int16_t ACMCELT::InternalInitEncoder(WebRtcACMCodecParams* /* codecParams */) {
+int16_t ACMCELT::InternalInitEncoder(WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-int16_t ACMCELT::InternalInitDecoder(WebRtcACMCodecParams* /* codecParams */) {
+int16_t ACMCELT::InternalInitDecoder(WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-int32_t ACMCELT::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+int32_t ACMCELT::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -86,7 +86,7 @@
return;
}
-void ACMCELT::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMCELT::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -103,7 +103,7 @@
#else //===================== Actual Implementation =======================
-ACMCELT::ACMCELT(int16_t codecID)
+ACMCELT::ACMCELT(int16_t codec_id)
: enc_inst_ptr_(NULL),
dec_inst_ptr_(NULL),
sampling_freq_(32000), // Default sampling frequency.
@@ -111,7 +111,7 @@
channels_(1), // Default send mono.
dec_channels_(1) { // Default receive mono.
// TODO(tlegrand): remove later when ACMGenericCodec has a new constructor.
- _codecID = codecID;
+ codec_id_ = codec_id;
return;
}
@@ -128,52 +128,53 @@
return;
}
-int16_t ACMCELT::InternalEncode(uint8_t* bitStream, int16_t* bitStreamLenByte) {
- *bitStreamLenByte = 0;
+int16_t ACMCELT::InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) {
+ *bitstream_len_byte = 0;
// Call Encoder.
- *bitStreamLenByte = WebRtcCelt_Encode(enc_inst_ptr_,
- &_inAudio[_inAudioIxRead],
- bitStream);
+ *bitstream_len_byte = WebRtcCelt_Encode(enc_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ bitstream);
// Increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer.
- _inAudioIxRead += _frameLenSmpl * channels_;
+ in_audio_ix_read_ += frame_len_smpl_ * channels_;
- if (*bitStreamLenByte < 0) {
+ if (*bitstream_len_byte < 0) {
// Error reported from the encoder.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: Encode error for Celt");
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
}
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
-int16_t ACMCELT::DecodeSafe(uint8_t* /* bitStream */,
- int16_t /* bitStreamLenByte */,
+int16_t ACMCELT::DecodeSafe(uint8_t* /* bitstream */,
+ int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
- int16_t* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ int16_t* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
-int16_t ACMCELT::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+int16_t ACMCELT::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// Set bitrate and check that it is within the valid range.
- int16_t status = SetBitRateSafe((codecParams->codecInstant).rate);
+ int16_t status = SetBitRateSafe((codec_params->codec_inst).rate);
if (status < 0) {
return -1;
}
// If number of channels changed we need to re-create memory.
- if (codecParams->codecInstant.channels != channels_) {
+ if (codec_params->codec_inst.channels != channels_) {
WebRtcCelt_FreeEnc(enc_inst_ptr_);
enc_inst_ptr_ = NULL;
// Store new number of channels.
- channels_ = codecParams->codecInstant.channels;
+ channels_ = codec_params->codec_inst.channels;
if (WebRtcCelt_CreateEnc(&enc_inst_ptr_, channels_) < 0) {
- return -1;
+ return -1;
}
}
@@ -185,36 +186,36 @@
}
}
-int16_t ACMCELT::InternalInitDecoder(WebRtcACMCodecParams* codecParams) {
+int16_t ACMCELT::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
// If number of channels changed we need to re-create memory.
- if (codecParams->codecInstant.channels != dec_channels_) {
+ if (codec_params->codec_inst.channels != dec_channels_) {
WebRtcCelt_FreeDec(dec_inst_ptr_);
dec_inst_ptr_ = NULL;
// Store new number of channels.
- dec_channels_ = codecParams->codecInstant.channels;
+ dec_channels_ = codec_params->codec_inst.channels;
if (WebRtcCelt_CreateDec(&dec_inst_ptr_, dec_channels_) < 0) {
- return -1;
+ return -1;
}
}
// Initiate decoder, both master and slave parts.
if (WebRtcCelt_DecoderInit(dec_inst_ptr_) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: init decoder failed for Celt.");
return -1;
}
if (WebRtcCelt_DecoderInitSlave(dec_inst_ptr_) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: init decoder failed for Celt.");
return -1;
}
return 0;
}
-int32_t ACMCELT::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+int32_t ACMCELT::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodecDef: Decoder uninitialized for Celt");
return -1;
}
@@ -223,20 +224,20 @@
// "SET_CODEC_PAR" and "SET_CELT_FUNCTIONS" or "SET_CELTSLAVE_FUNCTIONS".
// Then call NetEQ to add the codec to it's
// database.
- if (codecInst.channels == 1) {
- SET_CODEC_PAR(codecDef, kDecoderCELT_32, codecInst.pltype, dec_inst_ptr_,
+ if (codec_inst.channels == 1) {
+ SET_CODEC_PAR(codec_def, kDecoderCELT_32, codec_inst.pltype, dec_inst_ptr_,
32000);
} else {
- SET_CODEC_PAR(codecDef, kDecoderCELT_32_2ch, codecInst.pltype,
+ SET_CODEC_PAR(codec_def, kDecoderCELT_32_2ch, codec_inst.pltype,
dec_inst_ptr_, 32000);
}
// If this is the master of NetEQ, regular decoder will be added, otherwise
// the slave decoder will be used.
- if (_isMaster) {
- SET_CELT_FUNCTIONS(codecDef);
+ if (is_master_) {
+ SET_CELT_FUNCTIONS(codec_def);
} else {
- SET_CELTSLAVE_FUNCTIONS(codecDef);
+ SET_CELTSLAVE_FUNCTIONS(codec_def);
}
return 0;
}
@@ -246,18 +247,18 @@
}
int16_t ACMCELT::InternalCreateEncoder() {
- if (WebRtcCelt_CreateEnc(&enc_inst_ptr_, _noChannels) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcCelt_CreateEnc(&enc_inst_ptr_, num_channels_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: create encoder failed for Celt");
return -1;
}
- channels_ = _noChannels;
+ channels_ = num_channels_;
return 0;
}
void ACMCELT::DestructEncoderSafe() {
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
if (enc_inst_ptr_ != NULL) {
WebRtcCelt_FreeEnc(enc_inst_ptr_);
enc_inst_ptr_ = NULL;
@@ -266,7 +267,7 @@
int16_t ACMCELT::InternalCreateDecoder() {
if (WebRtcCelt_CreateDec(&dec_inst_ptr_, dec_channels_) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: create decoder failed for Celt");
return -1;
}
@@ -275,17 +276,17 @@
}
void ACMCELT::DestructDecoderSafe() {
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
if (dec_inst_ptr_ != NULL) {
WebRtcCelt_FreeDec(dec_inst_ptr_);
dec_inst_ptr_ = NULL;
}
}
-void ACMCELT::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcCelt_FreeEnc(static_cast<CELT_encinst_t*>(ptrInst));
+void ACMCELT::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcCelt_FreeEnc(static_cast<CELT_encinst_t*>(ptr_inst));
}
return;
}
@@ -304,13 +305,13 @@
if (WebRtcCelt_EncoderInit(enc_inst_ptr_, channels_, bitrate_) >= 0) {
return 0;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: Failed to initiate Celt with rate %d",
rate);
return -1;
}
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: Invalid rate Celt, %d", rate);
return -1;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_celt.h b/webrtc/modules/audio_coding/main/source/acm_celt.h
index 18e36dd..4f6953e 100644
--- a/webrtc/modules/audio_coding/main/source/acm_celt.h
+++ b/webrtc/modules/audio_coding/main/source/acm_celt.h
@@ -11,7 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CELT_H_
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CELT_H_
-#include "acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct CELT_encinst_t_;
@@ -21,29 +21,29 @@
class ACMCELT : public ACMGenericCodec {
public:
- ACMCELT(int16_t codecID);
+ explicit ACMCELT(int16_t codec_id);
~ACMCELT();
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitStreamLenByte);
+ int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
- int16_t InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- int16_t InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
-
WebRtc_Word16 DecodeSafe(
- uint8_t* /* bitStream */,
- int16_t /* bitStreamLenByte */,
+ uint8_t* /* bitstream */,
+ int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
- int16_t* /* audioSamples */,
+ int16_t* /* audio_samples */,
// TODO(leozwang): use int8_t here when WebRtc_Word8 is properly typed.
// http://code.google.com/p/webrtc/issues/detail?id=311
- WebRtc_Word8* /* speechType */);
+ WebRtc_Word8* /* speech_type */);
- int32_t CodecDef(WebRtcNetEQ_CodecDef& codecDef, const CodecInst& codecInst);
+ int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -53,7 +53,7 @@
int16_t InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
bool IsTrueStereoCodec();
@@ -69,6 +69,6 @@
uint16_t dec_channels_;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CELT_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_cng.cc b/webrtc/modules/audio_coding/main/source/acm_cng.cc
index 4edfc05..ff8cea0 100644
--- a/webrtc/modules/audio_coding/main/source/acm_cng.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_cng.cc
@@ -8,33 +8,34 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_cng.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_cng.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_cng.h"
+
+#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
-ACMCNG::ACMCNG(WebRtc_Word16 codecID) {
- _encoderInstPtr = NULL;
- _decoderInstPtr = NULL;
- _codecID = codecID;
- _sampFreqHz = ACMCodecDB::CodecFreq(_codecID);
+ACMCNG::ACMCNG(WebRtc_Word16 codec_id) {
+ encoder_inst_ptr_ = NULL;
+ decoder_inst_ptr_ = NULL;
+ codec_id_ = codec_id;
+ samp_freq_hz_ = ACMCodecDB::CodecFreq(codec_id_);
return;
}
ACMCNG::~ACMCNG() {
- if (_encoderInstPtr != NULL) {
- WebRtcCng_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcCng_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcCng_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcCng_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
@@ -43,16 +44,16 @@
// 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* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMCNG::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMCNG::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
@@ -61,19 +62,19 @@
// instead the following function is called from inside
// ACMGenericCodec::ProcessFrameVADDTX
WebRtc_Word16 ACMCNG::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMCNG::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- return WebRtcCng_InitDec(_decoderInstPtr);
+ WebRtcACMCodecParams* /* codec_params */) {
+ return WebRtcCng_InitDec(decoder_inst_ptr_);
}
-WebRtc_Word32 ACMCNG::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- // TODO (tlegrand): log error
+WebRtc_Word32 ACMCNG::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ // TODO(tlegrand): log error
return -1;
}
// Fill up the structure by calling
@@ -81,11 +82,11 @@
// Then return the structure back to NetEQ to add the codec to it's
// database.
- if (_sampFreqHz == 8000 || _sampFreqHz == 16000 || _sampFreqHz == 32000 ||
- _sampFreqHz == 48000) {
- SET_CODEC_PAR((codecDef), kDecoderCNG, codecInst.pltype,
- _decoderInstPtr, _sampFreqHz);
- SET_CNG_FUNCTIONS((codecDef));
+ if (samp_freq_hz_ == 8000 || samp_freq_hz_ == 16000 ||
+ samp_freq_hz_ == 32000 || samp_freq_hz_ == 48000) {
+ SET_CODEC_PAR((codec_def), kDecoderCNG, codec_inst.pltype,
+ decoder_inst_ptr_, samp_freq_hz_);
+ SET_CNG_FUNCTIONS((codec_def));
return 0;
} else {
return -1;
@@ -97,8 +98,8 @@
}
WebRtc_Word16 ACMCNG::InternalCreateEncoder() {
- if (WebRtcCng_CreateEnc(&_encoderInstPtr) < 0) {
- _encoderInstPtr = NULL;
+ if (WebRtcCng_CreateEnc(&encoder_inst_ptr_) < 0) {
+ encoder_inst_ptr_ = NULL;
return -1;
} else {
return 0;
@@ -106,17 +107,17 @@
}
void ACMCNG::DestructEncoderSafe() {
- if (_encoderInstPtr != NULL) {
- WebRtcCng_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcCng_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
}
WebRtc_Word16 ACMCNG::InternalCreateDecoder() {
- if (WebRtcCng_CreateDec(&_decoderInstPtr) < 0) {
- _decoderInstPtr = NULL;
+ if (WebRtcCng_CreateDec(&decoder_inst_ptr_) < 0) {
+ decoder_inst_ptr_ = NULL;
return -1;
} else {
return 0;
@@ -124,19 +125,19 @@
}
void ACMCNG::DestructDecoderSafe() {
- if (_decoderInstPtr != NULL) {
- WebRtcCng_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcCng_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
}
-void ACMCNG::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcCng_FreeEnc(static_cast<CNG_enc_inst*>(ptrInst));
+void ACMCNG::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcCng_FreeEnc(static_cast<CNG_enc_inst*>(ptr_inst));
}
return;
}
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_cng.h b/webrtc/modules/audio_coding/main/source/acm_cng.h
index d204d02..3f77a85 100644
--- a/webrtc/modules/audio_coding/main/source/acm_cng.h
+++ b/webrtc/modules/audio_coding/main/source/acm_cng.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct WebRtcCngEncInst;
@@ -21,26 +21,27 @@
class ACMCNG: public ACMGenericCodec {
public:
- ACMCNG(WebRtc_Word16 codecID);
+ explicit ACMCNG(WebRtc_Word16 codec_id);
~ACMCNG();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
-protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ protected:
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -50,7 +51,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX() {
return -1;
@@ -60,11 +61,11 @@
return -1;
}
- WebRtcCngEncInst* _encoderInstPtr;
- WebRtcCngDecInst* _decoderInstPtr;
- WebRtc_UWord16 _sampFreqHz;
+ WebRtcCngEncInst* encoder_inst_ptr_;
+ WebRtcCngDecInst* decoder_inst_ptr_;
+ WebRtc_UWord16 samp_freq_hz_;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CNG_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_codec_database.cc b/webrtc/modules/audio_coding/main/source/acm_codec_database.cc
index b860b8a..9fc66ab 100644
--- a/webrtc/modules/audio_coding/main/source/acm_codec_database.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_codec_database.cc
@@ -15,90 +15,90 @@
// TODO(tlegrand): Change constant input pointers in all functions to constant
// references, where appropriate.
-#include "acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include <stdio.h>
-#include "acm_common_defs.h"
-#include "trace.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/system_wrappers/interface/trace.h"
// Includes needed to create the codecs.
// G.711, PCM mu-law and A-law.
-#include "acm_pcma.h"
-#include "acm_pcmu.h"
-#include "g711_interface.h"
+#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcma.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcmu.h"
// CNG.
-#include "acm_cng.h"
-#include "webrtc_cng.h"
+#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
+#include "webrtc/modules/audio_coding/main/source/acm_cng.h"
// NetEQ.
-#include "webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#ifdef WEBRTC_CODEC_ISAC
- #include "acm_isac.h"
- #include "acm_isac_macros.h"
- #include "isac.h"
+#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac_macros.h"
#endif
#ifdef WEBRTC_CODEC_ISACFX
- #include "acm_isac.h"
- #include "acm_isac_macros.h"
- #include "isacfix.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac_macros.h"
#endif
#ifdef WEBRTC_CODEC_PCM16
- #include "pcm16b.h"
- #include "acm_pcm16b.h"
+#include "webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcm16b.h"
#endif
#ifdef WEBRTC_CODEC_ILBC
- #include "acm_ilbc.h"
- #include "ilbc.h"
+#include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h"
+#include "webrtc/modules/audio_coding/main/source/acm_ilbc.h"
#endif
#ifdef WEBRTC_CODEC_AMR
- #include "acm_amr.h"
- #include "amr_interface.h"
+#include "amr_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_amr.h"
#endif
#ifdef WEBRTC_CODEC_AMRWB
- #include "acm_amrwb.h"
- #include "amrwb_interface.h"
+#include "amrwb_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_amrwb.h"
#endif
#ifdef WEBRTC_CODEC_CELT
- #include "acm_celt.h"
- #include "celt_interface.h"
+#include "celt_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_celt.h"
#endif
#ifdef WEBRTC_CODEC_G722
- #include "acm_g722.h"
- #include "g722_interface.h"
+#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g722.h"
#endif
#ifdef WEBRTC_CODEC_G722_1
- #include "acm_g7221.h"
- #include "g7221_interface.h"
+#include "g7221_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7221.h"
#endif
#ifdef WEBRTC_CODEC_G722_1C
- #include "acm_g7221c.h"
- #include "g7221c_interface.h"
+#include "g7221c_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7221c.h"
#endif
#ifdef WEBRTC_CODEC_G729
- #include "acm_g729.h"
- #include "g729_interface.h"
+#include "g729_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g729.h"
#endif
#ifdef WEBRTC_CODEC_G729_1
- #include "acm_g7291.h"
- #include "g7291_interface.h"
+#include "g7291_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7291.h"
#endif
#ifdef WEBRTC_CODEC_GSMFR
- #include "acm_gsmfr.h"
- #include "gsmfr_interface.h"
+#include "gsmfr_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_gsmfr.h"
#endif
#ifdef WEBRTC_CODEC_OPUS
- #include "acm_opus.h"
- #include "modules/audio_coding/codecs/opus/interface/opus_interface.h"
+#include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_opus.h"
#endif
#ifdef WEBRTC_CODEC_SPEEX
- #include "acm_speex.h"
- #include "speex_interface.h"
+#include "speex_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_speex.h"
#endif
#ifdef WEBRTC_CODEC_AVT
- #include "acm_dtmf_playout.h"
+#include "webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h"
#endif
#ifdef WEBRTC_CODEC_RED
- #include "acm_red.h"
+#include "webrtc/modules/audio_coding/main/source/acm_red.h"
#endif
namespace webrtc {
@@ -108,19 +108,19 @@
// are defined they will receive reserved fixed payload types (values 69-95).
const int kDynamicPayloadtypes[ACMCodecDB::kMaxNumCodecs] = {
107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 92,
- 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
- 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
- 67, 66, 65
+ 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
+ 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
+ 67, 66, 65
};
// Creates database with all supported codecs at compile time.
// Each entry needs the following parameters in the given order:
// payload type, name, sampling frequency, packet size in samples,
// number of channels, and default rate.
-#if (defined(WEBRTC_CODEC_AMR) || defined(WEBRTC_CODEC_AMRWB) \
- || defined(WEBRTC_CODEC_CELT) || defined(WEBRTC_CODEC_G722_1) \
- || defined(WEBRTC_CODEC_G722_1C) || defined(WEBRTC_CODEC_G729_1) \
- || defined(WEBRTC_CODEC_PCM16) || defined(WEBRTC_CODEC_SPEEX))
+#if (defined(WEBRTC_CODEC_AMR) || defined(WEBRTC_CODEC_AMRWB) || \
+ defined(WEBRTC_CODEC_CELT) || defined(WEBRTC_CODEC_G722_1) || \
+ defined(WEBRTC_CODEC_G722_1C) || defined(WEBRTC_CODEC_G729_1) || \
+ defined(WEBRTC_CODEC_PCM16) || defined(WEBRTC_CODEC_SPEEX))
static int count_database = 0;
#endif
@@ -219,180 +219,180 @@
// Basic block samples, max number of channels that are supported.
const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
- {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1},
+ {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1},
# if (defined(WEBRTC_CODEC_ISAC))
- {1, {kIsacPacSize960}, 0, 1},
- {1, {kIsacPacSize1440}, 0, 1},
+ {1, {kIsacPacSize960}, 0, 1},
+ {1, {kIsacPacSize1440}, 0, 1},
# endif
#endif
#ifdef WEBRTC_CODEC_PCM16
- // Mono
- {4, {80, 160, 240, 320}, 0, 2},
- {4, {160, 320, 480, 640}, 0, 2},
- {2, {320, 640}, 0, 2},
- // Stereo
- {4, {80, 160, 240, 320}, 0, 2},
- {4, {160, 320, 480, 640}, 0, 2},
- {2, {320, 640}, 0, 2},
+ // Mono
+ {4, {80, 160, 240, 320}, 0, 2},
+ {4, {160, 320, 480, 640}, 0, 2},
+ {2, {320, 640}, 0, 2},
+ // Stereo
+ {4, {80, 160, 240, 320}, 0, 2},
+ {4, {160, 320, 480, 640}, 0, 2},
+ {2, {320, 640}, 0, 2},
#endif
- // G.711, PCM mu-law and A-law.
- // Mono
- {6, {80, 160, 240, 320, 400, 480}, 0, 2},
- {6, {80, 160, 240, 320, 400, 480}, 0, 2},
- // Stereo
- {6, {80, 160, 240, 320, 400, 480}, 0, 2},
- {6, {80, 160, 240, 320, 400, 480}, 0, 2},
+ // G.711, PCM mu-law and A-law.
+ // Mono
+ {6, {80, 160, 240, 320, 400, 480}, 0, 2},
+ {6, {80, 160, 240, 320, 400, 480}, 0, 2},
+ // Stereo
+ {6, {80, 160, 240, 320, 400, 480}, 0, 2},
+ {6, {80, 160, 240, 320, 400, 480}, 0, 2},
#ifdef WEBRTC_CODEC_ILBC
- {4, {160, 240, 320, 480}, 0, 1},
+ {4, {160, 240, 320, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_AMR
- {3, {160, 320, 480}, 0, 1},
+ {3, {160, 320, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_AMRWB
- {3, {320, 640, 960}, 0, 1},
+ {3, {320, 640, 960}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_CELT
- // Mono
- {1, {640}, 0, 2},
- // Stereo
- {1, {640}, 0, 2},
+ // Mono
+ {1, {640}, 0, 2},
+ // Stereo
+ {1, {640}, 0, 2},
#endif
#ifdef WEBRTC_CODEC_G722
- // Mono
- {6, {160, 320, 480, 640, 800, 960}, 0, 2},
- // Stereo
- {6, {160, 320, 480, 640, 800, 960}, 0, 2},
+ // Mono
+ {6, {160, 320, 480, 640, 800, 960}, 0, 2},
+ // Stereo
+ {6, {160, 320, 480, 640, 800, 960}, 0, 2},
#endif
#ifdef WEBRTC_CODEC_G722_1
- {1, {320}, 320, 1},
- {1, {320}, 320, 1},
- {1, {320}, 320, 1},
+ {1, {320}, 320, 1},
+ {1, {320}, 320, 1},
+ {1, {320}, 320, 1},
#endif
#ifdef WEBRTC_CODEC_G722_1C
- {1, {640}, 640, 1},
- {1, {640}, 640, 1},
- {1, {640}, 640, 1},
+ {1, {640}, 640, 1},
+ {1, {640}, 640, 1},
+ {1, {640}, 640, 1},
#endif
#ifdef WEBRTC_CODEC_G729
- {6, {80, 160, 240, 320, 400, 480}, 0, 1},
+ {6, {80, 160, 240, 320, 400, 480}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_G729_1
- {3, {320, 640, 960}, 0, 1},
+ {3, {320, 640, 960}, 0, 1},
#endif
#ifdef WEBRTC_CODEC_GSMFR
- {3, {160, 320, 480}, 160, 1},
+ {3, {160, 320, 480}, 160, 1},
#endif
#ifdef WEBRTC_CODEC_OPUS
- // Opus supports frames shorter than 10ms,
- // but it doesn't help us to use them.
- // Mono and stereo.
- {1, {960}, 0, 2},
+ // Opus supports frames shorter than 10ms,
+ // but it doesn't help us to use them.
+ // Mono and stereo.
+ {1, {960}, 0, 2},
#endif
#ifdef WEBRTC_CODEC_SPEEX
- {3, {160, 320, 480}, 0, 1},
- {3, {320, 640, 960}, 0, 1},
+ {3, {160, 320, 480}, 0, 1},
+ {3, {320, 640, 960}, 0, 1},
#endif
- // Comfort noise for three different sampling frequencies.
- {1, {240}, 240, 1},
- {1, {480}, 480, 1},
- {1, {960}, 960, 1},
- {1, {1440}, 1440, 1},
+ // Comfort noise for three different sampling frequencies.
+ {1, {240}, 240, 1},
+ {1, {480}, 480, 1},
+ {1, {960}, 960, 1},
+ {1, {1440}, 1440, 1},
#ifdef WEBRTC_CODEC_AVT
- {1, {240}, 240, 1},
+ {1, {240}, 240, 1},
#endif
#ifdef WEBRTC_CODEC_RED
- {1, {0}, 0, 1},
+ {1, {0}, 0, 1},
#endif
- // To prevent compile errors due to trailing commas.
- {-1, {-1}, -1, -1}
+ // To prevent compile errors due to trailing commas.
+ {-1, {-1}, -1, -1}
};
// Create a database of all NetEQ decoders at compile time.
const WebRtcNetEQDecoder ACMCodecDB::neteq_decoders_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
- kDecoderISAC,
+ kDecoderISAC,
# if (defined(WEBRTC_CODEC_ISAC))
- kDecoderISACswb,
- kDecoderISACfb,
+ kDecoderISACswb,
+ kDecoderISACfb,
# endif
#endif
#ifdef WEBRTC_CODEC_PCM16
- // Mono
- kDecoderPCM16B,
- kDecoderPCM16Bwb,
- kDecoderPCM16Bswb32kHz,
- // Stereo
- kDecoderPCM16B_2ch,
- kDecoderPCM16Bwb_2ch,
- kDecoderPCM16Bswb32kHz_2ch,
+ // Mono
+ kDecoderPCM16B,
+ kDecoderPCM16Bwb,
+ kDecoderPCM16Bswb32kHz,
+ // Stereo
+ kDecoderPCM16B_2ch,
+ kDecoderPCM16Bwb_2ch,
+ kDecoderPCM16Bswb32kHz_2ch,
#endif
- // G.711, PCM mu-las and A-law.
- // Mono
- kDecoderPCMu,
- kDecoderPCMa,
- // Stereo
- kDecoderPCMu_2ch,
- kDecoderPCMa_2ch,
+ // G.711, PCM mu-las and A-law.
+ // Mono
+ kDecoderPCMu,
+ kDecoderPCMa,
+ // Stereo
+ kDecoderPCMu_2ch,
+ kDecoderPCMa_2ch,
#ifdef WEBRTC_CODEC_ILBC
- kDecoderILBC,
+ kDecoderILBC,
#endif
#ifdef WEBRTC_CODEC_AMR
- kDecoderAMR,
+ kDecoderAMR,
#endif
#ifdef WEBRTC_CODEC_AMRWB
- kDecoderAMRWB,
+ kDecoderAMRWB,
#endif
#ifdef WEBRTC_CODEC_CELT
- // Mono
- kDecoderCELT_32,
- // Stereo
- kDecoderCELT_32_2ch,
+ // Mono
+ kDecoderCELT_32,
+ // Stereo
+ kDecoderCELT_32_2ch,
#endif
#ifdef WEBRTC_CODEC_G722
- // Mono
- kDecoderG722,
- // Stereo
- kDecoderG722_2ch,
+ // Mono
+ kDecoderG722,
+ // Stereo
+ kDecoderG722_2ch,
#endif
#ifdef WEBRTC_CODEC_G722_1
- kDecoderG722_1_32,
- kDecoderG722_1_24,
- kDecoderG722_1_16,
+ kDecoderG722_1_32,
+ kDecoderG722_1_24,
+ kDecoderG722_1_16,
#endif
#ifdef WEBRTC_CODEC_G722_1C
- kDecoderG722_1C_48,
- kDecoderG722_1C_32,
- kDecoderG722_1C_24,
+ kDecoderG722_1C_48,
+ kDecoderG722_1C_32,
+ kDecoderG722_1C_24,
#endif
#ifdef WEBRTC_CODEC_G729
- kDecoderG729,
+ kDecoderG729,
#endif
#ifdef WEBRTC_CODEC_G729_1
- kDecoderG729_1,
+ kDecoderG729_1,
#endif
#ifdef WEBRTC_CODEC_GSMFR
- kDecoderGSMFR,
+ kDecoderGSMFR,
#endif
#ifdef WEBRTC_CODEC_OPUS
- // Mono and stereo.
- kDecoderOpus,
+ // Mono and stereo.
+ kDecoderOpus,
#endif
#ifdef WEBRTC_CODEC_SPEEX
- kDecoderSPEEX_8,
- kDecoderSPEEX_16,
+ kDecoderSPEEX_8,
+ kDecoderSPEEX_16,
#endif
- // Comfort noise for three different sampling frequencies.
- kDecoderCNG,
- kDecoderCNG,
- kDecoderCNG,
- kDecoderCNG,
+ // Comfort noise for three different sampling frequencies.
+ kDecoderCNG,
+ kDecoderCNG,
+ kDecoderCNG,
+ kDecoderCNG,
#ifdef WEBRTC_CODEC_AVT
- kDecoderAVT,
+ kDecoderAVT,
#endif
#ifdef WEBRTC_CODEC_RED
- kDecoderRED,
+ kDecoderRED,
#endif
- kDecoderReservedEnd
+ kDecoderReservedEnd
};
// Get codec information from database.
@@ -587,7 +587,7 @@
}
// Gets codec id number, and mirror id, from database for the receiver.
int ACMCodecDB::ReceiverCodecNumber(const CodecInst* codec_inst,
- int* mirror_id) {
+ int* mirror_id) {
// Look for a matching codec in the database.
int codec_id = CodecId(codec_inst);
@@ -618,7 +618,7 @@
int ACMCodecDB::BasicCodingBlock(int codec_id) {
// Error check to see that codec_id is not out of bounds.
if (codec_id < 0 || codec_id >= kNumCodecs) {
- return -1;
+ return -1;
}
return codec_settings_[codec_id].basic_block_samples;
diff --git a/webrtc/modules/audio_coding/main/source/acm_codec_database.h b/webrtc/modules/audio_coding/main/source/acm_codec_database.h
index 30d0462..0ea7741 100644
--- a/webrtc/modules/audio_coding/main/source/acm_codec_database.h
+++ b/webrtc/modules/audio_coding/main/source/acm_codec_database.h
@@ -16,9 +16,9 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CODEC_DATABASE_H_
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_CODEC_DATABASE_H_
-#include "acm_generic_codec.h"
-#include "common_types.h"
-#include "webrtc_neteq.h"
+#include "webrtc/common_types.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/main/source/acm_common_defs.h b/webrtc/modules/audio_coding/main/source/acm_common_defs.h
index 06d17f3..ac3f9b7 100644
--- a/webrtc/modules/audio_coding/main/source/acm_common_defs.h
+++ b/webrtc/modules/audio_coding/main/source/acm_common_defs.h
@@ -13,10 +13,10 @@
#include <string.h>
-#include "audio_coding_module_typedefs.h"
-#include "common_types.h"
-#include "engine_configurations.h"
-#include "typedefs.h"
+#include "webrtc/common_types.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/typedefs.h"
// Checks for enabled codecs, we prevent enabling codecs which are not
// compatible.
@@ -26,10 +26,10 @@
#ifdef WIN32
// OS-dependent case-insensitive string comparison
-#define STR_CASE_CMP(x,y) ::_stricmp(x,y)
+#define STR_CASE_CMP(x, y) ::_stricmp(x, y)
#else
// OS-dependent case-insensitive string comparison
-#define STR_CASE_CMP(x,y) ::strcasecmp(x,y)
+#define STR_CASE_CMP(x, y) ::strcasecmp(x, y)
#endif
namespace webrtc {
@@ -78,40 +78,40 @@
// A structure which contains codec parameters. For instance, used when
// initializing encoder and decoder.
//
-// codecInstant : c.f. common_types.h
-// enableDTX : set true to enable DTX. If codec does not have
-// internal DTX, this will enable VAD.
-// enableVAD : set true to enable VAD.
-// vadMode : VAD mode, c.f. audio_coding_module_typedefs.h
-// for possible values.
+// codec_inst: c.f. common_types.h
+// enable_dtx: set true to enable DTX. If codec does not have
+// internal DTX, this will enable VAD.
+// enable_vad: set true to enable VAD.
+// vad_mode: VAD mode, c.f. audio_coding_module_typedefs.h
+// for possible values.
struct WebRtcACMCodecParams {
- CodecInst codecInstant;
- bool enableDTX;
- bool enableVAD;
- ACMVADMode vadMode;
+ CodecInst codec_inst;
+ bool enable_dtx;
+ bool enable_vad;
+ ACMVADMode vad_mode;
};
// A structure that encapsulates audio buffer and related parameters
// used for synchronization of audio of two ACMs.
//
-// inAudio : same as ACMGenericCodec::_inAudio
-// inAudioIxRead : same as ACMGenericCodec::_inAudioIxRead
-// inAudioIxWrite : same as ACMGenericCodec::_inAudioIxWrite
-// inTimestamp : same as ACMGenericCodec::_inTimestamp
-// inTimestampIxWrite : same as ACMGenericCodec::_inTImestampIxWrite
-// lastTimestamp : same as ACMGenericCodec::_lastTimestamp
-// lastInTimestamp : same as AudioCodingModuleImpl::_lastInTimestamp
+// in_audio: same as ACMGenericCodec::in_audio_
+// in_audio_ix_read: same as ACMGenericCodec::in_audio_ix_read_
+// in_audio_ix_write: same as ACMGenericCodec::in_audio_ix_write_
+// in_timestamp: same as ACMGenericCodec::in_timestamp_
+// in_timestamp_ix_write: same as ACMGenericCodec::in_timestamp_ix_write_
+// last_timestamp: same as ACMGenericCodec::last_timestamp_
+// last_in_timestamp: same as AudioCodingModuleImpl::last_in_timestamp_
//
struct WebRtcACMAudioBuff {
- WebRtc_Word16 inAudio[AUDIO_BUFFER_SIZE_W16];
- WebRtc_Word16 inAudioIxRead;
- WebRtc_Word16 inAudioIxWrite;
- WebRtc_UWord32 inTimestamp[TIMESTAMP_BUFFER_SIZE_W32];
- WebRtc_Word16 inTimestampIxWrite;
- WebRtc_UWord32 lastTimestamp;
- WebRtc_UWord32 lastInTimestamp;
+ WebRtc_Word16 in_audio[AUDIO_BUFFER_SIZE_W16];
+ WebRtc_Word16 in_audio_ix_read;
+ WebRtc_Word16 in_audio_ix_write;
+ WebRtc_UWord32 in_timestamp[TIMESTAMP_BUFFER_SIZE_W32];
+ WebRtc_Word16 in_timestamp_ix_write;
+ WebRtc_UWord32 last_timestamp;
+ WebRtc_UWord32 last_in_timestamp;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.cc b/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.cc
index e256186..6271eae 100644
--- a/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.cc
@@ -8,8 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_dtmf_detection.h"
-#include "audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h"
+
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
namespace webrtc {
@@ -26,12 +27,12 @@
}
WebRtc_Word16 ACMDTMFDetection::Detect(
- const WebRtc_Word16* /* inAudioBuff */,
- const WebRtc_UWord16 /* inBuffLenWord16 */,
- const WebRtc_Word32 /* inFreqHz */,
- bool& /* toneDetected */,
+ const WebRtc_Word16* /* in_audio_buff */,
+ const WebRtc_UWord16 /* in_buff_len_word16 */,
+ const WebRtc_Word32 /* in_freq_hz */,
+ bool& /* tone_detected */,
WebRtc_Word16& /* tone */) {
return -1;
}
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h b/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h
index fab6f18..4251d00 100644
--- a/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h
+++ b/webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h
@@ -11,9 +11,9 @@
#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"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_resampler.h"
+#include "webrtc/typedefs.h"
namespace webrtc {
@@ -23,14 +23,14 @@
~ACMDTMFDetection();
WebRtc_Word16 Enable(ACMCountries cpt = ACMDisableCountryDetection);
WebRtc_Word16 Disable();
- WebRtc_Word16 Detect(const WebRtc_Word16* inAudioBuff,
- const WebRtc_UWord16 inBuffLenWord16,
- const WebRtc_Word32 inFreqHz,
- bool& toneDetected,
+ WebRtc_Word16 Detect(const WebRtc_Word16* in_audio_buff,
+ const WebRtc_UWord16 in_buff_len_word16,
+ const WebRtc_Word32 in_freq_hz,
+ bool& tone_detected,
WebRtc_Word16& tone);
private:
- ACMResampler _resampler;
+ ACMResampler resampler_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.cc b/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.cc
index de69f10..bf4f63b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.cc
@@ -8,19 +8,20 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#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"
+#include "webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
#ifndef WEBRTC_CODEC_AVT
ACMDTMFPlayout::ACMDTMFPlayout(
- WebRtc_Word16 /* codecID */) {
+ WebRtc_Word16 /* codec_id */) {
return;
}
@@ -29,31 +30,32 @@
}
WebRtc_Word16 ACMDTMFPlayout::InternalEncode(
- WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
- WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
+ WebRtc_Word16* /* audio */,
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -69,7 +71,7 @@
return -1;
}
-void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -83,8 +85,8 @@
#else //===================== Actual Implementation =======================
-ACMDTMFPlayout::ACMDTMFPlayout(WebRtc_Word16 codecID) {
- _codecID = codecID;
+ACMDTMFPlayout::ACMDTMFPlayout(WebRtc_Word16 codec_id) {
+ codec_id_ = codec_id;
}
ACMDTMFPlayout::~ACMDTMFPlayout() {
@@ -92,41 +94,42 @@
}
WebRtc_Word16 ACMDTMFPlayout::InternalEncode(
- WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return 0;
}
-WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
- WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
+ WebRtc_Word16* /* audio */,
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// DTMFPlayout has no instance
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// 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& codec_def,
+ const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_AVT_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderAVT, codecInst.pltype, NULL, 8000);
- SET_AVT_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderAVT, codec_inst.pltype, NULL, 8000);
+ SET_AVT_FUNCTIONS((codec_def));
return 0;
}
@@ -144,7 +147,7 @@
return 0;
}
-void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMDTMFPlayout::InternalDestructEncoderInst(void* /* ptr_inst */) {
// DTMFPlayout has no instance
return;
}
@@ -161,4 +164,4 @@
#endif
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h b/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h
index 62b1501..2607a2f 100644
--- a/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h
+++ b/webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h
@@ -11,32 +11,33 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
class ACMDTMFPlayout: public ACMGenericCodec {
public:
- ACMDTMFPlayout(WebRtc_Word16 codecID);
+ explicit ACMDTMFPlayout(WebRtc_Word16 codec_id);
~ACMDTMFPlayout();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -46,9 +47,9 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_DTMF_PLAYOUT_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_g722.cc b/webrtc/modules/audio_coding/main/source/acm_g722.cc
index 12397be..cc93801 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g722.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_g722.cc
@@ -8,64 +8,63 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_g722.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
-#include "g722_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g722.h"
+
+#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
#ifndef WEBRTC_CODEC_G722
-ACMG722::ACMG722(WebRtc_Word16 /* codecID */)
- : _ptrEncStr(NULL),
- _ptrDecStr(NULL),
- _encoderInstPtr(NULL),
- _encoderInstPtrRight(NULL),
- _decoderInstPtr(NULL) {
- return;
-}
+ACMG722::ACMG722(WebRtc_Word16 /* codec_id */)
+ : ptr_enc_str_(NULL),
+ ptr_dec_str_(NULL),
+ encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL) {}
-ACMG722::~ACMG722() {
- return;
-}
+ACMG722::~ACMG722() {}
-WebRtc_Word32 ACMG722::Add10MsDataSafe(const WebRtc_UWord32 /* timestamp */,
- const WebRtc_Word16* /* data */,
- const WebRtc_UWord16 /* lengthSmpl */,
- const WebRtc_UWord8 /* audioChannel */) {
+WebRtc_Word32 ACMG722::Add10MsDataSafe(
+ const WebRtc_UWord32 /* timestamp */,
+ const WebRtc_Word16* /* data */,
+ const WebRtc_UWord16 /* length_smpl */,
+ const WebRtc_UWord8 /* audio_channel */) {
return -1;
}
-WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMG722::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -89,7 +88,7 @@
return;
}
-void ACMG722::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMG722::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -100,158 +99,160 @@
// Encoder and decoder memory
struct ACMG722EncStr {
- G722EncInst* inst; // instance for left channel in case of stereo
- G722EncInst* instRight; // instance for right channel in case of stereo
+ G722EncInst* inst; // instance for left channel in case of stereo
+ G722EncInst* inst_right; // instance for right channel in case of stereo
};
struct ACMG722DecStr {
- G722DecInst* inst; // instance for left channel in case of stereo
- G722DecInst* instRight; // instance for right channel in case of stereo
+ G722DecInst* inst; // instance for left channel in case of stereo
+ G722DecInst* inst_right; // instance for right channel in case of stereo
};
-ACMG722::ACMG722(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _encoderInstPtrRight(NULL),
- _decoderInstPtr(NULL) {
+ACMG722::ACMG722(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL) {
// Encoder
- _ptrEncStr = new ACMG722EncStr;
- if (_ptrEncStr != NULL) {
- _ptrEncStr->inst = NULL;
- _ptrEncStr->instRight = NULL;
+ ptr_enc_str_ = new ACMG722EncStr;
+ if (ptr_enc_str_ != NULL) {
+ ptr_enc_str_->inst = NULL;
+ ptr_enc_str_->inst_right = NULL;
}
// Decoder
- _ptrDecStr = new ACMG722DecStr;
- if (_ptrDecStr != NULL) {
- _ptrDecStr->inst = NULL;
- _ptrDecStr->instRight = NULL; // Not used
+ ptr_dec_str_ = new ACMG722DecStr;
+ if (ptr_dec_str_ != NULL) {
+ ptr_dec_str_->inst = NULL;
+ ptr_dec_str_->inst_right = NULL; // Not used
}
- _codecID = codecID;
+ codec_id_ = codec_id;
return;
}
ACMG722::~ACMG722() {
// Encoder
- if (_ptrEncStr != NULL) {
- if (_ptrEncStr->inst != NULL) {
- WebRtcG722_FreeEncoder(_ptrEncStr->inst);
- _ptrEncStr->inst = NULL;
+ if (ptr_enc_str_ != NULL) {
+ if (ptr_enc_str_->inst != NULL) {
+ WebRtcG722_FreeEncoder(ptr_enc_str_->inst);
+ ptr_enc_str_->inst = NULL;
}
- if (_ptrEncStr->instRight != NULL) {
- WebRtcG722_FreeEncoder(_ptrEncStr->instRight);
- _ptrEncStr->instRight = NULL;
+ if (ptr_enc_str_->inst_right != NULL) {
+ WebRtcG722_FreeEncoder(ptr_enc_str_->inst_right);
+ ptr_enc_str_->inst_right = NULL;
}
- delete _ptrEncStr;
- _ptrEncStr = NULL;
+ delete ptr_enc_str_;
+ ptr_enc_str_ = NULL;
}
// Decoder
- if (_ptrDecStr != NULL) {
- if (_ptrDecStr->inst != NULL) {
- WebRtcG722_FreeDecoder(_ptrDecStr->inst);
- _ptrDecStr->inst = NULL;
+ if (ptr_dec_str_ != NULL) {
+ if (ptr_dec_str_->inst != NULL) {
+ WebRtcG722_FreeDecoder(ptr_dec_str_->inst);
+ ptr_dec_str_->inst = NULL;
}
- if (_ptrDecStr->instRight != NULL) {
- WebRtcG722_FreeDecoder(_ptrDecStr->instRight);
- _ptrDecStr->instRight = NULL;
+ if (ptr_dec_str_->inst_right != NULL) {
+ WebRtcG722_FreeDecoder(ptr_dec_str_->inst_right);
+ ptr_dec_str_->inst_right = NULL;
}
- delete _ptrDecStr;
- _ptrDecStr = NULL;
+ delete ptr_dec_str_;
+ ptr_dec_str_ = NULL;
}
return;
}
WebRtc_Word32 ACMG722::Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
- const WebRtc_UWord16 lengthSmpl,
- const WebRtc_UWord8 audioChannel) {
- return ACMGenericCodec::Add10MsDataSafe((timestamp >> 1), data, lengthSmpl,
- audioChannel);
+ const WebRtc_UWord16 length_smpl,
+ const WebRtc_UWord8 audio_channel) {
+ return ACMGenericCodec::Add10MsDataSafe((timestamp >> 1), data, length_smpl,
+ audio_channel);
}
-WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
+WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
// If stereo, split input signal in left and right channel before encoding
- if (_noChannels == 2) {
- WebRtc_Word16 leftChannel[960];
- WebRtc_Word16 rightChannel[960];
- WebRtc_UWord8 outLeft[480];
- WebRtc_UWord8 outRight[480];
- WebRtc_Word16 lenInBytes;
- for (int i = 0, j = 0; i < _frameLenSmpl * 2; i += 2, j++) {
- leftChannel[j] = _inAudio[_inAudioIxRead + i];
- rightChannel[j] = _inAudio[_inAudioIxRead + i + 1];
+ if (num_channels_ == 2) {
+ WebRtc_Word16 left_channel[960];
+ WebRtc_Word16 right_channel[960];
+ WebRtc_UWord8 out_left[480];
+ WebRtc_UWord8 out_right[480];
+ WebRtc_Word16 len_in_bytes;
+ for (int i = 0, j = 0; i < frame_len_smpl_ * 2; i += 2, j++) {
+ left_channel[j] = in_audio_[in_audio_ix_read_ + i];
+ right_channel[j] = in_audio_[in_audio_ix_read_ + i + 1];
}
- lenInBytes = WebRtcG722_Encode(_encoderInstPtr, leftChannel, _frameLenSmpl,
- (WebRtc_Word16*) outLeft);
- lenInBytes += WebRtcG722_Encode(_encoderInstPtrRight, rightChannel,
- _frameLenSmpl, (WebRtc_Word16*) outRight);
- *bitStreamLenByte = lenInBytes;
+ len_in_bytes = WebRtcG722_Encode(encoder_inst_ptr_, left_channel,
+ frame_len_smpl_,
+ (WebRtc_Word16*)out_left);
+ len_in_bytes += WebRtcG722_Encode(encoder_inst_ptr_right_, right_channel,
+ frame_len_smpl_,
+ (WebRtc_Word16*)out_right);
+ *bitstream_len_byte = len_in_bytes;
// Interleave the 4 bits per sample from left and right channel
- for (int i = 0, j = 0; i < lenInBytes; i += 2, j++) {
- bitStream[i] = (outLeft[j] & 0xF0) + (outRight[j] >> 4);
- bitStream[i + 1] = ((outLeft[j] & 0x0F) << 4) + (outRight[j] & 0x0F);
+ for (int i = 0, j = 0; i < len_in_bytes; i += 2, j++) {
+ bitstream[i] = (out_left[j] & 0xF0) + (out_right[j] >> 4);
+ bitstream[i + 1] = ((out_left[j] & 0x0F) << 4) + (out_right[j] & 0x0F);
}
} else {
- *bitStreamLenByte = WebRtcG722_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- (WebRtc_Word16*) bitStream);
+ *bitstream_len_byte = WebRtcG722_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ (WebRtc_Word16*)bitstream);
}
// increment the read index this tell the caller how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _frameLenSmpl * _noChannels;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
-WebRtc_Word16 ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
- if (codecParams->codecInstant.channels == 2) {
+WebRtc_Word16 ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
+ if (codec_params->codec_inst.channels == 2) {
// Create codec struct for right channel
- if (_ptrEncStr->instRight == NULL) {
- WebRtcG722_CreateEncoder(&_ptrEncStr->instRight);
- if (_ptrEncStr->instRight == NULL) {
+ if (ptr_enc_str_->inst_right == NULL) {
+ WebRtcG722_CreateEncoder(&ptr_enc_str_->inst_right);
+ if (ptr_enc_str_->inst_right == NULL) {
return -1;
}
}
- _encoderInstPtrRight = _ptrEncStr->instRight;
- if (WebRtcG722_EncoderInit(_encoderInstPtrRight) < 0) {
+ encoder_inst_ptr_right_ = ptr_enc_str_->inst_right;
+ if (WebRtcG722_EncoderInit(encoder_inst_ptr_right_) < 0) {
return -1;
}
}
- return WebRtcG722_EncoderInit(_encoderInstPtr);
+ return WebRtcG722_EncoderInit(encoder_inst_ptr_);
}
WebRtc_Word16 ACMG722::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- return WebRtcG722_DecoderInit(_decoderInstPtr);
+ WebRtcACMCodecParams* /* codec_params */) {
+ return WebRtcG722_DecoderInit(decoder_inst_ptr_);
}
-WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- // TODO: log error
+WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ // TODO(turajs): log error
return -1;
}
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_G722_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- if (codecInst.channels == 1) {
- SET_CODEC_PAR(codecDef, kDecoderG722, codecInst.pltype, _decoderInstPtr,
+ if (codec_inst.channels == 1) {
+ SET_CODEC_PAR(codec_def, kDecoderG722, codec_inst.pltype, decoder_inst_ptr_,
16000);
} else {
- SET_CODEC_PAR(codecDef, kDecoderG722_2ch, codecInst.pltype,
- _decoderInstPtr, 16000);
+ SET_CODEC_PAR(codec_def, kDecoderG722_2ch, codec_inst.pltype,
+ decoder_inst_ptr_, 16000);
}
- SET_G722_FUNCTIONS(codecDef);
+ SET_G722_FUNCTIONS(codec_def);
return 0;
}
@@ -260,61 +261,61 @@
}
WebRtc_Word16 ACMG722::InternalCreateEncoder() {
- if (_ptrEncStr == NULL) {
+ if (ptr_enc_str_ == 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) {
+ WebRtcG722_CreateEncoder(&ptr_enc_str_->inst);
+ if (ptr_enc_str_->inst == NULL) {
return -1;
}
- _encoderInstPtr = _ptrEncStr->inst;
+ encoder_inst_ptr_ = ptr_enc_str_->inst;
return 0;
}
void ACMG722::DestructEncoderSafe() {
- if (_ptrEncStr != NULL) {
- if (_ptrEncStr->inst != NULL) {
- WebRtcG722_FreeEncoder(_ptrEncStr->inst);
- _ptrEncStr->inst = NULL;
+ if (ptr_enc_str_ != NULL) {
+ if (ptr_enc_str_->inst != NULL) {
+ WebRtcG722_FreeEncoder(ptr_enc_str_->inst);
+ ptr_enc_str_->inst = NULL;
}
}
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
}
WebRtc_Word16 ACMG722::InternalCreateDecoder() {
- if (_ptrDecStr == NULL) {
+ if (ptr_dec_str_ == 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_CreateDecoder(&_ptrDecStr->inst);
- if (_ptrDecStr->inst == NULL) {
+ WebRtcG722_CreateDecoder(&ptr_dec_str_->inst);
+ if (ptr_dec_str_->inst == NULL) {
return -1;
}
- _decoderInstPtr = _ptrDecStr->inst;
+ decoder_inst_ptr_ = ptr_dec_str_->inst;
return 0;
}
void ACMG722::DestructDecoderSafe() {
- _decoderExist = false;
- _decoderInitialized = false;
- if (_ptrDecStr != NULL) {
- if (_ptrDecStr->inst != NULL) {
- WebRtcG722_FreeDecoder(_ptrDecStr->inst);
- _ptrDecStr->inst = NULL;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
+ if (ptr_dec_str_ != NULL) {
+ if (ptr_dec_str_->inst != NULL) {
+ WebRtcG722_FreeDecoder(ptr_dec_str_->inst);
+ ptr_dec_str_->inst = NULL;
}
}
}
-void ACMG722::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcG722_FreeEncoder(static_cast<G722EncInst*>(ptrInst));
+void ACMG722::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcG722_FreeEncoder(static_cast<G722EncInst*>(ptr_inst));
}
return;
}
@@ -350,4 +351,4 @@
#endif
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_g722.h b/webrtc/modules/audio_coding/main/source/acm_g722.h
index d718cdb..60ea2b4 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g722.h
+++ b/webrtc/modules/audio_coding/main/source/acm_g722.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
typedef struct WebRtcG722EncInst G722EncInst;
typedef struct WebRtcG722DecInst G722DecInst;
@@ -24,31 +24,32 @@
class ACMG722: public ACMGenericCodec {
public:
- ACMG722(WebRtc_Word16 codecID);
+ explicit ACMG722(WebRtc_Word16 codec_id);
~ACMG722();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
- const WebRtc_UWord16 lengthSmpl,
- const WebRtc_UWord8 audioChannel);
+ const WebRtc_UWord16 length_smpl,
+ const WebRtc_UWord8 audio_channel);
void DestructEncoderSafe();
@@ -58,18 +59,18 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
- ACMG722EncStr* _ptrEncStr;
- ACMG722DecStr* _ptrDecStr;
+ ACMG722EncStr* ptr_enc_str_;
+ ACMG722DecStr* ptr_dec_str_;
- G722EncInst* _encoderInstPtr;
- G722EncInst* _encoderInstPtrRight; // Prepared for stereo
- G722DecInst* _decoderInstPtr;
+ G722EncInst* encoder_inst_ptr_;
+ G722EncInst* encoder_inst_ptr_right_; // Prepared for stereo
+ G722DecInst* decoder_inst_ptr_;
};
-} // namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7221.cc b/webrtc/modules/audio_coding/main/source/acm_g7221.cc
index b7a8f58..48c058c 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7221.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_g7221.cc
@@ -8,13 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_g7221.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7221.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_G722_1
// NOTE! G.722.1 is not included in the open-source package. The following
@@ -24,62 +25,62 @@
//
// The API in the header file should match the one below.
//
-// int16_t WebRtcG7221_CreateEnc16(G722_1_16_encinst_t_** encInst);
-// int16_t WebRtcG7221_CreateEnc24(G722_1_24_encinst_t_** encInst);
-// int16_t WebRtcG7221_CreateEnc32(G722_1_32_encinst_t_** encInst);
-// int16_t WebRtcG7221_CreateDec16(G722_1_16_decinst_t_** decInst);
-// int16_t WebRtcG7221_CreateDec24(G722_1_24_decinst_t_** decInst);
-// int16_t WebRtcG7221_CreateDec32(G722_1_32_decinst_t_** decInst);
+// int16_t WebRtcG7221_CreateEnc16(G722_1_16_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_CreateEnc24(G722_1_24_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_CreateEnc32(G722_1_32_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_CreateDec16(G722_1_16_decinst_t_** dec_inst);
+// int16_t WebRtcG7221_CreateDec24(G722_1_24_decinst_t_** dec_inst);
+// int16_t WebRtcG7221_CreateDec32(G722_1_32_decinst_t_** dec_inst);
//
-// int16_t WebRtcG7221_FreeEnc16(G722_1_16_encinst_t_** encInst);
-// int16_t WebRtcG7221_FreeEnc24(G722_1_24_encinst_t_** encInst);
-// int16_t WebRtcG7221_FreeEnc32(G722_1_32_encinst_t_** encInst);
-// int16_t WebRtcG7221_FreeDec16(G722_1_16_decinst_t_** decInst);
-// int16_t WebRtcG7221_FreeDec24(G722_1_24_decinst_t_** decInst);
-// int16_t WebRtcG7221_FreeDec32(G722_1_32_decinst_t_** decInst);
+// int16_t WebRtcG7221_FreeEnc16(G722_1_16_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_FreeEnc24(G722_1_24_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_FreeEnc32(G722_1_32_encinst_t_** enc_inst);
+// int16_t WebRtcG7221_FreeDec16(G722_1_16_decinst_t_** dec_inst);
+// int16_t WebRtcG7221_FreeDec24(G722_1_24_decinst_t_** dec_inst);
+// int16_t WebRtcG7221_FreeDec32(G722_1_32_decinst_t_** dec_inst);
//
-// int16_t WebRtcG7221_EncoderInit16(G722_1_16_encinst_t_* encInst);
-// int16_t WebRtcG7221_EncoderInit24(G722_1_24_encinst_t_* encInst);
-// int16_t WebRtcG7221_EncoderInit32(G722_1_32_encinst_t_* encInst);
-// int16_t WebRtcG7221_DecoderInit16(G722_1_16_decinst_t_* decInst);
-// int16_t WebRtcG7221_DecoderInit24(G722_1_24_decinst_t_* decInst);
-// int16_t WebRtcG7221_DecoderInit32(G722_1_32_decinst_t_* decInst);
+// int16_t WebRtcG7221_EncoderInit16(G722_1_16_encinst_t_* enc_inst);
+// int16_t WebRtcG7221_EncoderInit24(G722_1_24_encinst_t_* enc_inst);
+// int16_t WebRtcG7221_EncoderInit32(G722_1_32_encinst_t_* enc_inst);
+// int16_t WebRtcG7221_DecoderInit16(G722_1_16_decinst_t_* dec_inst);
+// int16_t WebRtcG7221_DecoderInit24(G722_1_24_decinst_t_* dec_inst);
+// int16_t WebRtcG7221_DecoderInit32(G722_1_32_decinst_t_* dec_inst);
//
-// int16_t WebRtcG7221_Encode16(G722_1_16_encinst_t_* encInst,
+// int16_t WebRtcG7221_Encode16(G722_1_16_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221_Encode24(G722_1_24_encinst_t_* encInst,
+// int16_t WebRtcG7221_Encode24(G722_1_24_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221_Encode32(G722_1_32_encinst_t_* encInst,
+// int16_t WebRtcG7221_Encode32(G722_1_32_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
//
-// int16_t WebRtcG7221_Decode16(G722_1_16_decinst_t_* decInst,
+// int16_t WebRtcG7221_Decode16(G722_1_16_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221_Decode24(G722_1_24_decinst_t_* decInst,
+// int16_t WebRtcG7221_Decode24(G722_1_24_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221_Decode32(G722_1_32_decinst_t_* decInst,
+// int16_t WebRtcG7221_Decode32(G722_1_32_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
//
-// int16_t WebRtcG7221_DecodePlc16(G722_1_16_decinst_t_* decInst,
+// int16_t WebRtcG7221_DecodePlc16(G722_1_16_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
-// int16_t WebRtcG7221_DecodePlc24(G722_1_24_decinst_t_* decInst,
+// int16_t nr_lost_frames);
+// int16_t WebRtcG7221_DecodePlc24(G722_1_24_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
-// int16_t WebRtcG7221_DecodePlc32(G722_1_32_decinst_t_* decInst,
+// int16_t nr_lost_frames);
+// int16_t WebRtcG7221_DecodePlc32(G722_1_32_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
+// int16_t nr_lost_frames);
#include "g7221_interface.h"
#endif
@@ -87,20 +88,20 @@
#ifndef WEBRTC_CODEC_G722_1
-ACMG722_1::ACMG722_1(WebRtc_Word16 /* codecID */)
- : _operationalRate(-1),
- _encoderInstPtr(NULL),
- _encoderInstPtrRight(NULL),
- _decoderInstPtr(NULL),
- _encoderInst16Ptr(NULL),
- _encoderInst16PtrR(NULL),
- _encoderInst24Ptr(NULL),
- _encoderInst24PtrR(NULL),
- _encoderInst32Ptr(NULL),
- _encoderInst32PtrR(NULL),
- _decoderInst16Ptr(NULL),
- _decoderInst24Ptr(NULL),
- _decoderInst32Ptr(NULL) {
+ACMG722_1::ACMG722_1(WebRtc_Word16 /* codec_id */)
+ : operational_rate_(-1),
+ encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoder_inst16_ptr_(NULL),
+ encoder_inst16_ptr_right_(NULL),
+ encoder_inst24_ptr_(NULL),
+ encoder_inst24_ptr_right_(NULL),
+ encoder_inst32_ptr_(NULL),
+ encoder_inst32_ptr_right_(NULL),
+ decoder_inst16_ptr_(NULL),
+ decoder_inst24_ptr_(NULL),
+ decoder_inst32_ptr_(NULL) {
return;
}
@@ -108,31 +109,32 @@
return;
}
-WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMG722_1::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722_1::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722_1::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -156,69 +158,68 @@
return;
}
-void ACMG722_1::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMG722_1::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
#else //===================== Actual Implementation =======================
-ACMG722_1::ACMG722_1(
- WebRtc_Word16 codecID):
- _encoderInstPtr(NULL),
- _encoderInstPtrRight(NULL),
- _decoderInstPtr(NULL),
- _encoderInst16Ptr(NULL),
- _encoderInst16PtrR(NULL),
- _encoderInst24Ptr(NULL),
- _encoderInst24PtrR(NULL),
- _encoderInst32Ptr(NULL),
- _encoderInst32PtrR(NULL),
- _decoderInst16Ptr(NULL),
- _decoderInst24Ptr(NULL),
- _decoderInst32Ptr(NULL) {
- _codecID = codecID;
- if (_codecID == ACMCodecDB::kG722_1_16) {
- _operationalRate = 16000;
- } else if (_codecID == ACMCodecDB::kG722_1_24) {
- _operationalRate = 24000;
- } else if (_codecID == ACMCodecDB::kG722_1_32) {
- _operationalRate = 32000;
+ACMG722_1::ACMG722_1(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoder_inst16_ptr_(NULL),
+ encoder_inst16_ptr_right_(NULL),
+ encoder_inst24_ptr_(NULL),
+ encoder_inst24_ptr_right_(NULL),
+ encoder_inst32_ptr_(NULL),
+ encoder_inst32_ptr_right_(NULL),
+ decoder_inst16_ptr_(NULL),
+ decoder_inst24_ptr_(NULL),
+ decoder_inst32_ptr_(NULL) {
+ codec_id_ = codec_id;
+ if (codec_id_ == ACMCodecDB::kG722_1_16) {
+ operational_rate_ = 16000;
+ } else if (codec_id_ == ACMCodecDB::kG722_1_24) {
+ operational_rate_ = 24000;
+ } else if (codec_id_ == ACMCodecDB::kG722_1_32) {
+ operational_rate_ = 32000;
} else {
- _operationalRate = -1;
+ operational_rate_ = -1;
}
return;
}
ACMG722_1::~ACMG722_1() {
- if (_encoderInstPtr != NULL) {
- delete _encoderInstPtr;
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ delete encoder_inst_ptr_;
+ encoder_inst_ptr_ = NULL;
}
- if (_encoderInstPtrRight != NULL) {
- delete _encoderInstPtrRight;
- _encoderInstPtrRight = NULL;
+ if (encoder_inst_ptr_right_ != NULL) {
+ delete encoder_inst_ptr_right_;
+ encoder_inst_ptr_right_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- delete _decoderInstPtr;
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ delete decoder_inst_ptr_;
+ decoder_inst_ptr_ = NULL;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 16000: {
- _encoderInst16Ptr = NULL;
- _encoderInst16PtrR = NULL;
- _decoderInst16Ptr = NULL;
+ encoder_inst16_ptr_ = NULL;
+ encoder_inst16_ptr_right_ = NULL;
+ decoder_inst16_ptr_ = NULL;
break;
}
case 24000: {
- _encoderInst24Ptr = NULL;
- _encoderInst24PtrR = NULL;
- _decoderInst24Ptr = NULL;
+ encoder_inst24_ptr_ = NULL;
+ encoder_inst24_ptr_right_ = NULL;
+ decoder_inst24_ptr_ = NULL;
break;
}
case 32000: {
- _encoderInst32Ptr = NULL;
- _encoderInst32PtrR = NULL;
- _decoderInst32Ptr = NULL;
+ encoder_inst32_ptr_ = NULL;
+ encoder_inst32_ptr_right_ = NULL;
+ decoder_inst32_ptr_ = NULL;
break;
}
default: {
@@ -228,131 +229,134 @@
return;
}
-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];
+WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ WebRtc_Word16 left_channel[320];
+ WebRtc_Word16 right_channel[320];
+ WebRtc_Word16 len_in_bytes;
+ WebRtc_Word16 out_bits[160];
// If stereo, split input signal in left and right channel before encoding
- 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];
+ if (num_channels_ == 2) {
+ for (int i = 0, j = 0; i < frame_len_smpl_ * 2; i += 2, j++) {
+ left_channel[j] = in_audio_[in_audio_ix_read_ + i];
+ right_channel[j] = in_audio_[in_audio_ix_read_ + i + 1];
}
} else {
- memcpy(leftChannel, &_inAudio[_inAudioIxRead], 320);
+ memcpy(left_channel, &in_audio_[in_audio_ix_read_], 320);
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 16000: {
- Inst lenInBytes = WebRtcG7221_Encode16(_encoderInst16Ptr, leftChannel,
- 320, &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221_Encode16(_encoderInst16PtrR, rightChannel,
- 320, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221_Encode16(encoder_inst16_ptr_, left_channel,
+ 320, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221_Encode16(encoder_inst16_ptr_right_,
+ right_channel, 320,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
case 24000: {
- lenInBytes = WebRtcG7221_Encode24(_encoderInst24Ptr, leftChannel, 320,
- &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221_Encode24(_encoderInst24PtrR, rightChannel,
- 320, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221_Encode24(encoder_inst24_ptr_, left_channel,
+ 320, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221_Encode24(encoder_inst24_ptr_right_,
+ right_channel, 320,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
case 32000: {
- lenInBytes = WebRtcG7221_Encode32(_encoderInst32Ptr, leftChannel, 320,
- &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221_Encode32(_encoderInst32PtrR, rightChannel,
- 320, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221_Encode32(encoder_inst32_ptr_, left_channel,
+ 320, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221_Encode32(encoder_inst32_ptr_right_,
+ right_channel, 320,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitEncode: Wrong rate for G722_1.");
return -1;
}
}
- memcpy(bitStream, outB, lenInBytes);
- *bitStreamLenByte = lenInBytes;
+ memcpy(bitstream, out_bits, len_in_bytes);
+ *bitstream_len_byte = len_in_bytes;
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += 320 * _noChannels;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += 320 * num_channels_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG722_1::InternalInitEncoder(
- WebRtcACMCodecParams* codecParams) {
+ WebRtcACMCodecParams* codec_params) {
WebRtc_Word16 ret;
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 16000: {
- ret = WebRtcG7221_EncoderInit16(_encoderInst16PtrR);
+ ret = WebRtcG7221_EncoderInit16(encoder_inst16_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221_EncoderInit16(_encoderInst16Ptr);
+ return WebRtcG7221_EncoderInit16(encoder_inst16_ptr_);
}
case 24000: {
- ret = WebRtcG7221_EncoderInit24(_encoderInst24PtrR);
+ ret = WebRtcG7221_EncoderInit24(encoder_inst24_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221_EncoderInit24(_encoderInst24Ptr);
+ return WebRtcG7221_EncoderInit24(encoder_inst24_ptr_);
}
case 32000: {
- ret = WebRtcG7221_EncoderInit32(_encoderInst32PtrR);
+ ret = WebRtcG7221_EncoderInit32(encoder_inst32_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221_EncoderInit32(_encoderInst32Ptr);
+ return WebRtcG7221_EncoderInit32(encoder_inst32_ptr_);
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError,Inst webrtc::kTraceAudioCoding,
- _uniqueID, "InternalInitEncoder: Wrong rate for G722_1.");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding,
+ unique_id_, "InternalInitEncoder: Wrong rate for G722_1.");
return -1;
}
}
}
WebRtc_Word16 ACMG722_1::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- switch (_operationalRate) {
+ WebRtcACMCodecParams* /* codec_params */) {
+ switch (operational_rate_) {
case 16000: {
- return WebRtcG7221_DecoderInit16(_decoderInst16Ptr);
+ return WebRtcG7221_DecoderInit16(decoder_inst16_ptr_);
}
case 24000: {
- return WebRtcG7221_DecoderInit24(_decoderInst24Ptr);
+ return WebRtcG7221_DecoderInit24(decoder_inst24_ptr_);
}
case 32000: {
- return WebRtcG7221_DecoderInit32(_decoderInst32Ptr);
+ return WebRtcG7221_DecoderInit32(decoder_inst32_ptr_);
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: Wrong rate for G722_1.");
return -1;
}
}
}
-WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
+WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
// Todo:
// log error
return -1;
@@ -365,27 +369,27 @@
// "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) {
+ switch (operational_rate_) {
case 16000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1_16, codecInst.pltype,
- _decoderInst16Ptr, 16000);
- SET_G722_1_16_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1_16, codec_inst.pltype,
+ decoder_inst16_ptr_, 16000);
+ SET_G722_1_16_FUNCTIONS((codec_def));
break;
}
case 24000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1_24, codecInst.pltype,
- _decoderInst24Ptr, 16000);
- SET_G722_1_24_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1_24, codec_inst.pltype,
+ decoder_inst24_ptr_, 16000);
+ SET_G722_1_24_FUNCTIONS((codec_def));
break;
}
case 32000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1_32, codecInst.pltype,
- _decoderInst32Ptr, 16000);
- SET_G722_1_32_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1_32, codec_inst.pltype,
+ decoder_inst32_ptr_, 16000);
+ SET_G722_1_32_FUNCTIONS((codec_def));
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodecDef: Wrong rate for G722_1.");
return -1;
}
@@ -398,27 +402,27 @@
}
WebRtc_Word16 ACMG722_1::InternalCreateEncoder() {
- if ((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) {
+ if ((encoder_inst_ptr_ == NULL) || (encoder_inst_ptr_right_ == NULL)) {
return -1;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 16000: {
- WebRtcG7221_CreateEnc16(&_encoderInst16Ptr);
- WebRtcG7221_CreateEnc16(&_encoderInst16PtrR);
+ WebRtcG7221_CreateEnc16(&encoder_inst16_ptr_);
+ WebRtcG7221_CreateEnc16(&encoder_inst16_ptr_right_);
break;
}
case 24000: {
- WebRtcG7221_CreateEnc24(&_encoderInst24Ptr);
- WebRtcG7221_CreateEnc24(&_encoderInst24PtrR);
+ WebRtcG7221_CreateEnc24(&encoder_inst24_ptr_);
+ WebRtcG7221_CreateEnc24(&encoder_inst24_ptr_right_);
break;
}
case 32000: {
- WebRtcG7221_CreateEnc32(&_encoderInst32Ptr);
- WebRtcG7221_CreateEnc32(&_encoderInst32PtrR);
+ WebRtcG7221_CreateEnc32(&encoder_inst32_ptr_);
+ WebRtcG7221_CreateEnc32(&encoder_inst32_ptr_right_);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: Wrong rate for G722_1.");
return -1;
}
@@ -427,40 +431,40 @@
}
void ACMG722_1::DestructEncoderSafe() {
- _encoderExist = false;
- _encoderInitialized = false;
- if (_encoderInstPtr != NULL) {
- delete _encoderInstPtr;
- _encoderInstPtr = NULL;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ if (encoder_inst_ptr_ != NULL) {
+ delete encoder_inst_ptr_;
+ encoder_inst_ptr_ = NULL;
}
- if (_encoderInstPtrRight != NULL) {
- delete _encoderInstPtrRight;
- _encoderInstPtrRight = NULL;
+ if (encoder_inst_ptr_right_ != NULL) {
+ delete encoder_inst_ptr_right_;
+ encoder_inst_ptr_right_ = NULL;
}
- _encoderInst16Ptr = NULL;
- _encoderInst24Ptr = NULL;
- _encoderInst32Ptr = NULL;
+ encoder_inst16_ptr_ = NULL;
+ encoder_inst24_ptr_ = NULL;
+ encoder_inst32_ptr_ = NULL;
}
WebRtc_Word16 ACMG722_1::InternalCreateDecoder() {
- if (_decoderInstPtr == NULL) {
+ if (decoder_inst_ptr_ == NULL) {
return -1;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 16000: {
- WebRtcG7221_CreateDec16(&_decoderInst16Ptr);
+ WebRtcG7221_CreateDec16(&decoder_inst16_ptr_);
break;
}
case 24000: {
- WebRtcG7221_CreateDec24(&_decoderInst24Ptr);
+ WebRtcG7221_CreateDec24(&decoder_inst24_ptr_);
break;
}
case 32000: {
- WebRtcG7221_CreateDec32(&_decoderInst32Ptr);
+ WebRtcG7221_CreateDec32(&decoder_inst32_ptr_);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: Wrong rate for G722_1.");
return -1;
}
@@ -469,24 +473,24 @@
}
void ACMG722_1::DestructDecoderSafe() {
- _decoderExist = false;
- _decoderInitialized = false;
- if (_decoderInstPtr != NULL) {
- delete _decoderInstPtr;
- _decoderInstPtr = NULL;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
+ if (decoder_inst_ptr_ != NULL) {
+ delete decoder_inst_ptr_;
+ decoder_inst_ptr_ = NULL;
}
- _decoderInst16Ptr = NULL;
- _decoderInst24Ptr = NULL;
- _decoderInst32Ptr = NULL;
+ decoder_inst16_ptr_ = NULL;
+ decoder_inst24_ptr_ = NULL;
+ decoder_inst32_ptr_ = NULL;
}
-void ACMG722_1::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- delete ptrInst;
+void ACMG722_1::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ delete ptr_inst;
}
return;
}
#endif
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7221.h b/webrtc/modules/audio_coding/main/source/acm_g7221.h
index af12475..9b4cb91 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7221.h
+++ b/webrtc/modules/audio_coding/main/source/acm_g7221.h
@@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_
-#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_
+#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221_H_
+#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221_H_
-#include "acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct G722_1_16_encinst_t_;
@@ -26,26 +26,27 @@
class ACMG722_1: public ACMGenericCodec {
public:
- ACMG722_1(WebRtc_Word16 codecID);
+ explicit ACMG722_1(WebRtc_Word16 codec_id);
~ACMG722_1();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -55,28 +56,28 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
- WebRtc_Word32 _operationalRate;
+ WebRtc_Word32 operational_rate_;
- G722_1_Inst_t_* _encoderInstPtr;
- G722_1_Inst_t_* _encoderInstPtrRight; //Used in stereo mode
- G722_1_Inst_t_* _decoderInstPtr;
+ G722_1_Inst_t_* encoder_inst_ptr_;
+ G722_1_Inst_t_* encoder_inst_ptr_right_; // Used in stereo mode
+ G722_1_Inst_t_* decoder_inst_ptr_;
// Only one set of these pointer is valid at any instance
- G722_1_16_encinst_t_* _encoderInst16Ptr;
- G722_1_16_encinst_t_* _encoderInst16PtrR;
- G722_1_24_encinst_t_* _encoderInst24Ptr;
- G722_1_24_encinst_t_* _encoderInst24PtrR;
- G722_1_32_encinst_t_* _encoderInst32Ptr;
- G722_1_32_encinst_t_* _encoderInst32PtrR;
+ G722_1_16_encinst_t_* encoder_inst16_ptr_;
+ G722_1_16_encinst_t_* encoder_inst16_ptr_right_;
+ G722_1_24_encinst_t_* encoder_inst24_ptr_;
+ G722_1_24_encinst_t_* encoder_inst24_ptr_right_;
+ G722_1_32_encinst_t_* encoder_inst32_ptr_;
+ G722_1_32_encinst_t_* encoder_inst32_ptr_right_;
// Only one of these pointer is valid at any instance
- G722_1_16_decinst_t_* _decoderInst16Ptr;
- G722_1_24_decinst_t_* _decoderInst24Ptr;
- G722_1_32_decinst_t_* _decoderInst32Ptr;
+ G722_1_16_decinst_t_* decoder_inst16_ptr_;
+ G722_1_24_decinst_t_* decoder_inst24_ptr_;
+ G722_1_32_decinst_t_* decoder_inst32_ptr_;
};
-} // namespace webrtc
+} // namespace webrtc
-#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1_H_
+#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7221c.cc b/webrtc/modules/audio_coding/main/source/acm_g7221c.cc
index 6d055d6..3930ffa 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7221c.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_g7221c.cc
@@ -8,13 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_g7221c.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
-#include "trace.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7221c.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_G722_1C
// NOTE! G.722.1C is not included in the open-source package. The following
@@ -24,62 +25,63 @@
//
// The API in the header file should match the one below.
//
-// int16_t WebRtcG7221C_CreateEnc24(G722_1C_24_encinst_t_** encInst);
-// int16_t WebRtcG7221C_CreateEnc32(G722_1C_32_encinst_t_** encInst);
-// int16_t WebRtcG7221C_CreateEnc48(G722_1C_48_encinst_t_** encInst);
-// int16_t WebRtcG7221C_CreateDec24(G722_1C_24_decinst_t_** decInst);
-// int16_t WebRtcG7221C_CreateDec32(G722_1C_32_decinst_t_** decInst);
-// int16_t WebRtcG7221C_CreateDec48(G722_1C_48_decinst_t_** decInst);
+
+// int16_t WebRtcG7221C_CreateEnc24(G722_1C_24_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_CreateEnc32(G722_1C_32_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_CreateEnc48(G722_1C_48_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_CreateDec24(G722_1C_24_decinst_t_** dec_inst);
+// int16_t WebRtcG7221C_CreateDec32(G722_1C_32_decinst_t_** dec_inst);
+// int16_t WebRtcG7221C_CreateDec48(G722_1C_48_decinst_t_** dec_inst);
//
-// int16_t WebRtcG7221C_FreeEnc24(G722_1C_24_encinst_t_** encInst);
-// int16_t WebRtcG7221C_FreeEnc32(G722_1C_32_encinst_t_** encInst);
-// int16_t WebRtcG7221C_FreeEnc48(G722_1C_48_encinst_t_** encInst);
-// int16_t WebRtcG7221C_FreeDec24(G722_1C_24_decinst_t_** decInst);
-// int16_t WebRtcG7221C_FreeDec32(G722_1C_32_decinst_t_** decInst);
-// int16_t WebRtcG7221C_FreeDec48(G722_1C_48_decinst_t_** decInst);
+// int16_t WebRtcG7221C_FreeEnc24(G722_1C_24_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_FreeEnc32(G722_1C_32_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_FreeEnc48(G722_1C_48_encinst_t_** enc_inst);
+// int16_t WebRtcG7221C_FreeDec24(G722_1C_24_decinst_t_** dec_inst);
+// int16_t WebRtcG7221C_FreeDec32(G722_1C_32_decinst_t_** dec_inst);
+// int16_t WebRtcG7221C_FreeDec48(G722_1C_48_decinst_t_** dec_inst);
//
-// int16_t WebRtcG7221C_EncoderInit24(G722_1C_24_encinst_t_* encInst);
-// int16_t WebRtcG7221C_EncoderInit32(G722_1C_32_encinst_t_* encInst);
-// int16_t WebRtcG7221C_EncoderInit48(G722_1C_48_encinst_t_* encInst);
-// int16_t WebRtcG7221C_DecoderInit24(G722_1C_24_decinst_t_* decInst);
-// int16_t WebRtcG7221C_DecoderInit32(G722_1C_32_decinst_t_* decInst);
-// int16_t WebRtcG7221C_DecoderInit48(G722_1C_48_decinst_t_* decInst);
+// int16_t WebRtcG7221C_EncoderInit24(G722_1C_24_encinst_t_* enc_inst);
+// int16_t WebRtcG7221C_EncoderInit32(G722_1C_32_encinst_t_* enc_inst);
+// int16_t WebRtcG7221C_EncoderInit48(G722_1C_48_encinst_t_* enc_inst);
+// int16_t WebRtcG7221C_DecoderInit24(G722_1C_24_decinst_t_* dec_inst);
+// int16_t WebRtcG7221C_DecoderInit32(G722_1C_32_decinst_t_* dec_inst);
+// int16_t WebRtcG7221C_DecoderInit48(G722_1C_48_decinst_t_* dec_inst);
//
-// int16_t WebRtcG7221C_Encode24(G722_1C_24_encinst_t_* encInst,
+// int16_t WebRtcG7221C_Encode24(G722_1C_24_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221C_Encode32(G722_1C_32_encinst_t_* encInst,
+// int16_t WebRtcG7221C_Encode32(G722_1C_32_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221C_Encode48(G722_1C_48_encinst_t_* encInst,
+// int16_t WebRtcG7221C_Encode48(G722_1C_48_encinst_t_* enc_inst,
// int16_t* input,
// int16_t len,
// int16_t* output);
//
-// int16_t WebRtcG7221C_Decode24(G722_1C_24_decinst_t_* decInst,
+// int16_t WebRtcG7221C_Decode24(G722_1C_24_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221C_Decode32(G722_1C_32_decinst_t_* decInst,
+// int16_t WebRtcG7221C_Decode32(G722_1C_32_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
-// int16_t WebRtcG7221C_Decode48(G722_1C_48_decinst_t_* decInst,
+// int16_t WebRtcG7221C_Decode48(G722_1C_48_decinst_t_* dec_inst,
// int16_t* bitstream,
// int16_t len,
// int16_t* output);
//
-// int16_t WebRtcG7221C_DecodePlc24(G722_1C_24_decinst_t_* decInst,
+// int16_t WebRtcG7221C_DecodePlc24(G722_1C_24_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
-// int16_t WebRtcG7221C_DecodePlc32(G722_1C_32_decinst_t_* decInst,
+// int16_t nr_lost_frames);
+// int16_t WebRtcG7221C_DecodePlc32(G722_1C_32_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
-// int16_t WebRtcG7221C_DecodePlc48(G722_1C_48_decinst_t_* decInst,
+// int16_t nr_lost_frames);
+// int16_t WebRtcG7221C_DecodePlc48(G722_1C_48_decinst_t_* dec_inst,
// int16_t* output,
-// int16_t nrLostFrames);
+// int16_t nr_lost_frames);
#include "g7221c_interface.h"
#endif
@@ -87,20 +89,20 @@
#ifndef WEBRTC_CODEC_G722_1C
-ACMG722_1C::ACMG722_1C(WebRtc_Word16 /* codecID */)
- : _operationalRate(-1),
- _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 /* codec_id */)
+ : operational_rate_(-1),
+ encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoder_inst24_ptr_(NULL),
+ encoder_inst24_ptr_right_(NULL),
+ encoder_inst32_ptr_(NULL),
+ encoder_inst32_ptr_right_(NULL),
+ encoder_inst48_ptr_(NULL),
+ encoder_inst48_ptr_right_(NULL),
+ decoder_inst24_ptr_(NULL),
+ decoder_inst32_ptr_(NULL),
+ decoder_inst48_ptr_(NULL) {
return;
}
@@ -109,31 +111,31 @@
}
WebRtc_Word16 ACMG722_1C::InternalEncode(
- WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
- WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
+ WebRtc_Word16* /* audio */,
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722_1C::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722_1C::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -157,66 +159,74 @@
return;
}
-void ACMG722_1C::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMG722_1C::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
#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) {
- _codecID = codecID;
- if (_codecID == ACMCodecDB::kG722_1C_24) {
- _operationalRate = 24000;
- } else if (_codecID == ACMCodecDB::kG722_1C_32) {
- _operationalRate = 32000;
- } else if (_codecID == ACMCodecDB::kG722_1C_48) {
- _operationalRate = 48000;
+ACMG722_1C::ACMG722_1C(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ encoder_inst_ptr_right_(NULL),
+ decoder_inst_ptr_(NULL),
+ encoder_inst24_ptr_(NULL),
+ encoder_inst24_ptr_right_(NULL),
+ encoder_inst32_ptr_(NULL),
+ encoder_inst32_ptr_right_(NULL),
+ encoder_inst48_ptr_(NULL),
+ encoder_inst48_ptr_right_(NULL),
+ decoder_inst24_ptr_(NULL),
+ decoder_inst32_ptr_(NULL),
+ decoder_inst48_ptr_(NULL) {
+ codec_id_ = codec_id;
+ if (codec_id_ == ACMCodecDB::kG722_1C_24) {
+ operational_rate_ = 24000;
+ } else if (codec_id_ == ACMCodecDB::kG722_1C_32) {
+ operational_rate_ = 32000;
+ } else if (codec_id_ == ACMCodecDB::kG722_1C_48) {
+ operational_rate_ = 48000;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Wrong codec id for G722_1c.");
- _operationalRate = -1;
+ operational_rate_ = -1;
}
return;
}
ACMG722_1C::~ACMG722_1C() {
- if (_encoderInstPtr != NULL) {
- delete _encoderInstPtr;
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ delete encoder_inst_ptr_;
+ encoder_inst_ptr_ = NULL;
}
- if (_encoderInstPtrRight != NULL) {
- delete _encoderInstPtrRight;
- _encoderInstPtrRight = NULL;
+ if (encoder_inst_ptr_right_ != NULL) {
+ delete encoder_inst_ptr_right_;
+ encoder_inst_ptr_right_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- delete _decoderInstPtr;
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ delete decoder_inst_ptr_;
+ decoder_inst_ptr_ = NULL;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 24000: {
- _encoderInst24Ptr = NULL;
- _encoderInst24PtrR = NULL;
- _decoderInst24Ptr = NULL;
+ encoder_inst24_ptr_ = NULL;
+ encoder_inst24_ptr_right_ = NULL;
+ decoder_inst24_ptr_ = NULL;
break;
}
case 32000: {
- _encoderInst32Ptr = NULL;
- _encoderInst32PtrR = NULL;
- _decoderInst32Ptr = NULL;
+ encoder_inst32_ptr_ = NULL;
+ encoder_inst32_ptr_right_ = NULL;
+ decoder_inst32_ptr_ = NULL;
break;
}
case 48000: {
- _encoderInst48Ptr = NULL;
- _encoderInst48PtrR = NULL;
- _decoderInst48Ptr = NULL;
+ encoder_inst48_ptr_ = NULL;
+ encoder_inst48_ptr_right_ = NULL;
+ decoder_inst48_ptr_ = NULL;
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Wrong rate for G722_1c.");
break;
}
@@ -224,104 +234,107 @@
return;
}
-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];
+WebRtc_Word16 ACMG722_1C::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ WebRtc_Word16 left_channel[640];
+ WebRtc_Word16 right_channel[640];
+ WebRtc_Word16 len_in_bytes;
+ WebRtc_Word16 out_bits[240];
// If stereo, split input signal in left and right channel before encoding
- 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];
+ if (num_channels_ == 2) {
+ for (int i = 0, j = 0; i < frame_len_smpl_ * 2; i += 2, j++) {
+ left_channel[j] = in_audio_[in_audio_ix_read_ + i];
+ right_channel[j] = in_audio_[in_audio_ix_read_ + i + 1];
}
} else {
- memcpy(leftChannel, &_inAudio[_inAudioIxRead], 640);
+ memcpy(left_channel, &in_audio_[in_audio_ix_read_], 640);
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 24000: {
- lenInBytes = WebRtcG7221C_Encode24(_encoderInst24Ptr, leftChannel, 640,
- &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221C_Encode24(_encoderInst24PtrR, rightChannel,
- 640, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221C_Encode24(encoder_inst24_ptr_, left_channel,
+ 640, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221C_Encode24(encoder_inst24_ptr_right_,
+ right_channel, 640,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
case 32000: {
- lenInBytes = WebRtcG7221C_Encode32(_encoderInst32Ptr, leftChannel, 640,
- &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221C_Encode32(_encoderInst32PtrR, rightChannel,
- 640, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221C_Encode32(encoder_inst32_ptr_, left_channel,
+ 640, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221C_Encode32(encoder_inst32_ptr_right_,
+ right_channel, 640,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
case 48000: {
- lenInBytes = WebRtcG7221C_Encode48(_encoderInst48Ptr, leftChannel, 640,
- &outB[0]);
- if (_noChannels == 2) {
- lenInBytes += WebRtcG7221C_Encode48(_encoderInst48PtrR, rightChannel,
- 640, &outB[lenInBytes / 2]);
+ len_in_bytes = WebRtcG7221C_Encode48(encoder_inst48_ptr_, left_channel,
+ 640, &out_bits[0]);
+ if (num_channels_ == 2) {
+ len_in_bytes += WebRtcG7221C_Encode48(encoder_inst48_ptr_right_,
+ right_channel, 640,
+ &out_bits[len_in_bytes / 2]);
}
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: Wrong rate for G722_1c.");
return -1;
}
}
- memcpy(bitStream, outB, lenInBytes);
- *bitStreamLenByte = lenInBytes;
+ memcpy(bitstream, out_bits, len_in_bytes);
+ *bitstream_len_byte = len_in_bytes;
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += 640 * _noChannels;
+ in_audio_ix_read_ += 640 * num_channels_;
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG722_1C::InternalInitEncoder(
- WebRtcACMCodecParams* codecParams) {
+ WebRtcACMCodecParams* codec_params) {
WebRtc_Word16 ret;
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 24000: {
- ret = WebRtcG7221C_EncoderInit24(_encoderInst24PtrR);
+ ret = WebRtcG7221C_EncoderInit24(encoder_inst24_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221C_EncoderInit24(_encoderInst24Ptr);
+ return WebRtcG7221C_EncoderInit24(encoder_inst24_ptr_);
}
case 32000: {
- ret = WebRtcG7221C_EncoderInit32(_encoderInst32PtrR);
+ ret = WebRtcG7221C_EncoderInit32(encoder_inst32_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221C_EncoderInit32(_encoderInst32Ptr);
+ return WebRtcG7221C_EncoderInit32(encoder_inst32_ptr_);
}
case 48000: {
- ret = WebRtcG7221C_EncoderInit48(_encoderInst48PtrR);
+ ret = WebRtcG7221C_EncoderInit48(encoder_inst48_ptr_right_);
if (ret < 0) {
return ret;
}
- return WebRtcG7221C_EncoderInit48(_encoderInst48Ptr);
+ return WebRtcG7221C_EncoderInit48(encoder_inst48_ptr_);
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitEncode: Wrong rate for G722_1c.");
return -1;
}
@@ -329,30 +342,29 @@
}
WebRtc_Word16 ACMG722_1C::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- switch (_operationalRate) {
+ WebRtcACMCodecParams* /* codec_params */) {
+ switch (operational_rate_) {
case 24000: {
- return WebRtcG7221C_DecoderInit24(_decoderInst24Ptr);
+ return WebRtcG7221C_DecoderInit24(decoder_inst24_ptr_);
}
case 32000: {
- return WebRtcG7221C_DecoderInit32(_decoderInst32Ptr);
+ return WebRtcG7221C_DecoderInit32(decoder_inst32_ptr_);
}
case 48000: {
- return WebRtcG7221C_DecoderInit48(_decoderInst48Ptr);
+ return WebRtcG7221C_DecoderInit48(decoder_inst48_ptr_);
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: Wrong rate for G722_1c.");
return -1;
}
}
}
-WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
-
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: decoder not initialized for G722_1c");
return -1;
}
@@ -364,27 +376,27 @@
// "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) {
+ switch (operational_rate_) {
case 24000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1C_24, codecInst.pltype,
- _decoderInst24Ptr, 32000);
- SET_G722_1C_24_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1C_24, codec_inst.pltype,
+ decoder_inst24_ptr_, 32000);
+ SET_G722_1C_24_FUNCTIONS((codec_def));
break;
}
case 32000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1C_32, codecInst.pltype,
- _decoderInst32Ptr, 32000);
- SET_G722_1C_32_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1C_32, codec_inst.pltype,
+ decoder_inst32_ptr_, 32000);
+ SET_G722_1C_32_FUNCTIONS((codec_def));
break;
}
case 48000: {
- SET_CODEC_PAR((codecDef), kDecoderG722_1C_32, codecInst.pltype,
- _decoderInst48Ptr, 32000);
- SET_G722_1C_48_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG722_1C_32, codec_inst.pltype,
+ decoder_inst48_ptr_, 32000);
+ SET_G722_1C_48_FUNCTIONS((codec_def));
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: Wrong rate for G722_1c.");
return -1;
}
@@ -398,27 +410,27 @@
}
WebRtc_Word16 ACMG722_1C::InternalCreateEncoder() {
- if ((_encoderInstPtr == NULL) || (_encoderInstPtrRight == NULL)) {
+ if ((encoder_inst_ptr_ == NULL) || (encoder_inst_ptr_right_ == NULL)) {
return -1;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 24000: {
- WebRtcG7221C_CreateEnc24(&_encoderInst24Ptr);
- WebRtcG7221C_CreateEnc24(&_encoderInst24PtrR);
+ WebRtcG7221C_CreateEnc24(&encoder_inst24_ptr_);
+ WebRtcG7221C_CreateEnc24(&encoder_inst24_ptr_right_);
break;
}
case 32000: {
- WebRtcG7221C_CreateEnc32(&_encoderInst32Ptr);
- WebRtcG7221C_CreateEnc32(&_encoderInst32PtrR);
+ WebRtcG7221C_CreateEnc32(&encoder_inst32_ptr_);
+ WebRtcG7221C_CreateEnc32(&encoder_inst32_ptr_right_);
break;
}
case 48000: {
- WebRtcG7221C_CreateEnc48(&_encoderInst48Ptr);
- WebRtcG7221C_CreateEnc48(&_encoderInst48PtrR);
+ WebRtcG7221C_CreateEnc48(&encoder_inst48_ptr_);
+ WebRtcG7221C_CreateEnc48(&encoder_inst48_ptr_right_);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: Wrong rate for G722_1c.");
return -1;
}
@@ -427,42 +439,42 @@
}
void ACMG722_1C::DestructEncoderSafe() {
- _encoderExist = false;
- _encoderInitialized = false;
- if (_encoderInstPtr != NULL) {
- delete _encoderInstPtr;
- _encoderInstPtr = NULL;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ if (encoder_inst_ptr_ != NULL) {
+ delete encoder_inst_ptr_;
+ encoder_inst_ptr_ = NULL;
}
- if (_encoderInstPtrRight != NULL) {
- delete _encoderInstPtrRight;
- _encoderInstPtrRight = NULL;
+ if (encoder_inst_ptr_right_ != NULL) {
+ delete encoder_inst_ptr_right_;
+ encoder_inst_ptr_right_ = NULL;
}
- _encoderInst24Ptr = NULL;
- _encoderInst32Ptr = NULL;
- _encoderInst48Ptr = NULL;
+ encoder_inst24_ptr_ = NULL;
+ encoder_inst32_ptr_ = NULL;
+ encoder_inst48_ptr_ = NULL;
}
WebRtc_Word16 ACMG722_1C::InternalCreateDecoder() {
- if (_decoderInstPtr == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (decoder_inst_ptr_ == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: cannot create decoder");
return -1;
}
- switch (_operationalRate) {
+ switch (operational_rate_) {
case 24000: {
- WebRtcG7221C_CreateDec24(&_decoderInst24Ptr);
+ WebRtcG7221C_CreateDec24(&decoder_inst24_ptr_);
break;
}
case 32000: {
- WebRtcG7221C_CreateDec32(&_decoderInst32Ptr);
+ WebRtcG7221C_CreateDec32(&decoder_inst32_ptr_);
break;
}
case 48000: {
- WebRtcG7221C_CreateDec48(&_decoderInst48Ptr);
+ WebRtcG7221C_CreateDec48(&decoder_inst48_ptr_);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: Wrong rate for G722_1c.");
return -1;
}
@@ -471,24 +483,24 @@
}
void ACMG722_1C::DestructDecoderSafe() {
- _decoderExist = false;
- _decoderInitialized = false;
- if (_decoderInstPtr != NULL) {
- delete _decoderInstPtr;
- _decoderInstPtr = NULL;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
+ if (decoder_inst_ptr_ != NULL) {
+ delete decoder_inst_ptr_;
+ decoder_inst_ptr_ = NULL;
}
- _decoderInst24Ptr = NULL;
- _decoderInst32Ptr = NULL;
- _decoderInst48Ptr = NULL;
+ decoder_inst24_ptr_ = NULL;
+ decoder_inst32_ptr_ = NULL;
+ decoder_inst48_ptr_ = NULL;
}
-void ACMG722_1C::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- delete ptrInst;
+void ACMG722_1C::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ delete ptr_inst;
}
return;
}
#endif
-} // namespace webrtc
+} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7221c.h b/webrtc/modules/audio_coding/main/source/acm_g7221c.h
index ef573dc..4ce2d84 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7221c.h
+++ b/webrtc/modules/audio_coding/main/source/acm_g7221c.h
@@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_
-#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_
+#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221C_H_
+#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221C_H_
-#include "acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct G722_1C_24_encinst_t_;
@@ -24,67 +24,67 @@
namespace webrtc {
-class ACMG722_1C : public ACMGenericCodec
-{
-public:
- ACMG722_1C(WebRtc_Word16 codecID);
- ~ACMG722_1C();
- // for FEC
- ACMGenericCodec* CreateInstance(void);
+class ACMG722_1C : public ACMGenericCodec {
+ public:
+ explicit ACMG722_1C(WebRtc_Word16 codec_id);
+ ~ACMG722_1C();
- WebRtc_Word16 InternalEncode(
- WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ // for FEC
+ ACMGenericCodec* CreateInstance(void);
- WebRtc_Word16 InternalInitEncoder(
- WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalEncode(
+ WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitDecoder(
- WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(
+ WebRtcACMCodecParams *codec_params);
-protected:
- WebRtc_Word16 DecodeSafe(
- WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 InternalInitDecoder(
+ WebRtcACMCodecParams *codec_params);
- WebRtc_Word32 CodecDef(
- WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ protected:
+ WebRtc_Word16 DecodeSafe(
+ WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio,
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- void DestructEncoderSafe();
+ WebRtc_Word32 CodecDef(
+ WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
- void DestructDecoderSafe();
+ void DestructEncoderSafe();
- WebRtc_Word16 InternalCreateEncoder();
+ void DestructDecoderSafe();
- WebRtc_Word16 InternalCreateDecoder();
+ WebRtc_Word16 InternalCreateEncoder();
- void InternalDestructEncoderInst(
- void* ptrInst);
+ WebRtc_Word16 InternalCreateDecoder();
- WebRtc_Word32 _operationalRate;
+ void InternalDestructEncoderInst(
+ void* ptr_inst);
- G722_1_Inst_t_* _encoderInstPtr;
- G722_1_Inst_t_* _encoderInstPtrRight; //Used in stereo mode
- G722_1_Inst_t_* _decoderInstPtr;
+ WebRtc_Word32 operational_rate_;
- // Only one set of these pointer is valid at any instance
- G722_1C_24_encinst_t_* _encoderInst24Ptr;
- G722_1C_24_encinst_t_* _encoderInst24PtrR;
- G722_1C_32_encinst_t_* _encoderInst32Ptr;
- G722_1C_32_encinst_t_* _encoderInst32PtrR;
- G722_1C_48_encinst_t_* _encoderInst48Ptr;
- G722_1C_48_encinst_t_* _encoderInst48PtrR;
+ G722_1_Inst_t_* encoder_inst_ptr_;
+ G722_1_Inst_t_* encoder_inst_ptr_right_; // Used in stereo mode
+ G722_1_Inst_t_* decoder_inst_ptr_;
- // Only one of these pointer is valid at any instance
- G722_1C_24_decinst_t_* _decoderInst24Ptr;
- G722_1C_32_decinst_t_* _decoderInst32Ptr;
- G722_1C_48_decinst_t_* _decoderInst48Ptr;
+ // Only one set of these pointer is valid at any instance
+ G722_1C_24_encinst_t_* encoder_inst24_ptr_;
+ G722_1C_24_encinst_t_* encoder_inst24_ptr_right_;
+ G722_1C_32_encinst_t_* encoder_inst32_ptr_;
+ G722_1C_32_encinst_t_* encoder_inst32_ptr_right_;
+ G722_1C_48_encinst_t_* encoder_inst48_ptr_;
+ G722_1C_48_encinst_t_* encoder_inst48_ptr_right_;
+
+ // Only one of these pointer is valid at any instance
+ G722_1C_24_decinst_t_* decoder_inst24_ptr_;
+ G722_1C_32_decinst_t_* decoder_inst32_ptr_;
+ G722_1C_48_decinst_t_* decoder_inst48_ptr_;
};
-} // namespace webrtc;
+} // namespace webrtc;
-#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G722_1C_H_
+#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7221C_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_g729.cc b/webrtc/modules/audio_coding/main/source/acm_g729.cc
index f9bc781..031ccb7 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g729.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_g729.cc
@@ -8,12 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_g729.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g729.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_G729
// NOTE! G.729 is not included in the open-source package. Modify this file
@@ -26,9 +27,9 @@
#ifndef WEBRTC_CODEC_G729
-ACMG729::ACMG729(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
+ACMG729::ACMG729(WebRtc_Word16 /* codec_id */)
+: encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
return;
}
@@ -36,8 +37,9 @@
return;
}
-WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMG729::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
@@ -50,35 +52,35 @@
}
WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(
- const bool /*replaceInternalDTX*/) {
+ const bool /*replace_internal_dtx */) {
return -1;
}
WebRtc_Word32 ACMG729::IsInternalDTXReplacedSafe(
- bool* /* internalDTXReplaced */) {
+ bool* /* internal_dtx_replaced */) {
return -1;
}
-WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG729::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG729::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -102,63 +104,63 @@
return;
}
-void ACMG729::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMG729::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
#else //===================== Actual Implementation =======================
-ACMG729::ACMG729(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
- _codecID = codecID;
- _hasInternalDTX = true;
+ACMG729::ACMG729(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
+ codec_id_ = codec_id;
+ has_internal_dtx_ = true;
return;
}
ACMG729::~ACMG729() {
- if (_encoderInstPtr != NULL) {
+ if (encoder_inst_ptr_ != NULL) {
// Delete encoder memory
- WebRtcG729_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ WebRtcG729_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
+ if (decoder_inst_ptr_ != NULL) {
// Delete decoder memory
- WebRtcG729_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ WebRtcG729_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
+WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
// Initialize before entering the loop
- WebRtc_Word16 noEncodedSamples = 0;
- WebRtc_Word16 tmpLenByte = 0;
- WebRtc_Word16 vadDecision = 0;
- *bitStreamLenByte = 0;
- while (noEncodedSamples < _frameLenSmpl) {
+ WebRtc_Word16 num_encoded_samples = 0;
+ WebRtc_Word16 tmp_len_byte = 0;
+ WebRtc_Word16 vad_decision = 0;
+ *bitstream_len_byte = 0;
+ while (num_encoded_samples < frame_len_smpl_) {
// Call G.729 encoder with pointer to encoder memory, input
// audio, number of samples and bitsream
- tmpLenByte = WebRtcG729_Encode(
- _encoderInstPtr, &_inAudio[_inAudioIxRead], 80,
- (WebRtc_Word16*) (&(bitStream[*bitStreamLenByte])));
+ tmp_len_byte = WebRtcG729_Encode(
+ encoder_inst_ptr_, &in_audio_[in_audio_ix_read_], 80,
+ (WebRtc_Word16*)(&(bitstream[*bitstream_len_byte])));
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += 80;
+ in_audio_ix_read_ += 80;
// sanity check
- if (tmpLenByte < 0) {
+ if (tmp_len_byte < 0) {
// error has happened
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
}
// increment number of written bytes
- *bitStreamLenByte += tmpLenByte;
- switch (tmpLenByte) {
+ *bitstream_len_byte += tmp_len_byte;
+ switch (tmp_len_byte) {
case 0: {
- if (0 == noEncodedSamples) {
+ if (0 == num_encoded_samples) {
// this is the first 10 ms in this packet and there is
// no data generated, perhaps DTX is enabled and the
// codec is not generating any bit-stream for this 10 ms.
@@ -169,18 +171,18 @@
}
case 2: {
// check if G.729 internal DTX is enabled
- if (_hasInternalDTX && _dtxEnabled) {
- vadDecision = 0;
+ if (has_internal_dtx_ && dtx_enabled_) {
+ vad_decision = 0;
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
- _vadLabel[n] = vadDecision;
+ vad_label_[n] = vad_decision;
}
}
// we got a SID and have to send out this packet no matter
// how much audio we have encoded
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
case 10: {
- vadDecision = 1;
+ vad_decision = 1;
// this is a valid length just continue encoding
break;
}
@@ -190,30 +192,30 @@
}
// update number of encoded samples
- noEncodedSamples += 80;
+ num_encoded_samples += 80;
}
// update VAD decision vector
- if (_hasInternalDTX && !vadDecision && _dtxEnabled) {
+ if (has_internal_dtx_ && !vad_decision && dtx_enabled_) {
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
- _vadLabel[n] = vadDecision;
+ vad_label_[n] = vad_decision;
}
}
// done encoding, return number of encoded bytes
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
WebRtc_Word16 ACMG729::EnableDTX() {
- if (_dtxEnabled) {
+ if (dtx_enabled_) {
// DTX already enabled, do nothing
return 0;
- } else if (_encoderExist) {
+ } else if (encoder_exist_) {
// Re-init the G.729 encoder to turn on DTX
- if (WebRtcG729_EncoderInit(_encoderInstPtr, 1) < 0) {
+ if (WebRtcG729_EncoderInit(encoder_inst_ptr_, 1) < 0) {
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
return 0;
} else {
return -1;
@@ -221,15 +223,15 @@
}
WebRtc_Word16 ACMG729::DisableDTX() {
- if (!_dtxEnabled) {
+ if (!dtx_enabled_) {
// DTX already dissabled, do nothing
return 0;
- } else if (_encoderExist) {
+ } else if (encoder_exist_) {
// Re-init the G.729 decoder to turn off DTX
- if (WebRtcG729_EncoderInit(_encoderInstPtr, 0) < 0) {
+ if (WebRtcG729_EncoderInit(encoder_inst_ptr_, 0) < 0) {
return -1;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -237,67 +239,67 @@
}
}
-WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(const bool replaceInternalDTX) {
+WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(const bool replace_internal_dtx) {
// This function is used to disable the G.729 built in DTX and use an
// external instead.
- if (replaceInternalDTX == _hasInternalDTX) {
+ if (replace_internal_dtx == has_internal_dtx_) {
// Make sure we keep the DTX/VAD setting if possible
- bool oldEnableDTX = _dtxEnabled;
- bool oldEnableVAD = _vadEnabled;
- ACMVADMode oldMode = _vadMode;
- if (replaceInternalDTX) {
+ bool old_enable_dtx = dtx_enabled_;
+ bool old_enable_vad = vad_enabled_;
+ ACMVADMode old_mode = vad_mode_;
+ if (replace_internal_dtx) {
// Disable internal DTX before enabling external DTX
DisableDTX();
} else {
// Disable external DTX before enabling internal
ACMGenericCodec::DisableDTX();
}
- _hasInternalDTX = !replaceInternalDTX;
- WebRtc_Word16 status = SetVADSafe(oldEnableDTX, oldEnableVAD, oldMode);
+ has_internal_dtx_ = !replace_internal_dtx;
+ WebRtc_Word16 status = SetVADSafe(old_enable_dtx, old_enable_vad, old_mode);
// Check if VAD status has changed from inactive to active, or if error was
// reported
if (status == 1) {
- _vadEnabled = true;
+ vad_enabled_ = true;
return status;
} else if (status < 0) {
- _hasInternalDTX = replaceInternalDTX;
+ has_internal_dtx_ = replace_internal_dtx;
return -1;
}
}
return 0;
}
-WebRtc_Word32 ACMG729::IsInternalDTXReplacedSafe(bool* internalDTXReplaced) {
+WebRtc_Word32 ACMG729::IsInternalDTXReplacedSafe(bool* internal_dtx_replaced) {
// Get status of wether DTX is replaced or not
- *internalDTXReplaced = !_hasInternalDTX;
+ *internal_dtx_replaced = !has_internal_dtx_;
return 0;
}
-WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
// This function is not used. G.729 decoder is called from inside NetEQ
return 0;
}
-WebRtc_Word16 ACMG729::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMG729::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// Init G.729 encoder
- return WebRtcG729_EncoderInit(_encoderInstPtr,
- ((codecParams->enableDTX) ? 1 : 0));
+ return WebRtcG729_EncoderInit(encoder_inst_ptr_,
+ ((codec_params->enable_dtx) ? 1 : 0));
}
WebRtc_Word16 ACMG729::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// Init G.729 decoder
- return WebRtcG729_DecoderInit(_decoderInstPtr);
+ return WebRtcG729_DecoderInit(decoder_inst_ptr_);
}
-WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
+WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
// Todo:
// log error
return -1;
@@ -307,9 +309,9 @@
// "SET_CODEC_PAR" & "SET_G729_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderG729, codecInst.pltype, _decoderInstPtr,
+ SET_CODEC_PAR((codec_def), kDecoderG729, codec_inst.pltype, decoder_inst_ptr_,
8000);
- SET_G729_FUNCTIONS((codecDef));
+ SET_G729_FUNCTIONS((codec_def));
return 0;
}
@@ -320,37 +322,37 @@
WebRtc_Word16 ACMG729::InternalCreateEncoder() {
// Create encoder memory
- return WebRtcG729_CreateEnc(&_encoderInstPtr);
+ return WebRtcG729_CreateEnc(&encoder_inst_ptr_);
}
void ACMG729::DestructEncoderSafe() {
// Free encoder memory
- _encoderExist = false;
- _encoderInitialized = false;
- if (_encoderInstPtr != NULL) {
- WebRtcG729_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcG729_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
}
WebRtc_Word16 ACMG729::InternalCreateDecoder() {
// Create decoder memory
- return WebRtcG729_CreateDec(&_decoderInstPtr);
+ return WebRtcG729_CreateDec(&decoder_inst_ptr_);
}
void ACMG729::DestructDecoderSafe() {
// Free decoder memory
- _decoderExist = false;
- _decoderInitialized = false;
- if (_decoderInstPtr != NULL) {
- WebRtcG729_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcG729_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
}
-void ACMG729::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcG729_FreeEnc((G729_encinst_t_*) ptrInst);
+void ACMG729::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcG729_FreeEnc((G729_encinst_t_*) ptr_inst);
}
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_g729.h b/webrtc/modules/audio_coding/main/source/acm_g729.h
index 5d8d4a8..e923a32 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g729.h
+++ b/webrtc/modules/audio_coding/main/source/acm_g729.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct G729_encinst_t_;
@@ -21,27 +21,28 @@
class ACMG729 : public ACMGenericCodec {
public:
- ACMG729(WebRtc_Word16 codecID);
+ explicit ACMG729(WebRtc_Word16 codec_id);
~ACMG729();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -51,18 +52,18 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX();
WebRtc_Word16 DisableDTX();
- WebRtc_Word32 ReplaceInternalDTXSafe(const bool replaceInternalDTX);
+ WebRtc_Word32 ReplaceInternalDTXSafe(const bool replace_internal_dtx);
- WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internalDTXReplaced);
+ WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
- G729_encinst_t_* _encoderInstPtr;
- G729_decinst_t_* _decoderInstPtr;
+ G729_encinst_t_* encoder_inst_ptr_;
+ G729_decinst_t_* decoder_inst_ptr_;
};
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7291.cc b/webrtc/modules/audio_coding/main/source/acm_g7291.cc
index 0726dec..89c984a 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7291.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_g7291.cc
@@ -8,30 +8,30 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_g7291.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_g7291.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_G729_1
// NOTE! G.729.1 is not included in the open-source package. Modify this file
// or your codec API to match the function calls and names of used G.729.1 API
// file.
- #include "g7291_interface.h"
+#include "g7291_interface.h"
#endif
namespace webrtc {
#ifndef WEBRTC_CODEC_G729_1
-ACMG729_1::ACMG729_1(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _myRate(32000),
- _flag8kHz(0),
- _flagG729mode(0) {
+ACMG729_1::ACMG729_1(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ my_rate_(32000),
+ flag_8khz_(0),
+ flag_g729_mode_(0) {
return;
}
@@ -39,31 +39,32 @@
return;
}
-WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMG729_1::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG729_1::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG729_1::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -87,7 +88,7 @@
return;
}
-void ACMG729_1::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMG729_1::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -99,113 +100,114 @@
struct G729_1_inst_t_;
-ACMG729_1::ACMG729_1(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _myRate(32000), // Default rate.
- _flag8kHz(0),
- _flagG729mode(0) {
- // TODO(tlegrand): We should add codecID as a input variable to the
+ACMG729_1::ACMG729_1(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ my_rate_(32000), // Default rate.
+ flag_8khz_(0),
+ flag_g729_mode_(0) {
+ // TODO(tlegrand): We should add codec_id as a input variable to the
// constructor of ACMGenericCodec.
- _codecID = codecID;
+ codec_id_ = codec_id;
return;
}
ACMG729_1::~ACMG729_1() {
- if (_encoderInstPtr != NULL) {
- WebRtcG7291_Free(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcG7291_Free(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcG7291_Free(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcG7291_Free(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
+WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
// Initialize before entering the loop
- WebRtc_Word16 noEncodedSamples = 0;
- *bitStreamLenByte = 0;
+ WebRtc_Word16 num_encoded_samples = 0;
+ *bitstream_len_byte = 0;
- WebRtc_Word16 byteLengthFrame = 0;
+ WebRtc_Word16 byte_length_frame = 0;
// Derive number of 20ms frames per encoded packet.
// [1,2,3] <=> [20,40,60]ms <=> [320,640,960] samples
- WebRtc_Word16 n20msFrames = (_frameLenSmpl / 320);
+ WebRtc_Word16 num_20ms_frames = (frame_len_smpl_ / 320);
// Byte length for the frame. +1 is for rate information.
- byteLengthFrame = _myRate / (8 * 50) * n20msFrames + (1 - _flagG729mode);
+ byte_length_frame = my_rate_ / (8 * 50) * num_20ms_frames + (1 -
+ flag_g729_mode_);
// The following might be revised if we have G729.1 Annex C (support for DTX);
do {
- *bitStreamLenByte = WebRtcG7291_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- (WebRtc_Word16*) bitStream, _myRate,
- n20msFrames);
+ *bitstream_len_byte = WebRtcG7291_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ (WebRtc_Word16*) bitstream,
+ my_rate_, num_20ms_frames);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += 160;
+ in_audio_ix_read_ += 160;
// sanity check
- if (*bitStreamLenByte < 0) {
+ if (*bitstream_len_byte < 0) {
// error has happened
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: Encode error for G729_1");
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
}
- noEncodedSamples += 160;
- } while (*bitStreamLenByte == 0);
+ num_encoded_samples += 160;
+ } while (*bitstream_len_byte == 0);
// This criteria will change if we have Annex C.
- if (*bitStreamLenByte != byteLengthFrame) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (*bitstream_len_byte != byte_length_frame) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: Encode error for G729_1");
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
}
- if (noEncodedSamples != _frameLenSmpl) {
- *bitStreamLenByte = 0;
+ if (num_encoded_samples != frame_len_smpl_) {
+ *bitstream_len_byte = 0;
return -1;
}
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG729_1::InternalInitEncoder(
- WebRtcACMCodecParams* codecParams) {
+ WebRtcACMCodecParams* codec_params) {
//set the bit rate and initialize
- _myRate = codecParams->codecInstant.rate;
- return SetBitRateSafe((WebRtc_UWord32) _myRate);
+ my_rate_ = codec_params->codec_inst.rate;
+ return SetBitRateSafe((WebRtc_UWord32) my_rate_);
}
WebRtc_Word16 ACMG729_1::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- if (WebRtcG7291_DecoderInit(_decoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WebRtcACMCodecParams* /* codec_params */) {
+ if (WebRtcG7291_DecoderInit(decoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: init decoder failed for G729_1");
return -1;
}
return 0;
}
-WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: Decoder uninitialized for G729_1");
return -1;
}
@@ -214,9 +216,9 @@
// "SET_CODEC_PAR" & "SET_G729_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderG729_1, codecInst.pltype, _decoderInstPtr,
- 16000);
- SET_G729_1_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderG729_1, codec_inst.pltype,
+ decoder_inst_ptr_, 16000);
+ SET_G729_1_FUNCTIONS((codec_def));
return 0;
}
@@ -225,8 +227,8 @@
}
WebRtc_Word16 ACMG729_1::InternalCreateEncoder() {
- if (WebRtcG7291_Create(&_encoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcG7291_Create(&encoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: create encoder failed for G729_1");
return -1;
}
@@ -234,17 +236,17 @@
}
void ACMG729_1::DestructEncoderSafe() {
- _encoderExist = false;
- _encoderInitialized = false;
- if (_encoderInstPtr != NULL) {
- WebRtcG7291_Free(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcG7291_Free(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
}
WebRtc_Word16 ACMG729_1::InternalCreateDecoder() {
- if (WebRtcG7291_Create(&_decoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcG7291_Create(&decoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: create decoder failed for G729_1");
return -1;
}
@@ -252,86 +254,86 @@
}
void ACMG729_1::DestructDecoderSafe() {
- _decoderExist = false;
- _decoderInitialized = false;
- if (_decoderInstPtr != NULL) {
- WebRtcG7291_Free(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcG7291_Free(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
}
-void ACMG729_1::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- //WebRtcG7291_Free((G729_1_inst_t*)ptrInst);
+void ACMG729_1::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ // WebRtcG7291_Free((G729_1_inst_t*)ptrInst);
}
return;
}
WebRtc_Word16 ACMG729_1::SetBitRateSafe(const WebRtc_Word32 rate) {
- //allowed rates: { 8000, 12000, 14000, 16000, 18000, 20000,
+ // allowed rates: { 8000, 12000, 14000, 16000, 18000, 20000,
// 22000, 24000, 26000, 28000, 30000, 32000};
// TODO(tlegrand): This check exists in one other place two. Should be
// possible to reuse code.
switch (rate) {
case 8000: {
- _myRate = 8000;
+ my_rate_ = 8000;
break;
}
case 12000: {
- _myRate = 12000;
+ my_rate_ = 12000;
break;
}
case 14000: {
- _myRate = 14000;
+ my_rate_ = 14000;
break;
}
case 16000: {
- _myRate = 16000;
+ my_rate_ = 16000;
break;
}
case 18000: {
- _myRate = 18000;
+ my_rate_ = 18000;
break;
}
case 20000: {
- _myRate = 20000;
+ my_rate_ = 20000;
break;
}
case 22000: {
- _myRate = 22000;
+ my_rate_ = 22000;
break;
}
case 24000: {
- _myRate = 24000;
+ my_rate_ = 24000;
break;
}
case 26000: {
- _myRate = 26000;
+ my_rate_ = 26000;
break;
}
case 28000: {
- _myRate = 28000;
+ my_rate_ = 28000;
break;
}
case 30000: {
- _myRate = 30000;
+ my_rate_ = 30000;
break;
}
case 32000: {
- _myRate = 32000;
+ my_rate_ = 32000;
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: Invalid rate G729_1");
return -1;
}
}
// Re-init with new rate
- if (WebRtcG7291_EncoderInit(_encoderInstPtr, _myRate, _flag8kHz,
- _flagG729mode) >= 0) {
- _encoderParams.codecInstant.rate = _myRate;
+ if (WebRtcG7291_EncoderInit(encoder_inst_ptr_, my_rate_, flag_8khz_,
+ flag_g729_mode_) >= 0) {
+ encoder_params_.codec_inst.rate = my_rate_;
return 0;
} else {
return -1;
diff --git a/webrtc/modules/audio_coding/main/source/acm_g7291.h b/webrtc/modules/audio_coding/main/source/acm_g7291.h
index 35f07ff..d55c51b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_g7291.h
+++ b/webrtc/modules/audio_coding/main/source/acm_g7291.h
@@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_
-#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_
+#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7291_H_
+#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7291_H_
-#include "acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct G729_1_inst_t_;
@@ -21,27 +21,28 @@
class ACMG729_1 : public ACMGenericCodec {
public:
- ACMG729_1(WebRtc_Word16 codecID);
+ explicit ACMG729_1(WebRtc_Word16 codec_id);
~ACMG729_1();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -51,18 +52,18 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
- G729_1_inst_t_* _encoderInstPtr;
- G729_1_inst_t_* _decoderInstPtr;
+ G729_1_inst_t_* encoder_inst_ptr_;
+ G729_1_inst_t_* decoder_inst_ptr_;
- WebRtc_UWord16 _myRate;
- WebRtc_Word16 _flag8kHz;
- WebRtc_Word16 _flagG729mode;
+ WebRtc_UWord16 my_rate_;
+ WebRtc_Word16 flag_8khz_;
+ WebRtc_Word16 flag_g729_mode_;
};
} // namespace webrtc
-#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G729_1_H_
+#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_G7291_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc b/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc
index c39edcd..7d84658 100644
--- a/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_generic_codec.cc
@@ -8,16 +8,17 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
+
#include <assert.h>
#include <string.h>
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_generic_codec.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_vad.h"
-#include "webrtc_cng.h"
+#include "webrtc/common_audio/vad/include/webrtc_vad.h"
+#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -36,285 +37,289 @@
// 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),
- _inAudioIxRead(0),
- _inTimestampIxWrite(0),
- _inAudio(NULL),
- _inTimestamp(NULL),
- _frameLenSmpl(-1), // invalid value
- _noChannels(1),
- _codecID(-1), // invalid value
- _noMissedSamples(0),
- _encoderExist(false),
- _decoderExist(false),
- _encoderInitialized(false),
- _decoderInitialized(false),
- _registeredInNetEq(false),
- _hasInternalDTX(false),
- _ptrVADInst(NULL),
- _vadEnabled(false),
- _vadMode(VADNormal),
- _dtxEnabled(false),
- _ptrDTXInst(NULL),
- _numLPCParams(kNewCNGNumPLCParams),
- _sentCNPrevious(false),
- _isMaster(true),
- _prev_frame_cng(0),
- _netEqDecodeLock(NULL),
- _codecWrapperLock(*RWLockWrapper::CreateRWLock()),
- _lastEncodedTimestamp(0),
- _lastTimestamp(0xD87F3F9F),
- _isAudioBuffFresh(true),
- _uniqueID(0) {
+ : in_audio_ix_write_(0),
+ in_audio_ix_read_(0),
+ in_timestamp_ix_write_(0),
+ in_audio_(NULL),
+ in_timestamp_(NULL),
+ frame_len_smpl_(-1), // invalid value
+ num_channels_(1),
+ codec_id_(-1), // invalid value
+ num_missed_samples_(0),
+ encoder_exist_(false),
+ decoder_exist_(false),
+ encoder_initialized_(false),
+ decoder_initialized_(false),
+ registered_in_neteq_(false),
+ has_internal_dtx_(false),
+ ptr_vad_inst_(NULL),
+ vad_enabled_(false),
+ vad_mode_(VADNormal),
+ dtx_enabled_(false),
+ ptr_dtx_inst_(NULL),
+ num_lpc_params_(kNewCNGNumPLCParams),
+ sent_cn_previous_(false),
+ is_master_(true),
+ prev_frame_cng_(0),
+ neteq_decode_lock_(NULL),
+ codec_wrapper_lock_(*RWLockWrapper::CreateRWLock()),
+ last_encoded_timestamp_(0),
+ last_timestamp_(0xD87F3F9F),
+ is_audio_buff_fresh_(true),
+ unique_id_(0) {
// Initialize VAD vector.
for (int i = 0; i < MAX_FRAME_SIZE_10MSEC; i++) {
- _vadLabel[i] = 0;
+ vad_label_[i] = 0;
}
// Nullify memory for encoder and decoder, and set payload type to an
// invalid value.
- memset(&_encoderParams, 0, sizeof(WebRtcACMCodecParams));
- _encoderParams.codecInstant.pltype = -1;
- memset(&_decoderParams, 0, sizeof(WebRtcACMCodecParams));
- _decoderParams.codecInstant.pltype = -1;
+ memset(&encoder_params_, 0, sizeof(WebRtcACMCodecParams));
+ encoder_params_.codec_inst.pltype = -1;
+ memset(&decoder_params_, 0, sizeof(WebRtcACMCodecParams));
+ decoder_params_.codec_inst.pltype = -1;
}
ACMGenericCodec::~ACMGenericCodec() {
// Check all the members which are pointers, and if they are not NULL
// delete/free them.
- if (_ptrVADInst != NULL) {
- WebRtcVad_Free(_ptrVADInst);
- _ptrVADInst = NULL;
+ if (ptr_vad_inst_ != NULL) {
+ WebRtcVad_Free(ptr_vad_inst_);
+ ptr_vad_inst_ = NULL;
}
- if (_inAudio != NULL) {
- delete[] _inAudio;
- _inAudio = NULL;
+ if (in_audio_ != NULL) {
+ delete[] in_audio_;
+ in_audio_ = NULL;
}
- if (_inTimestamp != NULL) {
- delete[] _inTimestamp;
- _inTimestamp = NULL;
+ if (in_timestamp_ != NULL) {
+ delete[] in_timestamp_;
+ in_timestamp_ = NULL;
}
- if (_ptrDTXInst != NULL) {
- WebRtcCng_FreeEnc(_ptrDTXInst);
- _ptrDTXInst = NULL;
+ if (ptr_dtx_inst_ != NULL) {
+ WebRtcCng_FreeEnc(ptr_dtx_inst_);
+ ptr_dtx_inst_ = NULL;
}
- delete &_codecWrapperLock;
+ delete &codec_wrapper_lock_;
}
int32_t ACMGenericCodec::Add10MsData(const uint32_t timestamp,
const int16_t* data,
- const uint16_t lengthSmpl,
- const uint8_t audioChannel) {
- WriteLockScoped wl(_codecWrapperLock);
- return Add10MsDataSafe(timestamp, data, lengthSmpl, audioChannel);
+ const uint16_t length_smpl,
+ const uint8_t audio_channel) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ return Add10MsDataSafe(timestamp, data, length_smpl, audio_channel);
}
int32_t ACMGenericCodec::Add10MsDataSafe(const uint32_t timestamp,
const int16_t* data,
- const uint16_t lengthSmpl,
- const uint8_t audioChannel) {
+ const uint16_t length_smpl,
+ const uint8_t audio_channel) {
// The codec expects to get data in correct sampling rate. Get the sampling
// frequency of the codec.
- uint16_t plFreqHz;
- if (EncoderSampFreq(plFreqHz) < 0) {
- // _codecID is not correct, perhaps the codec is not initialized yet.
+ uint16_t plfreq_hz;
+ if (EncoderSampFreq(plfreq_hz) < 0) {
return -1;
}
// Sanity check to make sure the length of the input corresponds to 10 ms.
- if ((plFreqHz / 100) != lengthSmpl) {
+ if ((plfreq_hz / 100) != length_smpl) {
// This is not 10 ms of audio, given the sampling frequency of the codec.
return -1;
}
- if (_lastTimestamp == timestamp) {
+ if (last_timestamp_ == timestamp) {
// Same timestamp as the last time, overwrite.
- if ((_inAudioIxWrite >= lengthSmpl * audioChannel) &&
- (_inTimestampIxWrite > 0)) {
- _inAudioIxWrite -= lengthSmpl * audioChannel;
- _inTimestampIxWrite--;
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _uniqueID,
- "Adding 10ms with previous timestamp, overwriting the previous 10ms");
+ if ((in_audio_ix_write_ >= length_smpl * audio_channel) &&
+ (in_timestamp_ix_write_ > 0)) {
+ in_audio_ix_write_ -= length_smpl * audio_channel;
+ in_timestamp_ix_write_--;
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, unique_id_,
+ "Adding 10ms with previous timestamp, overwriting the "
+ "previous 10ms");
} else {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, unique_id_,
"Adding 10ms with previous timestamp, this will sound bad");
}
}
- _lastTimestamp = timestamp;
+ last_timestamp_ = timestamp;
// If the data exceeds the buffer size, we throw away the oldest data and
// add the newly received 10 msec at the end.
- if ((_inAudioIxWrite + lengthSmpl * audioChannel) > AUDIO_BUFFER_SIZE_W16) {
+ if ((in_audio_ix_write_ + length_smpl * audio_channel) >
+ AUDIO_BUFFER_SIZE_W16) {
// Get the number of samples to be overwritten.
- int16_t missedSamples = _inAudioIxWrite + lengthSmpl * audioChannel -
+ int16_t missed_samples = in_audio_ix_write_ + length_smpl * audio_channel -
AUDIO_BUFFER_SIZE_W16;
// Move the data (overwrite the old data).
- memmove(_inAudio, _inAudio + missedSamples,
- (AUDIO_BUFFER_SIZE_W16 - lengthSmpl * audioChannel) *
+ memmove(in_audio_, in_audio_ + missed_samples,
+ (AUDIO_BUFFER_SIZE_W16 - length_smpl * audio_channel) *
sizeof(int16_t));
// Copy the new data.
- memcpy(_inAudio + (AUDIO_BUFFER_SIZE_W16 - lengthSmpl * audioChannel), data,
- lengthSmpl * audioChannel * sizeof(int16_t));
+ memcpy(in_audio_ + (AUDIO_BUFFER_SIZE_W16 - length_smpl * audio_channel),
+ data, length_smpl * audio_channel * sizeof(int16_t));
// Get the number of 10 ms blocks which are overwritten.
- int16_t missed10MsecBlocks =static_cast<int16_t>(
- (missedSamples / audioChannel * 100) / plFreqHz);
+ int16_t missed_10ms_blocks =static_cast<int16_t>(
+ (missed_samples / audio_channel * 100) / plfreq_hz);
// Move the timestamps.
- memmove(_inTimestamp, _inTimestamp + missed10MsecBlocks,
- (_inTimestampIxWrite - missed10MsecBlocks) * sizeof(uint32_t));
- _inTimestampIxWrite -= missed10MsecBlocks;
- _inTimestamp[_inTimestampIxWrite] = timestamp;
- _inTimestampIxWrite++;
+ memmove(in_timestamp_, in_timestamp_ + missed_10ms_blocks,
+ (in_timestamp_ix_write_ - missed_10ms_blocks) * sizeof(uint32_t));
+ in_timestamp_ix_write_ -= missed_10ms_blocks;
+ in_timestamp_[in_timestamp_ix_write_] = timestamp;
+ in_timestamp_ix_write_++;
// Buffer is full.
- _inAudioIxWrite = AUDIO_BUFFER_SIZE_W16;
- IncreaseNoMissedSamples(missedSamples);
- _isAudioBuffFresh = false;
- return -missedSamples;
+ in_audio_ix_write_ = AUDIO_BUFFER_SIZE_W16;
+ IncreaseNoMissedSamples(missed_samples);
+ is_audio_buff_fresh_ = false;
+ return -missed_samples;
}
// Store the input data in our data buffer.
- memcpy(_inAudio + _inAudioIxWrite, data,
- lengthSmpl * audioChannel * sizeof(int16_t));
- _inAudioIxWrite += lengthSmpl * audioChannel;
+ memcpy(in_audio_ + in_audio_ix_write_, data,
+ length_smpl * audio_channel * sizeof(int16_t));
+ in_audio_ix_write_ += length_smpl * audio_channel;
- assert(_inTimestampIxWrite < TIMESTAMP_BUFFER_SIZE_W32);
- assert(_inTimestampIxWrite >= 0);
+ assert(in_timestamp_ix_write_ < TIMESTAMP_BUFFER_SIZE_W32);
+ assert(in_timestamp_ix_write_ >= 0);
- _inTimestamp[_inTimestampIxWrite] = timestamp;
- _inTimestampIxWrite++;
- _isAudioBuffFresh = false;
+ in_timestamp_[in_timestamp_ix_write_] = timestamp;
+ in_timestamp_ix_write_++;
+ is_audio_buff_fresh_ = false;
return 0;
}
bool ACMGenericCodec::HasFrameToEncode() const {
- ReadLockScoped lockCodec(_codecWrapperLock);
- if (_inAudioIxWrite < _frameLenSmpl * _noChannels)
+ ReadLockScoped lockCodec(codec_wrapper_lock_);
+ if (in_audio_ix_write_ < frame_len_smpl_ * num_channels_)
return false;
return true;
}
-int16_t ACMGenericCodec::Encode(uint8_t* bitStream,
- int16_t* bitStreamLenByte,
- uint32_t* timeStamp,
- WebRtcACMEncodingType* encodingType) {
+int16_t ACMGenericCodec::Encode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte,
+ uint32_t* timestamp,
+ WebRtcACMEncodingType* encoding_type) {
if (!HasFrameToEncode()) {
// There is not enough audio
- *timeStamp = 0;
- *bitStreamLenByte = 0;
+ *timestamp = 0;
+ *bitstream_len_byte = 0;
// Doesn't really matter what this parameter set to
- *encodingType = kNoEncoding;
+ *encoding_type = kNoEncoding;
return 0;
}
- WriteLockScoped lockCodec(_codecWrapperLock);
- ReadLockScoped lockNetEq(*_netEqDecodeLock);
+ WriteLockScoped lockCodec(codec_wrapper_lock_);
+ ReadLockScoped lockNetEq(*neteq_decode_lock_);
// Not all codecs accept the whole frame to be pushed into encoder at once.
// Some codecs needs to be feed with a specific number of samples different
// from the frame size. If this is the case, |myBasicCodingBlockSmpl| will
// report a number different from 0, and we will loop over calls to encoder
// further down, until we have encode a complete frame.
- const int16_t myBasicCodingBlockSmpl = ACMCodecDB::BasicCodingBlock(_codecID);
- if (myBasicCodingBlockSmpl < 0 || !_encoderInitialized || !_encoderExist) {
+ const int16_t my_basic_coding_block_smpl =
+ ACMCodecDB::BasicCodingBlock(codec_id_);
+ if (my_basic_coding_block_smpl < 0 || !encoder_initialized_ ||
+ !encoder_exist_) {
// This should not happen, but in case it does, report no encoding done.
- *timeStamp = 0;
- *bitStreamLenByte = 0;
- *encodingType = kNoEncoding;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ *timestamp = 0;
+ *bitstream_len_byte = 0;
+ *encoding_type = kNoEncoding;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EncodeSafe: error, basic coding sample block is negative");
return -1;
}
// This makes the internal encoder read from the beginning of the buffer.
- _inAudioIxRead = 0;
- *timeStamp = _inTimestamp[0];
+ in_audio_ix_read_ = 0;
+ *timestamp = in_timestamp_[0];
- // Process the audio through VAD. The function will set |_vadLabels|.
- // If VAD is disabled all entries in |_vadLabels| are set to ONE (active).
+ // Process the audio through VAD. The function will set |_vad_labels|.
+ // If VAD is disabled all entries in |_vad_labels| are set to ONE (active).
int16_t status = 0;
- int16_t dtxProcessedSamples = 0;
- status = ProcessFrameVADDTX(bitStream, bitStreamLenByte,
- &dtxProcessedSamples);
+ int16_t dtx_processed_samples = 0;
+ status = ProcessFrameVADDTX(bitstream, bitstream_len_byte,
+ &dtx_processed_samples);
if (status < 0) {
- *timeStamp = 0;
- *bitStreamLenByte = 0;
- *encodingType = kNoEncoding;
+ *timestamp = 0;
+ *bitstream_len_byte = 0;
+ *encoding_type = kNoEncoding;
} else {
- if (dtxProcessedSamples > 0) {
+ if (dtx_processed_samples > 0) {
// Dtx have processed some samples, and even if a bit-stream is generated
// we should not do any encoding (normally there won't be enough data).
// Setting the following makes sure that the move of audio data and
// timestamps done correctly.
- _inAudioIxRead = dtxProcessedSamples;
+ in_audio_ix_read_ = dtx_processed_samples;
// This will let the owner of ACMGenericCodec to know that the
// generated bit-stream is DTX to use correct payload type.
- uint16_t sampFreqHz;
- EncoderSampFreq(sampFreqHz);
- if (sampFreqHz == 8000) {
- *encodingType = kPassiveDTXNB;
- } else if (sampFreqHz == 16000) {
- *encodingType = kPassiveDTXWB;
- } else if (sampFreqHz == 32000) {
- *encodingType = kPassiveDTXSWB;
- } else if (sampFreqHz == 48000) {
- *encodingType = kPassiveDTXFB;
+ uint16_t samp_freq_hz;
+ EncoderSampFreq(samp_freq_hz);
+ if (samp_freq_hz == 8000) {
+ *encoding_type = kPassiveDTXNB;
+ } else if (samp_freq_hz == 16000) {
+ *encoding_type = kPassiveDTXWB;
+ } else if (samp_freq_hz == 32000) {
+ *encoding_type = kPassiveDTXSWB;
+ } else if (samp_freq_hz == 48000) {
+ *encoding_type = kPassiveDTXFB;
} else {
status = -1;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EncodeSafe: Wrong sampling frequency for DTX.");
}
// Transport empty frame if we have an empty bitstream.
- if ((*bitStreamLenByte == 0) &&
- (_sentCNPrevious || ((_inAudioIxWrite - _inAudioIxRead) <= 0))) {
+ if ((*bitstream_len_byte == 0) &&
+ (sent_cn_previous_ ||
+ ((in_audio_ix_write_ - in_audio_ix_read_) <= 0))) {
// Makes sure we transmit an empty frame.
- *bitStreamLenByte = 1;
- *encodingType = kNoEncoding;
+ *bitstream_len_byte = 1;
+ *encoding_type = kNoEncoding;
}
- _sentCNPrevious = true;
+ sent_cn_previous_ = true;
} else {
// We should encode the audio frame. Either VAD and/or DTX is off, or the
// audio was considered "active".
- _sentCNPrevious = false;
- if (myBasicCodingBlockSmpl == 0) {
+ sent_cn_previous_ = false;
+ if (my_basic_coding_block_smpl == 0) {
// This codec can handle all allowed frame sizes as basic coding block.
- status = InternalEncode(bitStream, bitStreamLenByte);
+ status = InternalEncode(bitstream, bitstream_len_byte);
if (status < 0) {
// TODO(tlegrand): Maybe reseting the encoder to be fresh for the next
// frame.
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding,
- _uniqueID, "EncodeSafe: error in internalEncode");
- *bitStreamLenByte = 0;
- *encodingType = kNoEncoding;
+ unique_id_, "EncodeSafe: error in internal_encode");
+ *bitstream_len_byte = 0;
+ *encoding_type = kNoEncoding;
}
} else {
// A basic-coding-block for this codec is defined so we loop over the
// audio with the steps of the basic-coding-block.
- int16_t tmpBitStreamLenByte;
+ int16_t tmp_bitstream_len_byte;
// Reset the variables which will be incremented in the loop.
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
bool done = false;
while (!done) {
- status = InternalEncode(&bitStream[*bitStreamLenByte],
- &tmpBitStreamLenByte);
- *bitStreamLenByte += tmpBitStreamLenByte;
+ status = InternalEncode(&bitstream[*bitstream_len_byte],
+ &tmp_bitstream_len_byte);
+ *bitstream_len_byte += tmp_bitstream_len_byte;
// Guard Against errors and too large payloads.
- if ((status < 0) || (*bitStreamLenByte > MAX_PAYLOAD_SIZE_BYTE)) {
+ if ((status < 0) || (*bitstream_len_byte > MAX_PAYLOAD_SIZE_BYTE)) {
// Error has happened, and even if we are in the middle of a full
// frame we have to exit. Before exiting, whatever bits are in the
// buffer are probably corrupted, so we ignore them.
- *bitStreamLenByte = 0;
- *encodingType = kNoEncoding;
+ *bitstream_len_byte = 0;
+ *encoding_type = kNoEncoding;
// We might have come here because of the second condition.
status = -1;
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding,
- _uniqueID, "EncodeSafe: error in InternalEncode");
+ unique_id_, "EncodeSafe: error in InternalEncode");
// break from the loop
break;
}
@@ -322,18 +327,18 @@
// TODO(andrew): This should be multiplied by the number of
// channels, right?
// http://code.google.com/p/webrtc/issues/detail?id=714
- done = _inAudioIxRead >= _frameLenSmpl;
+ done = in_audio_ix_read_ >= frame_len_smpl_;
}
}
if (status >= 0) {
- *encodingType = (_vadLabel[0] == 1) ? kActiveNormalEncoded :
+ *encoding_type = (vad_label_[0] == 1) ? kActiveNormalEncoded :
kPassiveNormalEncoded;
// Transport empty frame if we have an empty bitstream.
- if ((*bitStreamLenByte == 0) &&
- ((_inAudioIxWrite - _inAudioIxRead) <= 0)) {
+ if ((*bitstream_len_byte == 0) &&
+ ((in_audio_ix_write_ - in_audio_ix_read_) <= 0)) {
// Makes sure we transmit an empty frame.
- *bitStreamLenByte = 1;
- *encodingType = kNoEncoding;
+ *bitstream_len_byte = 1;
+ *encoding_type = kNoEncoding;
}
}
}
@@ -341,148 +346,148 @@
// Move the timestamp buffer according to the number of 10 ms blocks
// which are read.
- uint16_t sampFreqHz;
- EncoderSampFreq(sampFreqHz);
- int16_t num10MsecBlocks = static_cast<int16_t>(
- (_inAudioIxRead / _noChannels * 100) / sampFreqHz);
- if (_inTimestampIxWrite > num10MsecBlocks) {
- memmove(_inTimestamp, _inTimestamp + num10MsecBlocks,
- (_inTimestampIxWrite - num10MsecBlocks) * sizeof(int32_t));
+ uint16_t samp_freq_hz;
+ EncoderSampFreq(samp_freq_hz);
+ int16_t num_10ms_blocks = static_cast<int16_t>(
+ (in_audio_ix_read_ / num_channels_ * 100) / samp_freq_hz);
+ if (in_timestamp_ix_write_ > num_10ms_blocks) {
+ memmove(in_timestamp_, in_timestamp_ + num_10ms_blocks,
+ (in_timestamp_ix_write_ - num_10ms_blocks) * sizeof(int32_t));
}
- _inTimestampIxWrite -= num10MsecBlocks;
+ in_timestamp_ix_write_ -= num_10ms_blocks;
// Remove encoded audio and move next audio to be encoded to the beginning
// of the buffer. Accordingly, adjust the read and write indices.
- if (_inAudioIxRead < _inAudioIxWrite) {
- memmove(_inAudio, &_inAudio[_inAudioIxRead],
- (_inAudioIxWrite - _inAudioIxRead) * sizeof(int16_t));
+ if (in_audio_ix_read_ < in_audio_ix_write_) {
+ memmove(in_audio_, &in_audio_[in_audio_ix_read_],
+ (in_audio_ix_write_ - in_audio_ix_read_) * sizeof(int16_t));
}
- _inAudioIxWrite -= _inAudioIxRead;
- _inAudioIxRead = 0;
- _lastEncodedTimestamp = *timeStamp;
- return (status < 0) ? (-1) : (*bitStreamLenByte);
+ in_audio_ix_write_ -= in_audio_ix_read_;
+ in_audio_ix_read_ = 0;
+ last_encoded_timestamp_ = *timestamp;
+ return (status < 0) ? (-1) : (*bitstream_len_byte);
}
-int16_t ACMGenericCodec::Decode(uint8_t* bitStream,
- int16_t bitStreamLenByte,
+int16_t ACMGenericCodec::Decode(uint8_t* bitstream,
+ int16_t bitstream_len_byte,
int16_t* audio,
- int16_t* audioSamples,
- int8_t* speechType) {
- WriteLockScoped wl(_codecWrapperLock);
- return DecodeSafe(bitStream, bitStreamLenByte, audio, audioSamples,
- speechType);
+ int16_t* audio_samples,
+ int8_t* speech_type) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ return DecodeSafe(bitstream, bitstream_len_byte, audio, audio_samples,
+ speech_type);
}
bool ACMGenericCodec::EncoderInitialized() {
- ReadLockScoped rl(_codecWrapperLock);
- return _encoderInitialized;
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return encoder_initialized_;
}
bool ACMGenericCodec::DecoderInitialized() {
- ReadLockScoped rl(_codecWrapperLock);
- return _decoderInitialized;
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return decoder_initialized_;
}
-int32_t ACMGenericCodec::RegisterInNetEq(ACMNetEQ* netEq,
- const CodecInst& codecInst) {
- WebRtcNetEQ_CodecDef codecDef;
- WriteLockScoped wl(_codecWrapperLock);
+int32_t ACMGenericCodec::RegisterInNetEq(ACMNetEQ* neteq,
+ const CodecInst& codec_inst) {
+ WebRtcNetEQ_CodecDef codec_def;
+ WriteLockScoped wl(codec_wrapper_lock_);
- if (CodecDef(codecDef, codecInst) < 0) {
+ if (CodecDef(codec_def, codec_inst) < 0) {
// Failed to register the decoder.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"RegisterInNetEq: error, failed to register");
- _registeredInNetEq = false;
+ registered_in_neteq_ = false;
return -1;
} else {
- if (netEq->AddCodec(&codecDef, _isMaster) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (neteq->AddCodec(&codec_def, is_master_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"RegisterInNetEq: error, failed to add codec");
- _registeredInNetEq = false;
+ registered_in_neteq_ = false;
return -1;
}
// Succeeded registering the decoder.
- _registeredInNetEq = true;
+ registered_in_neteq_ = true;
return 0;
}
}
-int16_t ACMGenericCodec::EncoderParams(WebRtcACMCodecParams* encParams) {
- ReadLockScoped rl(_codecWrapperLock);
- return EncoderParamsSafe(encParams);
+int16_t ACMGenericCodec::EncoderParams(WebRtcACMCodecParams* enc_params) {
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return EncoderParamsSafe(enc_params);
}
-int16_t ACMGenericCodec::EncoderParamsSafe(WebRtcACMCodecParams* encParams) {
+int16_t ACMGenericCodec::EncoderParamsSafe(WebRtcACMCodecParams* enc_params) {
// Codec parameters are valid only if the encoder is initialized.
- if (_encoderInitialized) {
- int32_t currentRate;
- memcpy(encParams, &_encoderParams, sizeof(WebRtcACMCodecParams));
- currentRate = encParams->codecInstant.rate;
- CurrentRate(currentRate);
- encParams->codecInstant.rate = currentRate;
+ if (encoder_initialized_) {
+ int32_t current_rate;
+ memcpy(enc_params, &encoder_params_, sizeof(WebRtcACMCodecParams));
+ current_rate = enc_params->codec_inst.rate;
+ CurrentRate(current_rate);
+ enc_params->codec_inst.rate = current_rate;
return 0;
} else {
- encParams->codecInstant.plname[0] = '\0';
- encParams->codecInstant.pltype = -1;
- encParams->codecInstant.pacsize = 0;
- encParams->codecInstant.rate = 0;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ enc_params->codec_inst.plname[0] = '\0';
+ enc_params->codec_inst.pltype = -1;
+ enc_params->codec_inst.pacsize = 0;
+ enc_params->codec_inst.rate = 0;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EncoderParamsSafe: error, encoder not initialized");
return -1;
}
}
-bool ACMGenericCodec::DecoderParams(WebRtcACMCodecParams* decParams,
- const uint8_t payloadType) {
- ReadLockScoped rl(_codecWrapperLock);
- return DecoderParamsSafe(decParams, payloadType);
+bool ACMGenericCodec::DecoderParams(WebRtcACMCodecParams* dec_params,
+ const uint8_t payload_type) {
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return DecoderParamsSafe(dec_params, payload_type);
}
-bool ACMGenericCodec::DecoderParamsSafe(WebRtcACMCodecParams* decParams,
- const uint8_t payloadType) {
+bool ACMGenericCodec::DecoderParamsSafe(WebRtcACMCodecParams* dec_params,
+ const uint8_t payload_type) {
// Decoder parameters are valid only if decoder is initialized.
- if (_decoderInitialized) {
- if (payloadType == _decoderParams.codecInstant.pltype) {
- memcpy(decParams, &_decoderParams, sizeof(WebRtcACMCodecParams));
+ if (decoder_initialized_) {
+ if (payload_type == decoder_params_.codec_inst.pltype) {
+ memcpy(dec_params, &decoder_params_, sizeof(WebRtcACMCodecParams));
return true;
}
}
- decParams->codecInstant.plname[0] = '\0';
- decParams->codecInstant.pltype = -1;
- decParams->codecInstant.pacsize = 0;
- decParams->codecInstant.rate = 0;
+ dec_params->codec_inst.plname[0] = '\0';
+ dec_params->codec_inst.pltype = -1;
+ dec_params->codec_inst.pacsize = 0;
+ dec_params->codec_inst.rate = 0;
return false;
}
int16_t ACMGenericCodec::ResetEncoder() {
- WriteLockScoped lockCodec(_codecWrapperLock);
- ReadLockScoped lockNetEq(*_netEqDecodeLock);
+ WriteLockScoped lockCodec(codec_wrapper_lock_);
+ ReadLockScoped lockNetEq(*neteq_decode_lock_);
return ResetEncoderSafe();
}
int16_t ACMGenericCodec::ResetEncoderSafe() {
- if (!_encoderExist || !_encoderInitialized) {
+ if (!encoder_exist_ || !encoder_initialized_) {
// We don't reset if encoder doesn't exists or isn't initialized yet.
return 0;
}
- _inAudioIxWrite = 0;
- _inAudioIxRead = 0;
- _inTimestampIxWrite = 0;
- _noMissedSamples = 0;
- _isAudioBuffFresh = true;
- memset(_inAudio, 0, AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
- memset(_inTimestamp, 0, TIMESTAMP_BUFFER_SIZE_W32 * sizeof(int32_t));
+ in_audio_ix_write_ = 0;
+ in_audio_ix_read_ = 0;
+ in_timestamp_ix_write_ = 0;
+ num_missed_samples_ = 0;
+ is_audio_buff_fresh_ = true;
+ memset(in_audio_, 0, AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
+ memset(in_timestamp_, 0, TIMESTAMP_BUFFER_SIZE_W32 * sizeof(int32_t));
// Store DTX/VAD parameters.
- bool enableVAD = _vadEnabled;
- bool enableDTX = _dtxEnabled;
- ACMVADMode mode = _vadMode;
+ bool enable_vad = vad_enabled_;
+ bool enable_dtx = dtx_enabled_;
+ ACMVADMode mode = vad_mode_;
// Reset the encoder.
if (InternalResetEncoder() < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"ResetEncoderSafe: error in reset encoder");
return -1;
}
@@ -492,243 +497,245 @@
DisableVAD();
// Set DTX/VAD.
- return SetVADSafe(enableDTX, enableVAD, mode);
+ return SetVADSafe(enable_dtx, enable_vad, mode);
}
int16_t ACMGenericCodec::InternalResetEncoder() {
// Call the codecs internal encoder initialization/reset function.
- return InternalInitEncoder(&_encoderParams);
+ return InternalInitEncoder(&encoder_params_);
}
-int16_t ACMGenericCodec::InitEncoder(WebRtcACMCodecParams* codecParams,
- bool forceInitialization) {
- WriteLockScoped lockCodec(_codecWrapperLock);
- ReadLockScoped lockNetEq(*_netEqDecodeLock);
- return InitEncoderSafe(codecParams, forceInitialization);
+int16_t ACMGenericCodec::InitEncoder(WebRtcACMCodecParams* codec_params,
+ bool force_initialization) {
+ WriteLockScoped lockCodec(codec_wrapper_lock_);
+ ReadLockScoped lockNetEq(*neteq_decode_lock_);
+ return InitEncoderSafe(codec_params, force_initialization);
}
-int16_t ACMGenericCodec::InitEncoderSafe(WebRtcACMCodecParams* codecParams,
- bool forceInitialization) {
+int16_t ACMGenericCodec::InitEncoderSafe(WebRtcACMCodecParams* codec_params,
+ bool force_initialization) {
// Check if we got a valid set of parameters.
int mirrorID;
- int codecNumber = ACMCodecDB::CodecNumber(&(codecParams->codecInstant),
- &mirrorID);
- if (codecNumber < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ int codec_number = ACMCodecDB::CodecNumber(&(codec_params->codec_inst),
+ &mirrorID);
+ if (codec_number < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitEncoderSafe: error, codec number negative");
return -1;
}
// Check if the parameters are for this codec.
- if ((_codecID >= 0) && (_codecID != codecNumber) && (_codecID != mirrorID)) {
- // The current codec is not the same as the one given by codecParams.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InitEncoderSafe: current codec is not the same as the one given by "
- "codecParams");
+ if ((codec_id_ >= 0) && (codec_id_ != codec_number) &&
+ (codec_id_ != mirrorID)) {
+ // The current codec is not the same as the one given by codec_params.
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InitEncoderSafe: current codec is not the same as the one "
+ "given by codec_params");
return -1;
}
- if (!CanChangeEncodingParam(codecParams->codecInstant)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (!CanChangeEncodingParam(codec_params->codec_inst)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitEncoderSafe: cannot change encoding parameters");
return -1;
}
- if (_encoderInitialized && !forceInitialization) {
+ if (encoder_initialized_ && !force_initialization) {
// The encoder is already initialized, and we don't want to force
// initialization.
return 0;
}
int16_t status;
- if (!_encoderExist) {
+ if (!encoder_exist_) {
// New encoder, start with creating.
- _encoderInitialized = false;
+ encoder_initialized_ = false;
status = CreateEncoder();
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitEncoderSafe: cannot create encoder");
return -1;
} else {
- _encoderExist = true;
+ encoder_exist_ = true;
}
}
- _frameLenSmpl = (codecParams->codecInstant).pacsize;
- _noChannels = codecParams->codecInstant.channels;
- status = InternalInitEncoder(codecParams);
+ frame_len_smpl_ = (codec_params->codec_inst).pacsize;
+ num_channels_ = codec_params->codec_inst.channels;
+ status = InternalInitEncoder(codec_params);
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitEncoderSafe: error in init encoder");
- _encoderInitialized = false;
+ encoder_initialized_ = false;
return -1;
} else {
// Store encoder parameters.
- memcpy(&_encoderParams, codecParams, sizeof(WebRtcACMCodecParams));
- _encoderInitialized = true;
- if (_inAudio == NULL) {
- _inAudio = new int16_t[AUDIO_BUFFER_SIZE_W16];
- if (_inAudio == NULL) {
+ memcpy(&encoder_params_, codec_params, sizeof(WebRtcACMCodecParams));
+ encoder_initialized_ = true;
+ if (in_audio_ == NULL) {
+ in_audio_ = new int16_t[AUDIO_BUFFER_SIZE_W16];
+ if (in_audio_ == NULL) {
return -1;
}
- memset(_inAudio, 0, AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
+ memset(in_audio_, 0, AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
}
- if (_inTimestamp == NULL) {
- _inTimestamp = new uint32_t[TIMESTAMP_BUFFER_SIZE_W32];
- if (_inTimestamp == NULL) {
+ if (in_timestamp_ == NULL) {
+ in_timestamp_ = new uint32_t[TIMESTAMP_BUFFER_SIZE_W32];
+ if (in_timestamp_ == NULL) {
return -1;
}
- memset(_inTimestamp, 0, sizeof(uint32_t) * TIMESTAMP_BUFFER_SIZE_W32);
+ memset(in_timestamp_, 0, sizeof(uint32_t) * TIMESTAMP_BUFFER_SIZE_W32);
}
- _isAudioBuffFresh = true;
+ is_audio_buff_fresh_ = true;
}
- status = SetVADSafe(codecParams->enableDTX, codecParams->enableVAD,
- codecParams->vadMode);
+ status = SetVADSafe(codec_params->enable_dtx, codec_params->enable_vad,
+ codec_params->vad_mode);
return status;
}
// TODO(tlegrand): Remove the function CanChangeEncodingParam. Returns true
// for all codecs.
-bool ACMGenericCodec::CanChangeEncodingParam(CodecInst& /*codecInst*/) {
+bool ACMGenericCodec::CanChangeEncodingParam(CodecInst& /*codec_inst*/) {
return true;
}
-int16_t ACMGenericCodec::InitDecoder(WebRtcACMCodecParams* codecParams,
- bool forceInitialization) {
- WriteLockScoped lockCodc(_codecWrapperLock);
- WriteLockScoped lockNetEq(*_netEqDecodeLock);
- return InitDecoderSafe(codecParams, forceInitialization);
+int16_t ACMGenericCodec::InitDecoder(WebRtcACMCodecParams* codec_params,
+ bool force_initialization) {
+ WriteLockScoped lockCodc(codec_wrapper_lock_);
+ WriteLockScoped lockNetEq(*neteq_decode_lock_);
+ return InitDecoderSafe(codec_params, force_initialization);
}
-int16_t ACMGenericCodec::InitDecoderSafe(WebRtcACMCodecParams* codecParams,
- bool forceInitialization) {
- int mirrorID;
+int16_t ACMGenericCodec::InitDecoderSafe(WebRtcACMCodecParams* codec_params,
+ bool force_initialization) {
+ int mirror_id;
// Check if we got a valid set of parameters.
- int codecNumber = ACMCodecDB::ReceiverCodecNumber(&codecParams->codecInstant,
- &mirrorID);
- if (codecNumber < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ int codec_number = ACMCodecDB::ReceiverCodecNumber(&codec_params->codec_inst,
+ &mirror_id);
+ if (codec_number < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitDecoderSafe: error, invalid codec number");
return -1;
}
// Check if the parameters are for this codec.
- if ((_codecID >= 0) && (_codecID != codecNumber) && (_codecID != mirrorID)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InitDecoderSafe: current codec is not the same as the one given "
- "by codecParams");
- // The current codec is not the same as the one given by codecParams.
+ if ((codec_id_ >= 0) && (codec_id_ != codec_number) &&
+ (codec_id_ != mirror_id)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InitDecoderSafe: current codec is not the same as the one "
+ "given by codec_params");
+ // The current codec is not the same as the one given by codec_params.
return -1;
}
- if (_decoderInitialized && !forceInitialization) {
+ if (decoder_initialized_ && !force_initialization) {
// The decoder is already initialized, and we don't want to force
// initialization.
return 0;
}
int16_t status;
- if (!_decoderExist) {
+ if (!decoder_exist_) {
// New decoder, start with creating.
- _decoderInitialized = false;
+ decoder_initialized_ = false;
status = CreateDecoder();
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitDecoderSafe: cannot create decoder");
return -1;
} else {
- _decoderExist = true;
+ decoder_exist_ = true;
}
}
- status = InternalInitDecoder(codecParams);
+ status = InternalInitDecoder(codec_params);
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InitDecoderSafe: cannot init decoder");
- _decoderInitialized = false;
+ decoder_initialized_ = false;
return -1;
} else {
// Store decoder parameters.
- SaveDecoderParamSafe(codecParams);
- _decoderInitialized = true;
+ SaveDecoderParamSafe(codec_params);
+ decoder_initialized_ = true;
}
return 0;
}
-int16_t ACMGenericCodec::ResetDecoder(int16_t payloadType) {
- WriteLockScoped lockCodec(_codecWrapperLock);
- WriteLockScoped lockNetEq(*_netEqDecodeLock);
- return ResetDecoderSafe(payloadType);
+int16_t ACMGenericCodec::ResetDecoder(int16_t payload_type) {
+ WriteLockScoped lockCodec(codec_wrapper_lock_);
+ WriteLockScoped lockNetEq(*neteq_decode_lock_);
+ return ResetDecoderSafe(payload_type);
}
-int16_t ACMGenericCodec::ResetDecoderSafe(int16_t payloadType) {
- WebRtcACMCodecParams decoderParams;
- if (!_decoderExist || !_decoderInitialized) {
+int16_t ACMGenericCodec::ResetDecoderSafe(int16_t payload_type) {
+ WebRtcACMCodecParams decoder_params;
+ if (!decoder_exist_ || !decoder_initialized_) {
return 0;
}
// Initialization of the decoder should work for all the codec. For codecs
// that needs to keep some states an overloading implementation of
// |DecoderParamsSafe| exists.
- DecoderParamsSafe(&decoderParams, static_cast<uint8_t>(payloadType));
- return InternalInitDecoder(&decoderParams);
+ DecoderParamsSafe(&decoder_params, static_cast<uint8_t>(payload_type));
+ return InternalInitDecoder(&decoder_params);
}
void ACMGenericCodec::ResetNoMissedSamples() {
- WriteLockScoped cs(_codecWrapperLock);
- _noMissedSamples = 0;
+ WriteLockScoped cs(codec_wrapper_lock_);
+ num_missed_samples_ = 0;
}
-void ACMGenericCodec::IncreaseNoMissedSamples(const int16_t noSamples) {
- _noMissedSamples += noSamples;
+void ACMGenericCodec::IncreaseNoMissedSamples(const int16_t num_samples) {
+ num_missed_samples_ += num_samples;
}
// Get the number of missed samples, this can be public.
uint32_t ACMGenericCodec::NoMissedSamples() const {
- ReadLockScoped cs(_codecWrapperLock);
- return _noMissedSamples;
+ ReadLockScoped cs(codec_wrapper_lock_);
+ return num_missed_samples_;
}
void ACMGenericCodec::DestructEncoder() {
- WriteLockScoped wl(_codecWrapperLock);
+ WriteLockScoped wl(codec_wrapper_lock_);
// Disable VAD and delete the instance.
- if (_ptrVADInst != NULL) {
- WebRtcVad_Free(_ptrVADInst);
- _ptrVADInst = NULL;
+ if (ptr_vad_inst_ != NULL) {
+ WebRtcVad_Free(ptr_vad_inst_);
+ ptr_vad_inst_ = NULL;
}
- _vadEnabled = false;
- _vadMode = VADNormal;
+ vad_enabled_ = false;
+ vad_mode_ = VADNormal;
// Disable DTX and delete the instance.
- _dtxEnabled = false;
- if (_ptrDTXInst != NULL) {
- WebRtcCng_FreeEnc(_ptrDTXInst);
- _ptrDTXInst = NULL;
+ dtx_enabled_ = false;
+ if (ptr_dtx_inst_ != NULL) {
+ WebRtcCng_FreeEnc(ptr_dtx_inst_);
+ ptr_dtx_inst_ = NULL;
}
- _numLPCParams = kNewCNGNumPLCParams;
+ num_lpc_params_ = kNewCNGNumPLCParams;
DestructEncoderSafe();
}
void ACMGenericCodec::DestructDecoder() {
- WriteLockScoped wl(_codecWrapperLock);
- _decoderParams.codecInstant.pltype = -1;
+ WriteLockScoped wl(codec_wrapper_lock_);
+ decoder_params_.codec_inst.pltype = -1;
DestructDecoderSafe();
}
-int16_t ACMGenericCodec::SetBitRate(const int32_t bitRateBPS) {
- WriteLockScoped wl(_codecWrapperLock);
- return SetBitRateSafe(bitRateBPS);
+int16_t ACMGenericCodec::SetBitRate(const int32_t bitrate_bps) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ return SetBitRateSafe(bitrate_bps);
}
-int16_t ACMGenericCodec::SetBitRateSafe(const int32_t bitRateBPS) {
+int16_t ACMGenericCodec::SetBitRateSafe(const int32_t bitrate_bps) {
// If the codec can change the bit-rate this function is overloaded.
// Otherwise the only acceptable value is the one that is in the database.
- CodecInst codecParams;
- if (ACMCodecDB::Codec(_codecID, &codecParams) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ CodecInst codec_params;
+ if (ACMCodecDB::Codec(codec_id_, &codec_params) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: error in ACMCodecDB::Codec");
return -1;
}
- if (codecParams.rate != bitRateBPS) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (codec_params.rate != bitrate_bps) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: rate value is not acceptable");
return -1;
} else {
@@ -738,7 +745,7 @@
// iSAC specific functions:
int32_t ACMGenericCodec::GetEstimatedBandwidth() {
- WriteLockScoped wl(_codecWrapperLock);
+ WriteLockScoped wl(codec_wrapper_lock_);
return GetEstimatedBandwidthSafe();
}
@@ -747,157 +754,159 @@
return -1;
}
-int32_t ACMGenericCodec::SetEstimatedBandwidth(int32_t estimatedBandwidth) {
- WriteLockScoped wl(_codecWrapperLock);
- return SetEstimatedBandwidthSafe(estimatedBandwidth);
+int32_t ACMGenericCodec::SetEstimatedBandwidth(int32_t estimated_bandwidth) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ return SetEstimatedBandwidthSafe(estimated_bandwidth);
}
int32_t ACMGenericCodec::SetEstimatedBandwidthSafe(
- int32_t /*estimatedBandwidth*/) {
+ int32_t /*estimated_bandwidth*/) {
// All codecs but iSAC will return -1.
return -1;
}
// End of iSAC specific functions.
-int32_t ACMGenericCodec::GetRedPayload(uint8_t* redPayload,
- int16_t* payloadBytes) {
- WriteLockScoped wl(_codecWrapperLock);
- return GetRedPayloadSafe(redPayload, payloadBytes);
+int32_t ACMGenericCodec::GetRedPayload(uint8_t* red_payload,
+ int16_t* payload_bytes) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ return GetRedPayloadSafe(red_payload, payload_bytes);
}
-int32_t ACMGenericCodec::GetRedPayloadSafe(uint8_t* /* redPayload */,
- int16_t* /* payloadBytes */) {
+int32_t ACMGenericCodec::GetRedPayloadSafe(uint8_t* /* red_payload */,
+ int16_t* /* payload_bytes */) {
return -1; // Do nothing by default.
}
int16_t ACMGenericCodec::CreateEncoder() {
int16_t status = 0;
- if (!_encoderExist) {
+ if (!encoder_exist_) {
status = InternalCreateEncoder();
// We just created the codec and obviously it is not initialized.
- _encoderInitialized = false;
+ encoder_initialized_ = false;
}
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CreateEncoder: error in internal create encoder");
- _encoderExist = false;
+ encoder_exist_ = false;
} else {
- _encoderExist = true;
+ encoder_exist_ = true;
}
return status;
}
int16_t ACMGenericCodec::CreateDecoder() {
int16_t status = 0;
- if (!_decoderExist) {
+ if (!decoder_exist_) {
status = InternalCreateDecoder();
// Decoder just created and obviously it is not initialized.
- _decoderInitialized = false;
+ decoder_initialized_ = false;
}
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CreateDecoder: error in internal create decoder");
- _decoderExist = false;
+ decoder_exist_ = false;
} else {
- _decoderExist = true;
+ decoder_exist_ = true;
}
return status;
}
-void ACMGenericCodec::DestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WriteLockScoped lockCodec(_codecWrapperLock);
- ReadLockScoped lockNetEq(*_netEqDecodeLock);
- InternalDestructEncoderInst(ptrInst);
+void ACMGenericCodec::DestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WriteLockScoped lockCodec(codec_wrapper_lock_);
+ ReadLockScoped lockNetEq(*neteq_decode_lock_);
+ InternalDestructEncoderInst(ptr_inst);
}
}
// Get the current audio buffer including read and write states, and timestamps.
-int16_t ACMGenericCodec::AudioBuffer(WebRtcACMAudioBuff& audioBuff) {
- ReadLockScoped cs(_codecWrapperLock);
- memcpy(audioBuff.inAudio, _inAudio,
+int16_t ACMGenericCodec::AudioBuffer(WebRtcACMAudioBuff& audio_buff) {
+ ReadLockScoped cs(codec_wrapper_lock_);
+ memcpy(audio_buff.in_audio, in_audio_,
AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
- audioBuff.inAudioIxRead = _inAudioIxRead;
- audioBuff.inAudioIxWrite = _inAudioIxWrite;
- memcpy(audioBuff.inTimestamp, _inTimestamp,
+ audio_buff.in_audio_ix_read = in_audio_ix_read_;
+ audio_buff.in_audio_ix_write = in_audio_ix_write_;
+ memcpy(audio_buff.in_timestamp, in_timestamp_,
TIMESTAMP_BUFFER_SIZE_W32 * sizeof(uint32_t));
- audioBuff.inTimestampIxWrite = _inTimestampIxWrite;
- audioBuff.lastTimestamp = _lastTimestamp;
+ audio_buff.in_timestamp_ix_write = in_timestamp_ix_write_;
+ audio_buff.last_timestamp = last_timestamp_;
return 0;
}
// Set the audio buffer.
-int16_t ACMGenericCodec::SetAudioBuffer(WebRtcACMAudioBuff& audioBuff) {
- WriteLockScoped cs(_codecWrapperLock);
- memcpy(_inAudio, audioBuff.inAudio,
+int16_t ACMGenericCodec::SetAudioBuffer(WebRtcACMAudioBuff& audio_buff) {
+ WriteLockScoped cs(codec_wrapper_lock_);
+ memcpy(in_audio_, audio_buff.in_audio,
AUDIO_BUFFER_SIZE_W16 * sizeof(int16_t));
- _inAudioIxRead = audioBuff.inAudioIxRead;
- _inAudioIxWrite = audioBuff.inAudioIxWrite;
- memcpy(_inTimestamp, audioBuff.inTimestamp,
+ in_audio_ix_read_ = audio_buff.in_audio_ix_read;
+ in_audio_ix_write_ = audio_buff.in_audio_ix_write;
+ memcpy(in_timestamp_, audio_buff.in_timestamp,
TIMESTAMP_BUFFER_SIZE_W32 * sizeof(uint32_t));
- _inTimestampIxWrite = audioBuff.inTimestampIxWrite;
- _lastTimestamp = audioBuff.lastTimestamp;
- _isAudioBuffFresh = false;
+ in_timestamp_ix_write_ = audio_buff.in_timestamp_ix_write;
+ last_timestamp_ = audio_buff.last_timestamp;
+ is_audio_buff_fresh_ = false;
return 0;
}
uint32_t ACMGenericCodec::LastEncodedTimestamp() const {
- ReadLockScoped cs(_codecWrapperLock);
- return _lastEncodedTimestamp;
+ ReadLockScoped cs(codec_wrapper_lock_);
+ return last_encoded_timestamp_;
}
uint32_t ACMGenericCodec::EarliestTimestamp() const {
- ReadLockScoped cs(_codecWrapperLock);
- return _inTimestamp[0];
+ ReadLockScoped cs(codec_wrapper_lock_);
+ return in_timestamp_[0];
}
-int16_t ACMGenericCodec::SetVAD(const bool enableDTX, const bool enableVAD,
+int16_t ACMGenericCodec::SetVAD(const bool enable_dtx,
+ const bool enable_vad,
const ACMVADMode mode) {
- WriteLockScoped cs(_codecWrapperLock);
- return SetVADSafe(enableDTX, enableVAD, mode);
+ WriteLockScoped cs(codec_wrapper_lock_);
+ return SetVADSafe(enable_dtx, enable_vad, mode);
}
-int16_t ACMGenericCodec::SetVADSafe(const bool enableDTX, const bool enableVAD,
+int16_t ACMGenericCodec::SetVADSafe(const bool enable_dtx,
+ const bool enable_vad,
const ACMVADMode mode) {
- if (enableDTX) {
+ if (enable_dtx) {
// Make G729 AnnexB a special case.
- if (!STR_CASE_CMP(_encoderParams.codecInstant.plname, "G729")
- && !_hasInternalDTX) {
+ if (!STR_CASE_CMP(encoder_params_.codec_inst.plname, "G729")
+ && !has_internal_dtx_) {
if (ACMGenericCodec::EnableDTX() < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetVADSafe: error in enable DTX");
return -1;
}
} else {
if (EnableDTX() < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetVADSafe: error in enable DTX");
return -1;
}
}
- if (_hasInternalDTX) {
+ if (has_internal_dtx_) {
// Codec has internal DTX, practically we don't need WebRtc VAD, however,
// we let the user to turn it on if they need call-backs on silence.
// Store VAD mode for future even if VAD is off.
- _vadMode = mode;
- return (enableVAD) ? EnableVAD(mode) : DisableVAD();
+ vad_mode_ = mode;
+ return (enable_vad) ? EnableVAD(mode) : DisableVAD();
} else {
// Codec does not have internal DTX so enabling DTX requires an active
- // VAD. 'enableDTX == true' overwrites VAD status.
+ // VAD. 'enable_dtx == true' overwrites VAD status.
if (EnableVAD(mode) < 0) {
// If we cannot create VAD we have to disable DTX.
- if (!_vadEnabled) {
+ if (!vad_enabled_) {
DisableDTX();
}
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetVADSafe: error in enable VAD");
return -1;
}
// Return '1', to let the caller know VAD was turned on, even if the
// function was called with VAD='false'.
- if (enableVAD == false) {
+ if (enable_vad == false) {
return 1;
} else {
return 0;
@@ -905,145 +914,146 @@
}
} else {
// Make G729 AnnexB a special case.
- if (!STR_CASE_CMP(_encoderParams.codecInstant.plname, "G729")
- && !_hasInternalDTX) {
+ if (!STR_CASE_CMP(encoder_params_.codec_inst.plname, "G729")
+ && !has_internal_dtx_) {
ACMGenericCodec::DisableDTX();
} else {
DisableDTX();
}
- return (enableVAD) ? EnableVAD(mode) : DisableVAD();
+ return (enable_vad) ? EnableVAD(mode) : DisableVAD();
}
}
int16_t ACMGenericCodec::EnableDTX() {
- if (_hasInternalDTX) {
+ if (has_internal_dtx_) {
// We should not be here if we have internal DTX this function should be
// overloaded by the derived class in this case.
return -1;
}
- if (!_dtxEnabled) {
- if (WebRtcCng_CreateEnc(&_ptrDTXInst) < 0) {
- _ptrDTXInst = NULL;
+ if (!dtx_enabled_) {
+ if (WebRtcCng_CreateEnc(&ptr_dtx_inst_) < 0) {
+ ptr_dtx_inst_ = NULL;
return -1;
}
- uint16_t freqHz;
- EncoderSampFreq(freqHz);
- if (WebRtcCng_InitEnc(_ptrDTXInst, freqHz, kCngSidIntervalMsec,
- _numLPCParams) < 0) {
+ uint16_t freq_hz;
+ EncoderSampFreq(freq_hz);
+ if (WebRtcCng_InitEnc(ptr_dtx_inst_, freq_hz, kCngSidIntervalMsec,
+ num_lpc_params_) < 0) {
// Couldn't initialize, has to return -1, and free the memory.
- WebRtcCng_FreeEnc(_ptrDTXInst);
- _ptrDTXInst = NULL;
+ WebRtcCng_FreeEnc(ptr_dtx_inst_);
+ ptr_dtx_inst_ = NULL;
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
}
return 0;
}
int16_t ACMGenericCodec::DisableDTX() {
- if (_hasInternalDTX) {
+ if (has_internal_dtx_) {
// We should not be here if we have internal DTX this function should be
// overloaded by the derived class in this case.
return -1;
}
- if (_ptrDTXInst != NULL) {
- WebRtcCng_FreeEnc(_ptrDTXInst);
- _ptrDTXInst = NULL;
+ if (ptr_dtx_inst_ != NULL) {
+ WebRtcCng_FreeEnc(ptr_dtx_inst_);
+ ptr_dtx_inst_ = NULL;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
}
int16_t ACMGenericCodec::EnableVAD(ACMVADMode mode) {
if ((mode < VADNormal) || (mode > VADVeryAggr)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EnableVAD: error in VAD mode range");
return -1;
}
- if (!_vadEnabled) {
- if (WebRtcVad_Create(&_ptrVADInst) < 0) {
- _ptrVADInst = NULL;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (!vad_enabled_) {
+ if (WebRtcVad_Create(&ptr_vad_inst_) < 0) {
+ ptr_vad_inst_ = NULL;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EnableVAD: error in create VAD");
return -1;
}
- if (WebRtcVad_Init(_ptrVADInst) < 0) {
- WebRtcVad_Free(_ptrVADInst);
- _ptrVADInst = NULL;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcVad_Init(ptr_vad_inst_) < 0) {
+ WebRtcVad_Free(ptr_vad_inst_);
+ ptr_vad_inst_ = NULL;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EnableVAD: error in init VAD");
return -1;
}
}
// Set the VAD mode to the given value.
- if (WebRtcVad_set_mode(_ptrVADInst, mode) < 0) {
+ if (WebRtcVad_set_mode(ptr_vad_inst_, mode) < 0) {
// We failed to set the mode and we have to return -1. If we already have a
- // working VAD (_vadEnabled == true) then we leave it to work. Otherwise,
+ // working VAD (vad_enabled_ == true) then we leave it to work. Otherwise,
// the following will be executed.
- if (!_vadEnabled) {
+ if (!vad_enabled_) {
// We just created the instance but cannot set the mode we have to free
// the memory.
- WebRtcVad_Free(_ptrVADInst);
- _ptrVADInst = NULL;
+ WebRtcVad_Free(ptr_vad_inst_);
+ ptr_vad_inst_ = NULL;
}
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, unique_id_,
"EnableVAD: failed to set the VAD mode");
return -1;
}
- _vadMode = mode;
- _vadEnabled = true;
+ vad_mode_ = mode;
+ vad_enabled_ = true;
return 0;
}
int16_t ACMGenericCodec::DisableVAD() {
- if (_ptrVADInst != NULL) {
- WebRtcVad_Free(_ptrVADInst);
- _ptrVADInst = NULL;
+ if (ptr_vad_inst_ != NULL) {
+ WebRtcVad_Free(ptr_vad_inst_);
+ ptr_vad_inst_ = NULL;
}
- _vadEnabled = false;
+ vad_enabled_ = false;
return 0;
}
-int32_t ACMGenericCodec::ReplaceInternalDTX(const bool replaceInternalDTX) {
- WriteLockScoped cs(_codecWrapperLock);
- return ReplaceInternalDTXSafe(replaceInternalDTX);
+int32_t ACMGenericCodec::ReplaceInternalDTX(const bool replace_internal_dtx) {
+ WriteLockScoped cs(codec_wrapper_lock_);
+ return ReplaceInternalDTXSafe(replace_internal_dtx);
}
int32_t ACMGenericCodec::ReplaceInternalDTXSafe(
- const bool /* replaceInternalDTX */) {
+ const bool /* replace_internal_dtx */) {
return -1;
}
-int32_t ACMGenericCodec::IsInternalDTXReplaced(bool* internalDTXReplaced) {
- WriteLockScoped cs(_codecWrapperLock);
- return IsInternalDTXReplacedSafe(internalDTXReplaced);
+int32_t ACMGenericCodec::IsInternalDTXReplaced(bool* internal_dtx_replaced) {
+ WriteLockScoped cs(codec_wrapper_lock_);
+ return IsInternalDTXReplacedSafe(internal_dtx_replaced);
}
-int32_t ACMGenericCodec::IsInternalDTXReplacedSafe(bool* internalDTXReplaced) {
- *internalDTXReplaced = false;
+int32_t ACMGenericCodec::IsInternalDTXReplacedSafe(
+ bool* internal_dtx_replaced) {
+ *internal_dtx_replaced = false;
return 0;
}
-int16_t ACMGenericCodec::ProcessFrameVADDTX(uint8_t* bitStream,
- int16_t* bitStreamLenByte,
- int16_t* samplesProcessed) {
- if (!_vadEnabled) {
- // VAD not enabled, set all vadLable[] to 1 (speech detected).
+int16_t ACMGenericCodec::ProcessFrameVADDTX(uint8_t* bitstream,
+ int16_t* bitstream_len_byte,
+ int16_t* samples_processed) {
+ if (!vad_enabled_) {
+ // VAD not enabled, set all |vad_lable_[]| to 1 (speech detected).
for (int n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
- _vadLabel[n] = 1;
+ vad_label_[n] = 1;
}
- *samplesProcessed = 0;
+ *samples_processed = 0;
return 0;
}
- uint16_t freqHz;
- EncoderSampFreq(freqHz);
+ uint16_t freq_hz;
+ EncoderSampFreq(freq_hz);
// Calculate number of samples in 10 ms blocks, and number ms in one frame.
- int16_t samplesIn10Msec = static_cast<int16_t>(freqHz / 100);
- int32_t frameLenMsec = static_cast<int32_t>(_frameLenSmpl) * 1000 / freqHz;
+ int16_t samples_in_10ms = static_cast<int16_t>(freq_hz / 100);
+ int32_t frame_len_ms = static_cast<int32_t>(frame_len_smpl_) * 1000 / freq_hz;
int16_t status;
// Vector for storing maximum 30 ms of mono audio at 48 kHz.
@@ -1051,43 +1061,44 @@
// Calculate number of VAD-blocks to process, and number of samples in each
// block.
- int noSamplesToProcess[2];
- if (frameLenMsec == 40) {
+ int num_samples_to_process[2];
+ if (frame_len_ms == 40) {
// 20 ms in each VAD block.
- noSamplesToProcess[0] = noSamplesToProcess[1] = 2 * samplesIn10Msec;
+ num_samples_to_process[0] = num_samples_to_process[1] = 2 * samples_in_10ms;
} else {
// For 10-30 ms framesizes, second VAD block will be size zero ms,
// for 50 and 60 ms first VAD block will be 30 ms.
- noSamplesToProcess[0] =
- (frameLenMsec > 30) ? 3 * samplesIn10Msec : _frameLenSmpl;
- noSamplesToProcess[1] = _frameLenSmpl - noSamplesToProcess[0];
+ num_samples_to_process[0] =
+ (frame_len_ms > 30) ? 3 * samples_in_10ms : frame_len_smpl_;
+ num_samples_to_process[1] = frame_len_smpl_ - num_samples_to_process[0];
}
- int offSet = 0;
- int loops = (noSamplesToProcess[1] > 0) ? 2 : 1;
+ int offset = 0;
+ int loops = (num_samples_to_process[1] > 0) ? 2 : 1;
for (int i = 0; i < loops; i++) {
+ // TODO(turajs): Do we need to care about VAD together with stereo?
// If stereo, calculate mean of the two channels.
- if (_noChannels == 2) {
- for (int j = 0; j < noSamplesToProcess[i]; j++) {
- audio[j] = (_inAudio[(offSet + j) * 2] +
- _inAudio[(offSet + j) * 2 + 1]) / 2;
+ if (num_channels_ == 2) {
+ for (int j = 0; j < num_samples_to_process[i]; j++) {
+ audio[j] = (in_audio_[(offset + j) * 2] +
+ in_audio_[(offset + j) * 2 + 1]) / 2;
}
- offSet = noSamplesToProcess[0];
+ offset = num_samples_to_process[0];
} else {
- // Mono, copy data from _inAudio to continue work on.
- memcpy(audio, _inAudio, sizeof(int16_t) * noSamplesToProcess[i]);
+ // Mono, copy data from in_audio_ to continue work on.
+ memcpy(audio, in_audio_, sizeof(int16_t) * num_samples_to_process[i]);
}
// Call VAD.
- status = static_cast<int16_t>(WebRtcVad_Process(_ptrVADInst,
- static_cast<int>(freqHz),
+ status = static_cast<int16_t>(WebRtcVad_Process(ptr_vad_inst_,
+ static_cast<int>(freq_hz),
audio,
- noSamplesToProcess[i]));
- _vadLabel[i] = status;
+ num_samples_to_process[i]));
+ vad_label_[i] = status;
if (status < 0) {
// This will force that the data be removed from the buffer.
- *samplesProcessed += noSamplesToProcess[i];
+ *samples_processed += num_samples_to_process[i];
return -1;
}
@@ -1095,41 +1106,41 @@
// first part of a frame gets the VAD decision "inactive". Otherwise DTX
// might say it is time to transmit SID frame, but we will encode the whole
// frame, because the first part is active.
- *samplesProcessed = 0;
- if ((status == 0) && (i == 0) && _dtxEnabled && !_hasInternalDTX) {
- int16_t bitStreamLen;
- int num10MsecFrames = noSamplesToProcess[i] / samplesIn10Msec;
- *bitStreamLenByte = 0;
- for (int n = 0; n < num10MsecFrames; n++) {
+ *samples_processed = 0;
+ if ((status == 0) && (i == 0) && dtx_enabled_ && !has_internal_dtx_) {
+ int16_t bitstream_len;
+ int num_10ms_frames = num_samples_to_process[i] / samples_in_10ms;
+ *bitstream_len_byte = 0;
+ for (int n = 0; n < num_10ms_frames; n++) {
// This block is (passive) && (vad enabled). If first CNG after
// speech, force SID by setting last parameter to "1".
- status = WebRtcCng_Encode(_ptrDTXInst, &audio[n * samplesIn10Msec],
- samplesIn10Msec, bitStream, &bitStreamLen,
- !_prev_frame_cng);
+ status = WebRtcCng_Encode(ptr_dtx_inst_, &audio[n * samples_in_10ms],
+ samples_in_10ms, bitstream, &bitstream_len,
+ !prev_frame_cng_);
if (status < 0) {
return -1;
}
// Update previous frame was CNG.
- _prev_frame_cng = 1;
+ prev_frame_cng_ = 1;
- *samplesProcessed += samplesIn10Msec * _noChannels;
+ *samples_processed += samples_in_10ms * num_channels_;
- // |bitStreamLen| will only be > 0 once per 100 ms.
- *bitStreamLenByte += bitStreamLen;
+ // |bitstream_len_byte| will only be > 0 once per 100 ms.
+ *bitstream_len_byte += bitstream_len;
}
// Check if all samples got processed by the DTX.
- if (*samplesProcessed != noSamplesToProcess[i] * _noChannels) {
+ if (*samples_processed != num_samples_to_process[i] * num_channels_) {
// Set to zero since something went wrong. Shouldn't happen.
- *samplesProcessed = 0;
+ *samples_processed = 0;
}
} else {
// Update previous frame was not CNG.
- _prev_frame_cng = 0;
+ prev_frame_cng_ = 0;
}
- if (*samplesProcessed > 0) {
+ if (*samples_processed > 0) {
// The block contains inactive speech, and is processed by DTX.
// Discontinue running VAD.
break;
@@ -1140,85 +1151,88 @@
}
int16_t ACMGenericCodec::SamplesLeftToEncode() {
- ReadLockScoped rl(_codecWrapperLock);
- return (_frameLenSmpl <= _inAudioIxWrite) ? 0 :
- (_frameLenSmpl - _inAudioIxWrite);
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return (frame_len_smpl_ <= in_audio_ix_write_) ? 0 :
+ (frame_len_smpl_ - in_audio_ix_write_);
}
void ACMGenericCodec::SetUniqueID(const uint32_t id) {
- _uniqueID = id;
+ unique_id_ = id;
}
bool ACMGenericCodec::IsAudioBufferFresh() const {
- ReadLockScoped rl(_codecWrapperLock);
- return _isAudioBuffFresh;
+ ReadLockScoped rl(codec_wrapper_lock_);
+ return is_audio_buff_fresh_;
}
// This function is replaced by codec specific functions for some codecs.
-int16_t ACMGenericCodec::EncoderSampFreq(uint16_t& sampFreqHz) {
+int16_t ACMGenericCodec::EncoderSampFreq(uint16_t& samp_freq_hz) {
int32_t f;
- f = ACMCodecDB::CodecFreq(_codecID);
+ f = ACMCodecDB::CodecFreq(codec_id_);
if (f < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EncoderSampFreq: codec frequency is negative");
return -1;
} else {
- sampFreqHz = static_cast<uint16_t>(f);
+ samp_freq_hz = static_cast<uint16_t>(f);
return 0;
}
}
int32_t ACMGenericCodec::ConfigISACBandwidthEstimator(
- const uint8_t /* initFrameSizeMsec */,
- const uint16_t /* initRateBitPerSec */,
- const bool /* enforceFrameSize */) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _uniqueID,
- "The send-codec is not iSAC, failed to config iSAC bandwidth estimator.");
+ const uint8_t /* init_frame_size_msec */,
+ const uint16_t /* init_rate_bit_per_sec */,
+ const bool /* enforce_frame_size */) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, unique_id_,
+ "The send-codec is not iSAC, failed to config iSAC bandwidth "
+ "estimator.");
return -1;
}
-int32_t ACMGenericCodec::SetISACMaxRate(const uint32_t /* maxRateBitPerSec */) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _uniqueID,
+int32_t ACMGenericCodec::SetISACMaxRate(
+ const uint32_t /* max_rate_bit_per_sec */) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, unique_id_,
"The send-codec is not iSAC, failed to set iSAC max rate.");
return -1;
}
int32_t ACMGenericCodec::SetISACMaxPayloadSize(
- const uint16_t /* maxPayloadLenBytes */) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _uniqueID,
- "The send-codec is not iSAC, failed to set iSAC max payload-size.");
+ const uint16_t /* max_payload_len_bytes */) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, unique_id_,
+ "The send-codec is not iSAC, failed to set iSAC max "
+ "payload-size.");
return -1;
}
void ACMGenericCodec::SaveDecoderParam(
- const WebRtcACMCodecParams* codecParams) {
- WriteLockScoped wl(_codecWrapperLock);
- SaveDecoderParamSafe(codecParams);
+ const WebRtcACMCodecParams* codec_params) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ SaveDecoderParamSafe(codec_params);
}
void ACMGenericCodec::SaveDecoderParamSafe(
- const WebRtcACMCodecParams* codecParams) {
- memcpy(&_decoderParams, codecParams, sizeof(WebRtcACMCodecParams));
+ const WebRtcACMCodecParams* codec_params) {
+ memcpy(&decoder_params_, codec_params, sizeof(WebRtcACMCodecParams));
}
int16_t ACMGenericCodec::UpdateEncoderSampFreq(
- uint16_t /* encoderSampFreqHz */) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "It is asked for a change in smapling frequency while the current "
- "send-codec supports only one sampling rate.");
+ uint16_t /* samp_freq_hz */) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "It is asked for a change in smapling frequency while the "
+ "current send-codec supports only one sampling rate.");
return -1;
}
-void ACMGenericCodec::SetIsMaster(bool isMaster) {
- WriteLockScoped wl(_codecWrapperLock);
- _isMaster = isMaster;
+void ACMGenericCodec::SetIsMaster(bool is_master) {
+ WriteLockScoped wl(codec_wrapper_lock_);
+ is_master_ = is_master;
}
-int16_t ACMGenericCodec::REDPayloadISAC(const int32_t /* isacRate */,
- const int16_t /* isacBwEstimate */,
+int16_t ACMGenericCodec::REDPayloadISAC(const int32_t /* isac_rate */,
+ const int16_t /* isac_bw_estimate */,
uint8_t* /* payload */,
- int16_t* /* payloadLenBytes */) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ int16_t* /* payload_len_bytes */) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error: REDPayloadISAC is an iSAC specific function");
return -1;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_generic_codec.h b/webrtc/modules/audio_coding/main/source/acm_generic_codec.h
index 42d1386..681f56e 100644
--- a/webrtc/modules/audio_coding/main/source/acm_generic_codec.h
+++ b/webrtc/modules/audio_coding/main/source/acm_generic_codec.h
@@ -11,11 +11,11 @@
#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"
-#include "rw_lock_wrapper.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#define MAX_FRAME_SIZE_10MSEC 6
@@ -57,8 +57,8 @@
// A) Neither VAD nor DTX is active; the frame is encoded by the encoder.
//
// B) VAD is enabled but not DTX; in this case the audio is processed by VAD
- // and encoded by the encoder. The "*encodingType" will be either
- // "activeNormalEncode" or "passiveNormalEncode" if frame is active or
+ // and encoded by the encoder. The "*encoding_type" will be either
+ // "kActiveNormalEncode" or "kPassiveNormalEncode" if frame is active or
// passive, respectively.
//
// C) DTX is enabled; if the codec has internal VAD/DTX we just encode the
@@ -70,13 +70,13 @@
// the actual processing.
//
// Outputs:
- // -bitStream : a buffer where bit-stream will be written to.
- // -bitStreamLenByte : contains the length of the bit-stream in
+ // -bitstream : a buffer where bit-stream will be written to.
+ // -bitstream_len_byte : contains the length of the bit-stream in
// bytes.
- // -timeStamp : contains the RTP timestamp, this is the
+ // -timestamp : contains the RTP timestamp, this is the
// sampling time of the first sample encoded
// (measured in number of samples).
- // -encodingType : contains the type of encoding applied on the
+ // -encoding_type : contains the type of encoding applied on the
// audio samples. The alternatives are
// (c.f. acm_common_types.h)
// -kNoEncoding:
@@ -100,10 +100,10 @@
// -1 if error is occurred, otherwise the length of the bit-stream in
// bytes.
//
- WebRtc_Word16 Encode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte,
- WebRtc_UWord32* timeStamp,
- WebRtcACMEncodingType* encodingType);
+ WebRtc_Word16 Encode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte,
+ WebRtc_UWord32* timestamp,
+ WebRtcACMEncodingType* encoding_type);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 Decode()
@@ -114,22 +114,24 @@
// the actual processing. Please note that this is not functional yet.
//
// Inputs:
- // -bitStream : a buffer where bit-stream will be read.
- // -bitStreamLenByte : the length of the bit-stream in bytes.
+ // -bitstream : a buffer where bit-stream will be read.
+ // -bitstream_len_byte : the length of the bit-stream in bytes.
//
// Outputs:
// -audio : pointer to a buffer where the audio will written.
- // -audioSamples : number of audio samples out of decoding the given
+ // -audio_samples : number of audio samples out of decoding the given
// bit-stream.
- // -speechType : speech type (for future use).
+ // -speech_type : speech type (for future use).
//
// Return value:
// -1 if failed to decode,
// 0 if succeeded.
//
- WebRtc_Word16 Decode(WebRtc_UWord8* bitStream, WebRtc_Word16 bitStreamLenByte,
- WebRtc_Word16* audio, WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 Decode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio,
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
///////////////////////////////////////////////////////////////////////////
// void SplitStereoPacket()
@@ -146,9 +148,9 @@
// twice the input in case of true stereo, where
// we simply copy the data and return it both for
// left channel and right channel decoding.
+ //
virtual void SplitStereoPacket(WebRtc_UWord8* /* payload */,
- WebRtc_Word32* /* payload_length */) {
- }
+ WebRtc_Word32* /* payload_length */) {}
///////////////////////////////////////////////////////////////////////////
// bool EncoderInitialized();
@@ -174,7 +176,7 @@
// EncoderParamsSafe() in turn.
//
// Output:
- // -encParams : a buffer where the encoder parameters is
+ // -enc_params : a buffer where the encoder parameters is
// written to. If the encoder is not
// initialized this buffer is filled with
// invalid values
@@ -182,8 +184,7 @@
// -1 if the encoder is not initialized,
// 0 otherwise.
//
- //
- WebRtc_Word16 EncoderParams(WebRtcACMCodecParams *encParams);
+ WebRtc_Word16 EncoderParams(WebRtcACMCodecParams *enc_params);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 DecoderParams(...)
@@ -191,7 +192,7 @@
// in turn.
//
// Output:
- // -decParams : a buffer where the decoder parameters is
+ // -dec_params : a buffer where the decoder parameters is
// written to. If the decoder is not initialized
// this buffer is filled with invalid values
//
@@ -200,8 +201,8 @@
// 0 otherwise.
//
//
- bool DecoderParams(WebRtcACMCodecParams *decParams,
- const WebRtc_UWord8 payloadType);
+ bool DecoderParams(WebRtcACMCodecParams *dec_params,
+ const WebRtc_UWord8 payload_type);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InitEncoder(...)
@@ -209,18 +210,18 @@
// parameters.
//
// Input:
- // -codecParams : parameters of encoder.
- // -forceInitialization: if false the initialization is invoked only if
- // the encoder is not initialized. If true the
- // encoder is forced to (re)initialize.
+ // -codec_params : parameters of encoder.
+ // -force_initialization: if false the initialization is invoked only if
+ // the encoder is not initialized. If true the
+ // encoder is forced to (re)initialize.
//
// Return value:
// 0 if could initialize successfully,
// -1 if failed to initialize.
//
//
- WebRtc_Word16 InitEncoder(WebRtcACMCodecParams* codecParams,
- bool forceInitialization);
+ WebRtc_Word16 InitEncoder(WebRtcACMCodecParams* codec_params,
+ bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InitDecoder()
@@ -229,33 +230,33 @@
// definition of the structure)
//
// Input:
- // -codecParams : parameters of decoder.
- // -forceInitialization: if false the initialization is invoked only
- // if the decoder is not initialized. If true
- // the encoder is forced to(re)initialize.
+ // -codec_params : parameters of decoder.
+ // -force_initialization: if false the initialization is invoked only
+ // if the decoder is not initialized. If true
+ // the encoder is forced to(re)initialize.
//
// Return value:
// 0 if could initialize successfully,
// -1 if failed to initialize.
//
//
- WebRtc_Word16 InitDecoder(WebRtcACMCodecParams* codecParams,
- bool forceInitialization);
+ WebRtc_Word16 InitDecoder(WebRtcACMCodecParams* codec_params,
+ bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterInNetEq(...)
// This function is called to register the decoder in NetEq, with the given
- // payload-type.
+ // payload type.
//
// Inputs:
- // -netEq : pointer to NetEq Instance
- // -codecInst : instance with of the codec settings of the codec
+ // -neteq : pointer to NetEq Instance
+ // -codec_inst : instance with of the codec settings of the codec
//
// Return values
// -1 if failed to register,
// 0 if successfully initialized.
//
- WebRtc_Word32 RegisterInNetEq(ACMNetEQ* netEq, const CodecInst& codecInst);
+ WebRtc_Word32 RegisterInNetEq(ACMNetEQ* neteq, const CodecInst& codec_inst);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 Add10MsData(...)
@@ -263,23 +264,23 @@
// the codec.
//
// Inputs:
- // -timeStamp : the timestamp of the 10 ms audio. the timestamp
+ // -timestamp : the timestamp of the 10 ms audio. the timestamp
// is the sampling time of the
// first sample measured in number of samples.
// -data : a buffer that contains the audio. The codec
// expects to get the audio in correct sampling
// frequency
// -length : the length of the audio buffer
- // -audioChannel : 0 for mono, 1 for stereo (not supported yet)
+ // -audio_channel : 0 for mono, 1 for stereo (not supported yet)
//
// Return values:
// -1 if failed
// 0 otherwise.
//
- WebRtc_Word32 Add10MsData(const WebRtc_UWord32 timeStamp,
+ WebRtc_Word32 Add10MsData(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length,
- const WebRtc_UWord8 audioChannel);
+ const WebRtc_UWord8 audio_channel);
///////////////////////////////////////////////////////////////////////////
// WebRtc_UWord32 NoMissedSamples()
@@ -305,26 +306,26 @@
// The function is called to set the encoding rate.
//
// Input:
- // -bitRateBPS : encoding rate in bits per second
+ // -bitrate_bps : encoding rate in bits per second
//
// Return value:
// -1 if failed to set the rate, due to invalid input or given
// codec is not rate-adjustable.
// 0 if the rate is adjusted successfully
//
- WebRtc_Word16 SetBitRate(const WebRtc_Word32 bitRateBPS);
+ WebRtc_Word16 SetBitRate(const WebRtc_Word32 bitrate_bps);
///////////////////////////////////////////////////////////////////////////
// DestructEncoderInst()
// This API is used in conferencing. It will free the memory that is pointed
- // by "ptrInst". "ptrInst" is a pointer to encoder instance, created and
+ // by |ptr_inst|. |ptr_inst| is a pointer to encoder instance, created and
// filled up by calling EncoderInst(...).
//
// Inputs:
- // -ptrInst : pointer to an encoder instance to be deleted.
+ // -ptr_inst : pointer to an encoder instance to be deleted.
//
//
- void DestructEncoderInst(void* ptrInst);
+ void DestructEncoderInst(void* ptr_inst);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 AudioBuffer()
@@ -334,14 +335,14 @@
// as timestamps...
//
// Output:
- // -audioBuff : a pointer to WebRtcACMAudioBuff where the audio
+ // -audio_buff : a pointer to WebRtcACMAudioBuff where the audio
// buffer of this codec will be written to.
//
// Return value:
// -1 if fails to copy the audio buffer,
// 0 if succeeded.
//
- WebRtc_Word16 AudioBuffer(WebRtcACMAudioBuff& audioBuff);
+ WebRtc_Word16 AudioBuffer(WebRtcACMAudioBuff& audio_buff);
///////////////////////////////////////////////////////////////////////////
// WebRtc_UWord32 EarliestTimestamp()
@@ -362,7 +363,7 @@
// -1 if fails to copy the audio buffer,
// 0 if succeeded.
//
- WebRtc_Word16 SetAudioBuffer(WebRtcACMAudioBuff& audioBuff);
+ WebRtc_Word16 SetAudioBuffer(WebRtcACMAudioBuff& audio_buff);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 SetVAD()
@@ -376,24 +377,24 @@
// are kept.
//
// Inputs:
- // -enableDTX : if true DTX will be enabled otherwise the DTX is
+ // -enable_dtx : if true DTX will be enabled otherwise the DTX is
// disabled. If codec has internal DTX that will be
// used, otherwise WebRtc-CNG is used. In the latter
// case VAD is automatically activated.
- // -enableVAD : if true WebRtc-VAD is enabled, otherwise VAD is
+ // -enable_vad : if true WebRtc-VAD is enabled, otherwise VAD is
// disabled, except for the case that DTX is enabled
// but codec doesn't have internal DTX. In this case
// VAD is enabled regardless of the value of
- // "enableVAD."
+ // |enable_vad|.
// -mode : this specifies the aggressiveness of VAD.
//
// Return value
// -1 if failed to set DTX & VAD as specified,
// 0 if succeeded.
//
- WebRtc_Word16 SetVAD(const bool enableDTX = true,
- const bool enableVAD = false, const ACMVADMode mode =
- VADNormal);
+ WebRtc_Word16 SetVAD(const bool enable_dtx = true,
+ const bool enable_vad = false,
+ const ACMVADMode mode = VADNormal);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ReplaceInternalDTX()
@@ -402,13 +403,13 @@
// AnnexB with WebRtc DTX. For other codecs this function has no effect.
//
// Input:
- // -replaceInternalDTX : if true the internal DTX is replaced with WebRtc.
+ // -replace_internal_dtx : if true the internal DTX is replaced with WebRtc.
//
// Return value
// -1 if failed to replace internal DTX,
// 0 if succeeded.
//
- WebRtc_Word32 ReplaceInternalDTX(const bool replaceInternalDTX);
+ WebRtc_Word32 ReplaceInternalDTX(const bool replace_internal_dtx);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 IsInternalDTXReplaced()
@@ -417,23 +418,23 @@
// AnnexB with WebRtc DTX. For other codecs this function has no effect.
//
// Output:
- // -internalDTXReplaced : if true the internal DTX is replaced with WebRtc.
+ // -internal_dtx_replaced: if true the internal DTX is replaced with WebRtc.
//
// Return value
// -1 if failed to check
// 0 if succeeded.
//
- WebRtc_Word32 IsInternalDTXReplaced(bool* internalDTXReplaced);
+ WebRtc_Word32 IsInternalDTXReplaced(bool* internal_dtx_replaced);
///////////////////////////////////////////////////////////////////////////
// void SetNetEqDecodeLock()
// Passes the NetEq lock to the codec.
//
// Input:
- // -netEqDecodeLock : pointer to the lock associated with NetEQ of ACM.
+ // -neteq_decode_lock : pointer to the lock associated with NetEQ of ACM.
//
- void SetNetEqDecodeLock(RWLockWrapper* netEqDecodeLock) {
- _netEqDecodeLock = netEqDecodeLock;
+ void SetNetEqDecodeLock(RWLockWrapper* neteq_decode_lock) {
+ neteq_decode_lock_ = neteq_decode_lock;
}
///////////////////////////////////////////////////////////////////////////
@@ -445,7 +446,7 @@
// false otherwise.
//
bool HasInternalDTX() const {
- return _hasInternalDTX;
+ return has_internal_dtx_;
}
///////////////////////////////////////////////////////////////////////////
@@ -465,13 +466,13 @@
// iSAC will have use for the value.
//
// Input:
- // -estimatedBandwidth: estimated bandwidth in bits/sec
+ // -estimated_bandwidth: estimated bandwidth in bits/sec
//
// Return value:
// -1 if fails to set estimated bandwidth,
// 0 on success.
//
- WebRtc_Word32 SetEstimatedBandwidth(WebRtc_Word32 estimatedBandwidth);
+ WebRtc_Word32 SetEstimatedBandwidth(WebRtc_Word32 estimated_bandwidth);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 GetRedPayload()
@@ -479,15 +480,15 @@
// Currently only done in iSAC.
//
// Outputs:
- // -redPayload : a pointer to the data for RED payload.
- // -payloadBytes : number of bytes in RED payload.
+ // -red_payload : a pointer to the data for RED payload.
+ // -payload_bytes : number of bytes in RED payload.
//
// Return value:
// -1 if fails to get codec specific RED,
// 0 if succeeded.
//
- WebRtc_Word32 GetRedPayload(WebRtc_UWord8* redPayload,
- WebRtc_Word16* payloadBytes);
+ WebRtc_Word32 GetRedPayload(WebRtc_UWord8* red_payload,
+ WebRtc_Word16* payload_bytes);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 ResetEncoder()
@@ -510,7 +511,7 @@
// -1 if failed,
// 0 if succeeded.
//
- WebRtc_Word16 ResetDecoder(WebRtc_Word16 payloadType);
+ WebRtc_Word16 ResetDecoder(WebRtc_Word16 payload_type);
///////////////////////////////////////////////////////////////////////////
// void DestructEncoder()
@@ -551,7 +552,7 @@
///////////////////////////////////////////////////////////////////////////
// SetUniqueID()
- // Set a unique ID for the codec to be used for tracing and debuging
+ // Set a unique ID for the codec to be used for tracing and debugging
//
// Input
// -id : A number to identify the codec.
@@ -572,28 +573,28 @@
// UpdateDecoderSampFreq()
// For most of the codecs this function does nothing. It must be
// implemented for those codecs that one codec instance serves as the
- // decoder for different flavers of the codec. One example is iSAC. there,
+ // decoder for different flavors of the codec. One example is iSAC. there,
// iSAC 16 kHz and iSAC 32 kHz are treated as two different codecs with
// different payload types, however, there is only one iSAC instance to
// decode. The reason for that is we would like to decode and encode with
// the same codec instance for bandwidth estimator to work.
//
- // Each time that we receive a new payload type, we call this funtion to
+ // Each time that we receive a new payload type, we call this function to
// prepare the decoder associated with the new payload. Normally, decoders
// doesn't have to do anything. For iSAC the decoder has to change it's
- // sampling rate. The input parameter specifies the current flaver of the
+ // sampling rate. The input parameter specifies the current flavor of the
// codec in codec database. For instance, if we just got a SWB payload then
// the input parameter is ACMCodecDB::isacswb.
//
// Input:
- // -codecId : the ID of the codec associated with the
+ // -codec_id : the ID of the codec associated with the
// payload type that we just received.
//
// Return value:
// 0 if succeeded in updating the decoder.
// -1 if failed to update.
//
- virtual WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 /* codecId */) {
+ virtual WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 /* codec_id */) {
return 0;
}
@@ -607,32 +608,33 @@
// is treated as a change in parameter. Therefore, we need this function.
//
// Input:
- // -encoderSampFreqHz : encoder sampling frequency.
+ // -samp_freq_hz : encoder sampling frequency.
//
// Return value:
// -1 if failed, or if this is meaningless for the given codec.
// 0 if succeeded.
//
- virtual WebRtc_Word16 UpdateEncoderSampFreq(WebRtc_UWord16 encoderSampFreqHz);
+ virtual WebRtc_Word16 UpdateEncoderSampFreq(
+ WebRtc_UWord16 samp_freq_hz);
///////////////////////////////////////////////////////////////////////////
// EncoderSampFreq()
// Get the sampling frequency that the encoder (WebRtc wrapper) expects.
//
// Output:
- // -sampFreqHz : sampling frequency, in Hertz, which the encoder
+ // -samp_freq_hz : sampling frequency, in Hertz, which the encoder
// should be fed with.
//
// Return value:
// -1 if failed to output sampling rate.
// 0 if the sample rate is returned successfully.
//
- virtual WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& sampFreqHz);
+ virtual WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& samp_freq_hz);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ConfigISACBandwidthEstimator()
// Call this function to configure the bandwidth estimator of ISAC.
- // During the adaptation of bit-rate, iSAC atomatically adjusts the
+ // During the adaptation of bit-rate, iSAC automatically adjusts the
// frame-size (either 30 or 60 ms) to save on RTP header. The initial
// frame-size can be specified by the first argument. The configuration also
// regards the initial estimate of bandwidths. The estimator starts from
@@ -641,72 +643,73 @@
// adaptation of frame-size. This is specified by the last parameter.
//
// Input:
- // -initFrameSizeMsec : initial frame-size in milisecods. For iSAC-wb
+ // -init_frame_fize_ms : initial frame-size in milliseconds. For iSAC-wb
// 30 ms and 60 ms (default) are acceptable values,
// and for iSAC-swb 30 ms is the only acceptable
- // value. Zero indiates default value.
- // -initRateBitPerSec : initial estimate of the bandwidth. Values
+ // value. Zero indicates default value.
+ // -init_rate_bps : initial estimate of the bandwidth. Values
// between 10000 and 58000 are acceptable.
- // -enforceFrameSize : if true, the frame-size will not be adapted.
+ // -enforce_frame_size : if true, the frame-size will not be adapted.
//
// Return value:
// -1 if failed to configure the bandwidth estimator,
// 0 if the configuration was successfully applied.
//
virtual WebRtc_Word32 ConfigISACBandwidthEstimator(
- const WebRtc_UWord8 initFrameSizeMsec,
- const WebRtc_UWord16 initRateBitPerSec, const bool enforceFrameSize);
+ const WebRtc_UWord8 init_frame_size_msec,
+ const WebRtc_UWord16 init_rate_bps,
+ const bool enforce_frame_size);
///////////////////////////////////////////////////////////////////////////
// SetISACMaxPayloadSize()
// Set the maximum payload size of iSAC packets. No iSAC payload,
// regardless of its frame-size, may exceed the given limit. For
// an iSAC payload of size B bits and frame-size T sec we have;
- // (B < maxPayloadLenBytes * 8) and (B/T < maxRateBitPerSec), c.f.
+ // (B < max_payload_len_bytes * 8) and (B/T < max_rate_bit_per_sec), c.f.
// SetISACMaxRate().
//
// Input:
- // -maxPayloadLenBytes : maximum payload size in bytes.
+ // -max_payload_len_bytes : maximum payload size in bytes.
//
// Return value:
- // -1 if failed to set the maximm payload-size.
- // 0 if the given linit is seet successfully.
+ // -1 if failed to set the maximum payload-size.
+ // 0 if the given length is set successfully.
//
virtual WebRtc_Word32 SetISACMaxPayloadSize(
- const WebRtc_UWord16 maxPayloadLenBytes);
+ const WebRtc_UWord16 max_payload_len_bytes);
///////////////////////////////////////////////////////////////////////////
// SetISACMaxRate()
// Set the maximum instantaneous rate of iSAC. For a payload of B bits
- // with a frame-size of T sec the instantaneous rate is B/T bist per
- // second. Therefore, (B/T < maxRateBitPerSec) and
- // (B < maxPayloadLenBytes * 8) are always satisfied for iSAC payloads,
+ // with a frame-size of T sec the instantaneous rate is B/T bits per
+ // second. Therefore, (B/T < max_rate_bit_per_sec) and
+ // (B < max_payload_len_bytes * 8) are always satisfied for iSAC payloads,
// c.f SetISACMaxPayloadSize().
//
// Input:
- // -maxRateBitPerSec : maximum instantaneous bit-rate given in bits/sec.
+ // -max_rate_bps : maximum instantaneous bit-rate given in bits/sec.
//
// Return value:
// -1 if failed to set the maximum rate.
// 0 if the maximum rate is set successfully.
//
- virtual WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 maxRateBitPerSec);
+ virtual WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_rate_bps);
///////////////////////////////////////////////////////////////////////////
// SaveDecoderParamS()
// Save the parameters of decoder.
//
// Input:
- // -codecParams : pointer to a struct where the parameters of
+ // -codec_params : pointer to a structure where the parameters of
// decoder is stored in.
//
- void SaveDecoderParam(const WebRtcACMCodecParams* codecParams);
+ void SaveDecoderParam(const WebRtcACMCodecParams* codec_params);
WebRtc_Word32 FrameSize() {
- return _frameLenSmpl;
+ return frame_len_smpl_;
}
- void SetIsMaster(bool isMaster);
+ void SetIsMaster(bool is_master);
///////////////////////////////////////////////////////////////////////////
// REDPayloadISAC()
@@ -714,28 +717,27 @@
// payload from a default-encoder.
//
// Inputs:
- // -isacRate : the target rate of the main payload. A RED
+ // -isac_rate : the target rate of the main payload. A RED
// payload is generated according to the rate of
// main payload. Note that we are not specifying the
// rate of RED payload, but the main payload.
- // -isacBwEstimate : bandwidth information should be inserted in
+ // -isac_bw_estimate : bandwidth information should be inserted in
// RED payload.
//
// Output:
// -payload : pointer to a buffer where the RED payload will
// written to.
- // -payloadLenBytes : a place-holder to write the length of the RED
+ // -payload_len_bytes : a place-holder to write the length of the RED
// payload in Bytes.
//
// Return value:
- // -1 if an error occures, otherwise the length of the payload (in Bytes)
+ // -1 if an error occurs, otherwise the length of the payload (in Bytes)
// is returned.
//
- //
- virtual WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isacRate,
- const WebRtc_Word16 isacBwEstimate,
+ virtual WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isac_rate,
+ const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
- WebRtc_Word16* payloadLenBytes);
+ WebRtc_Word16* payload_len_bytes);
///////////////////////////////////////////////////////////////////////////
// IsTrueStereoCodec()
@@ -769,40 +771,40 @@
// See Decode() for the description of function, input(s)/output(s) and
// return value.
//
- virtual WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ virtual WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType) = 0;
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type) = 0;
///////////////////////////////////////////////////////////////////////////
// See Add10MsSafe() for the description of function, input(s)/output(s)
// and return value.
//
- virtual WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timeStamp,
+ virtual WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length,
- const WebRtc_UWord8 audioChannel);
+ const WebRtc_UWord8 audio_channel);
///////////////////////////////////////////////////////////////////////////
// See RegisterInNetEq() for the description of function,
// input(s)/output(s) and return value.
//
- virtual WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) = 0;
+ virtual WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) = 0;
///////////////////////////////////////////////////////////////////////////
// See EncoderParam() for the description of function, input(s)/output(s)
// and return value.
//
- WebRtc_Word16 EncoderParamsSafe(WebRtcACMCodecParams *encParams);
+ WebRtc_Word16 EncoderParamsSafe(WebRtcACMCodecParams *enc_params);
///////////////////////////////////////////////////////////////////////////
// See DecoderParam for the description of function, input(s)/output(s)
// and return value.
//
// Note:
- // Any Class where a single instance handle several flavers of the
+ // Any Class where a single instance handle several flavors of the
// same codec, therefore, several payload types are associated with
// the same instance have to implement this function.
//
@@ -811,8 +813,8 @@
// can be registered as receive codec. Hence two payloads are associated
// with a single codec instance.
//
- virtual bool DecoderParamsSafe(WebRtcACMCodecParams *decParams,
- const WebRtc_UWord8 payloadType);
+ virtual bool DecoderParamsSafe(WebRtcACMCodecParams *dec_params,
+ const WebRtc_UWord8 payload_type);
///////////////////////////////////////////////////////////////////////////
// See ResetEncoder() for the description of function, input(s)/output(s)
@@ -824,21 +826,21 @@
// See InitEncoder() for the description of function, input(s)/output(s)
// and return value.
//
- WebRtc_Word16 InitEncoderSafe(WebRtcACMCodecParams *codecParams,
- bool forceInitialization);
+ WebRtc_Word16 InitEncoderSafe(WebRtcACMCodecParams *codec_params,
+ bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// See InitDecoder() for the description of function, input(s)/output(s)
// and return value.
//
- WebRtc_Word16 InitDecoderSafe(WebRtcACMCodecParams *codecParams,
- bool forceInitialization);
+ WebRtc_Word16 InitDecoderSafe(WebRtcACMCodecParams *codec_params,
+ bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// See ResetDecoder() for the description of function, input(s)/output(s)
// and return value.
//
- WebRtc_Word16 ResetDecoderSafe(WebRtc_Word16 payloadType);
+ WebRtc_Word16 ResetDecoderSafe(WebRtc_Word16 payload_type);
///////////////////////////////////////////////////////////////////////////
// See DestructEncoder() for the description of function,
@@ -858,7 +860,7 @@
//
// Any codec that can change the bit-rate has to implement this.
//
- virtual WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bitRateBPS);
+ virtual WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bitrate_bps);
///////////////////////////////////////////////////////////////////////////
// See GetEstimatedBandwidth() for the description of function,
@@ -871,34 +873,34 @@
// input(s)/output(s) and return value.
//
virtual WebRtc_Word32 SetEstimatedBandwidthSafe(
- WebRtc_Word32 estimatedBandwidth);
+ WebRtc_Word32 estimated_bandwidth);
///////////////////////////////////////////////////////////////////////////
// See GetRedPayload() for the description of function, input(s)/output(s)
// and return value.
//
- virtual WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* redPayload,
- WebRtc_Word16* payloadBytes);
+ virtual WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* red_payload,
+ WebRtc_Word16* payload_bytes);
///////////////////////////////////////////////////////////////////////////
// See SetVAD() for the description of function, input(s)/output(s) and
// return value.
//
- WebRtc_Word16 SetVADSafe(const bool enableDTX = true, const bool enableVAD =
- false,
+ WebRtc_Word16 SetVADSafe(const bool enable_dtx = true,
+ const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
///////////////////////////////////////////////////////////////////////////
// See ReplaceInternalDTX() for the description of function, input and
// return value.
//
- virtual WebRtc_Word32 ReplaceInternalDTXSafe(const bool replaceInternalDTX);
+ virtual WebRtc_Word32 ReplaceInternalDTXSafe(const bool replace_internal_dtx);
///////////////////////////////////////////////////////////////////////////
// See IsInternalDTXReplaced() for the description of function, input and
// return value.
//
- virtual WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internalDTXReplaced);
+ virtual WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 CreateEncoder()
@@ -973,17 +975,17 @@
// encode a frame of audio.
//
// Outputs:
- // -bitStream : pointer to a buffer where the bit-stream is
+ // -bitstream : pointer to a buffer where the bit-stream is
// written to.
- // -bitStreamLenByte : the length of the bit-stream in bytes,
+ // -bitstream_len_byte : the length of the bit-stream in bytes,
// a negative value indicates error.
//
// Return value:
// -1 if failed,
// otherwise the length of the bit-stream is returned.
//
- virtual WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) = 0;
+ virtual WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalInitEncoder()
@@ -992,9 +994,9 @@
// encoder parameters.
//
// Input:
- // -codecParams : pointer to a structure that contains parameters to
+ // -codec_params : pointer to a structure that contains parameters to
// initialize encoder.
- // Set codecParam->CodecInst.rate to -1 for
+ // Set codec_params->codec_inst.rate to -1 for
// iSAC to operate in adaptive mode.
// (to do: if frame-length is -1 frame-length will be
// automatically adjusted, otherwise, given
@@ -1005,7 +1007,7 @@
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalInitEncoder(
- WebRtcACMCodecParams *codecParams) = 0;
+ WebRtcACMCodecParams *codec_params) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalInitDecoder()
@@ -1014,7 +1016,7 @@
// decoder parameters.
//
// Input:
- // -codecParams : pointer to a structure that contains parameters to
+ // -codec_params : pointer to a structure that contains parameters to
// initialize encoder.
//
// Return value:
@@ -1022,7 +1024,7 @@
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalInitDecoder(
- WebRtcACMCodecParams *codecParams) = 0;
+ WebRtcACMCodecParams *codec_params) = 0;
///////////////////////////////////////////////////////////////////////////
// void IncreaseNoMissedSamples()
@@ -1030,10 +1032,10 @@
// overwritten in the audio buffer.
//
// Input:
- // -noSamples : the number of overwritten samples is incremented
+ // -num_samples : the number of overwritten samples is incremented
// by this value.
//
- void IncreaseNoMissedSamples(const WebRtc_Word16 noSamples);
+ void IncreaseNoMissedSamples(const WebRtc_Word16 num_samples);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalCreateEncoder()
@@ -1064,17 +1066,17 @@
// This is a codec-specific method, used in conferencing, called from
// DestructEncoderInst(). The input argument is pointer to encoder instance
// (codec instance for codecs that encoder and decoder share the same
- // instance). This method is called to free the memory that "ptrInst" is
+ // instance). This method is called to free the memory that |ptr_inst| is
// pointing to.
//
// Input:
- // -ptrInst : pointer to encoder instance.
+ // -ptr_inst : pointer to encoder instance.
//
// Return value:
// -1 if failed,
// 0 if succeeded.
//
- virtual void InternalDestructEncoderInst(void* ptrInst) = 0;
+ virtual void InternalDestructEncoderInst(void* ptr_inst) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalResetEncoder()
@@ -1098,123 +1100,123 @@
// by VAD & CN/DTX. If a frame is divided into two blocks then there are two
// cases. First, the first block is active, the second block will not be
// processed by CN/DTX but only by VAD and return to caller with
- // '*samplesProcessed' set to zero. There, the audio frame will be encoded
+ // '*samples_processed' set to zero. There, the audio frame will be encoded
// by the encoder. Second, the first block is inactive and is processed by
// CN/DTX, then we stop processing the next block and return to the caller
- // which is EncodeSafe(), with "*samplesProcessed" equal to the number of
+ // which is EncodeSafe(), with "*samples_processed" equal to the number of
// samples in first block.
//
// Output:
- // -bitStream : pointer to a buffer where DTX frame, if
+ // -bitstream : pointer to a buffer where DTX frame, if
// generated, will be written to.
- // -bitStreamLenByte : contains the length of bit-stream in bytes, if
+ // -bitstream_len_byte : contains the length of bit-stream in bytes, if
// generated. Zero if no bit-stream is generated.
- // -noSamplesProcessed : contains no of samples that actually CN has
+ // -samples_processed : contains no of samples that actually CN has
// processed. Those samples processed by CN will not
// be encoded by the encoder, obviously. If
// contains zero, it means that the frame has been
// identified as active by VAD. Note that
- // "*noSamplesProcessed" might be non-zero but
- // "*bitStreamLenByte" be zero.
+ // "*samples_processed" might be non-zero but
+ // "*bitstream_len_byte" be zero.
//
// Return value:
// -1 if failed,
// 0 if succeeded.
//
- WebRtc_Word16 ProcessFrameVADDTX(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte,
- WebRtc_Word16* samplesProcessed);
+ WebRtc_Word16 ProcessFrameVADDTX(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte,
+ WebRtc_Word16* samples_processed);
///////////////////////////////////////////////////////////////////////////
// CanChangeEncodingParam()
// Check if the codec parameters can be changed. In conferencing normally
- // codec parametrs cannot be changed. The exception is bit-rate of isac.
+ // codec parameters cannot be changed. The exception is bit-rate of isac.
//
// return value:
// -true if codec parameters are allowed to change.
- // -flase otherwise.
+ // -false otherwise.
//
- virtual bool CanChangeEncodingParam(CodecInst& codecInst);
+ virtual bool CanChangeEncodingParam(CodecInst& codec_inst);
///////////////////////////////////////////////////////////////////////////
// CurrentRate()
// Call to get the current encoding rate of the encoder. This function
- // should be overwritten for codecs whic automatically change their
+ // should be overwritten for codecs which automatically change their
// target rate. One example is iSAC. The output of the function is the
// current target rate.
//
// Output:
- // -rateBitPerSec : the current target rate of the codec.
+ // -rate_bps : the current target rate of the codec.
//
- virtual void CurrentRate(WebRtc_Word32& /* rateBitPerSec */) {
+ virtual void CurrentRate(WebRtc_Word32& /* rate_bps */) {
return;
}
- virtual void SaveDecoderParamSafe(const WebRtcACMCodecParams* codecParams);
+ virtual void SaveDecoderParamSafe(const WebRtcACMCodecParams* codec_params);
- // &_inAudio[_inAudioIxWrite] always point to where new audio can be
+ // &in_audio_[in_audio_ix_write_] always point to where new audio can be
// written to
- WebRtc_Word16 _inAudioIxWrite;
+ WebRtc_Word16 in_audio_ix_write_;
- // &_inAudio[_inAudioIxRead] points to where audio has to be read from
- WebRtc_Word16 _inAudioIxRead;
+ // &in_audio_[in_audio_ix_read_] points to where audio has to be read from
+ WebRtc_Word16 in_audio_ix_read_;
- WebRtc_Word16 _inTimestampIxWrite;
+ WebRtc_Word16 in_timestamp_ix_write_;
// Where the audio is stored before encoding,
// To save memory the following buffer can be allocated
- // dynamically for 80ms depending on the sampling frequency
+ // dynamically for 80 ms depending on the sampling frequency
// of the codec.
- WebRtc_Word16* _inAudio;
- WebRtc_UWord32* _inTimestamp;
+ WebRtc_Word16* in_audio_;
+ WebRtc_UWord32* in_timestamp_;
- WebRtc_Word16 _frameLenSmpl;
- WebRtc_UWord16 _noChannels;
+ WebRtc_Word16 frame_len_smpl_;
+ WebRtc_UWord16 num_channels_;
// This will point to a static database of the supported codecs
- WebRtc_Word16 _codecID;
+ WebRtc_Word16 codec_id_;
- // This will account for the No of samples were not encoded
- // the case is rare, either samples are missed due to overwite
+ // This will account for the number of samples were not encoded
+ // the case is rare, either samples are missed due to overwrite
// at input buffer or due to encoding error
- WebRtc_UWord32 _noMissedSamples;
+ WebRtc_UWord32 num_missed_samples_;
// True if the encoder instance created
- bool _encoderExist;
- bool _decoderExist;
- // True if the ecncoder instance initialized
- bool _encoderInitialized;
- bool _decoderInitialized;
+ bool encoder_exist_;
+ bool decoder_exist_;
+ // True if the encoder instance initialized
+ bool encoder_initialized_;
+ bool decoder_initialized_;
- bool _registeredInNetEq;
+ bool registered_in_neteq_;
// VAD/DTX
- bool _hasInternalDTX;
- WebRtcVadInst* _ptrVADInst;
- bool _vadEnabled;
- ACMVADMode _vadMode;
- WebRtc_Word16 _vadLabel[MAX_FRAME_SIZE_10MSEC];
- bool _dtxEnabled;
- WebRtcCngEncInst* _ptrDTXInst;
- WebRtc_UWord8 _numLPCParams;
- bool _sentCNPrevious;
- bool _isMaster;
- int16_t _prev_frame_cng;
+ bool has_internal_dtx_;
+ WebRtcVadInst* ptr_vad_inst_;
+ bool vad_enabled_;
+ ACMVADMode vad_mode_;
+ WebRtc_Word16 vad_label_[MAX_FRAME_SIZE_10MSEC];
+ bool dtx_enabled_;
+ WebRtcCngEncInst* ptr_dtx_inst_;
+ WebRtc_UWord8 num_lpc_params_;
+ bool sent_cn_previous_;
+ bool is_master_;
+ int16_t prev_frame_cng_;
- WebRtcACMCodecParams _encoderParams;
- WebRtcACMCodecParams _decoderParams;
+ WebRtcACMCodecParams encoder_params_;
+ WebRtcACMCodecParams decoder_params_;
- // Used as a global lock for all avaiable decoders
+ // Used as a global lock for all available decoders
// so that no decoder is used when NetEQ decodes.
- RWLockWrapper* _netEqDecodeLock;
+ RWLockWrapper* neteq_decode_lock_;
// Used to lock wrapper internal data
// such as buffers and state variables.
- RWLockWrapper& _codecWrapperLock;
+ RWLockWrapper& codec_wrapper_lock_;
- WebRtc_UWord32 _lastEncodedTimestamp;
- WebRtc_UWord32 _lastTimestamp;
- bool _isAudioBuffFresh;
- WebRtc_UWord32 _uniqueID;
+ WebRtc_UWord32 last_encoded_timestamp_;
+ WebRtc_UWord32 last_timestamp_;
+ bool is_audio_buff_fresh_;
+ WebRtc_UWord32 unique_id_;
};
} // namespace webrt
diff --git a/webrtc/modules/audio_coding/main/source/acm_gsmfr.cc b/webrtc/modules/audio_coding/main/source/acm_gsmfr.cc
index 18c3077..5b59ed3 100644
--- a/webrtc/modules/audio_coding/main/source/acm_gsmfr.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_gsmfr.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_gsmfr.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_gsmfr.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_GSMFR
// NOTE! GSM-FR is not included in the open-source package. Modify this file
// or your codec API to match the function calls and names of used GSM-FR API
@@ -26,9 +26,9 @@
#ifndef WEBRTC_CODEC_GSMFR
-ACMGSMFR::ACMGSMFR(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
+ACMGSMFR::ACMGSMFR(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
return;
}
@@ -36,16 +36,17 @@
return;
}
-WebRtc_Word16 ACMGSMFR::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMGSMFR::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
@@ -58,17 +59,17 @@
}
WebRtc_Word16 ACMGSMFR::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMGSMFR::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -92,62 +93,62 @@
return;
}
-void ACMGSMFR::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMGSMFR::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
#else //===================== Actual Implementation =======================
-ACMGSMFR::ACMGSMFR(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
- _codecID = codecID;
- _hasInternalDTX = true;
+ACMGSMFR::ACMGSMFR(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
+ codec_id_ = codec_id;
+ has_internal_dtx_ = true;
return;
}
ACMGSMFR::~ACMGSMFR() {
- if (_encoderInstPtr != NULL) {
- WebRtcGSMFR_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcGSMFR_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcGSMFR_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcGSMFR_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMGSMFR::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- *bitStreamLenByte = WebRtcGSMFR_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- (WebRtc_Word16*) bitStream);
+WebRtc_Word16 ACMGSMFR::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ *bitstream_len_byte = WebRtcGSMFR_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ (WebRtc_Word16*)bitstream);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _frameLenSmpl;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMGSMFR::EnableDTX() {
- if (_dtxEnabled) {
+ if (dtx_enabled_) {
return 0;
- } else if (_encoderExist) {
- if (WebRtcGSMFR_EncoderInit(_encoderInstPtr, 1) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ } else if (encoder_exist_) {
+ if (WebRtcGSMFR_EncoderInit(encoder_inst_ptr_, 1) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"EnableDTX: cannot init encoder for GSMFR");
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
return 0;
} else {
return -1;
@@ -155,15 +156,15 @@
}
WebRtc_Word16 ACMGSMFR::DisableDTX() {
- if (!_dtxEnabled) {
+ if (!dtx_enabled_) {
return 0;
- } else if (_encoderExist) {
- if (WebRtcGSMFR_EncoderInit(_encoderInstPtr, 0) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ } else if (encoder_exist_) {
+ if (WebRtcGSMFR_EncoderInit(encoder_inst_ptr_, 0) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"DisableDTX: cannot init encoder for GSMFR");
return -1;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -171,29 +172,30 @@
}
}
-WebRtc_Word16 ACMGSMFR::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
- if (WebRtcGSMFR_EncoderInit(_encoderInstPtr,
- ((codecParams->enableDTX) ? 1 : 0)) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word16 ACMGSMFR::InternalInitEncoder(
+ WebRtcACMCodecParams* codec_params) {
+ if (WebRtcGSMFR_EncoderInit(encoder_inst_ptr_,
+ ((codec_params->enable_dtx) ? 1 : 0)) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitEncoder: cannot init encoder for GSMFR");
}
return 0;
}
WebRtc_Word16 ACMGSMFR::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- if (WebRtcGSMFR_DecoderInit(_decoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WebRtcACMCodecParams* /* codec_params */) {
+ if (WebRtcGSMFR_DecoderInit(decoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: cannot init decoder for GSMFR");
return -1;
}
return 0;
}
-WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodecDef: decoder is not initialized for GSMFR");
return -1;
}
@@ -201,9 +203,9 @@
// "SET_CODEC_PAR" & "SET_GSMFR_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderGSMFR, codecInst.pltype, _decoderInstPtr,
- 8000);
- SET_GSMFR_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderGSMFR, codec_inst.pltype,
+ decoder_inst_ptr_, 8000);
+ SET_GSMFR_FUNCTIONS((codec_def));
return 0;
}
@@ -212,44 +214,46 @@
}
WebRtc_Word16 ACMGSMFR::InternalCreateEncoder() {
- if (WebRtcGSMFR_CreateEnc(&_encoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InternalCreateEncoder: cannot create instance for GSMFR encoder");
+ if (WebRtcGSMFR_CreateEnc(&encoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InternalCreateEncoder: cannot create instance for GSMFR "
+ "encoder");
return -1;
}
return 0;
}
void ACMGSMFR::DestructEncoderSafe() {
- if (_encoderInstPtr != NULL) {
- WebRtcGSMFR_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcGSMFR_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
}
WebRtc_Word16 ACMGSMFR::InternalCreateDecoder() {
- if (WebRtcGSMFR_CreateDec(&_decoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InternalCreateDecoder: cannot create instance for GSMFR decoder");
+ if (WebRtcGSMFR_CreateDec(&decoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InternalCreateDecoder: cannot create instance for GSMFR "
+ "decoder");
return -1;
}
return 0;
}
void ACMGSMFR::DestructDecoderSafe() {
- if (_decoderInstPtr != NULL) {
- WebRtcGSMFR_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcGSMFR_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
}
-void ACMGSMFR::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcGSMFR_FreeEnc((GSMFR_encinst_t_*) ptrInst);
+void ACMGSMFR::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcGSMFR_FreeEnc((GSMFR_encinst_t_*) ptr_inst);
}
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_gsmfr.h b/webrtc/modules/audio_coding/main/source/acm_gsmfr.h
index 370d85e..b841711 100644
--- a/webrtc/modules/audio_coding/main/source/acm_gsmfr.h
+++ b/webrtc/modules/audio_coding/main/source/acm_gsmfr.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct GSMFR_encinst_t_;
@@ -21,27 +21,28 @@
class ACMGSMFR : public ACMGenericCodec {
public:
- ACMGSMFR(WebRtc_Word16 codecID);
+ explicit ACMGSMFR(WebRtc_Word16 codec_id);
~ACMGSMFR();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -51,14 +52,14 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX();
WebRtc_Word16 DisableDTX();
- GSMFR_encinst_t_* _encoderInstPtr;
- GSMFR_decinst_t_* _decoderInstPtr;
+ GSMFR_encinst_t_* encoder_inst_ptr_;
+ GSMFR_decinst_t_* decoder_inst_ptr_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_ilbc.cc b/webrtc/modules/audio_coding/main/source/acm_ilbc.cc
index 53f0019..963201b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_ilbc.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_ilbc.cc
@@ -7,25 +7,25 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/modules/audio_coding/main/source/acm_ilbc.h"
-#include "acm_common_defs.h"
-#include "acm_ilbc.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_ILBC
-#include "ilbc.h"
+#include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h"
#endif
namespace webrtc {
#ifndef WEBRTC_CODEC_ILBC
-ACMILBC::ACMILBC(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
+ACMILBC::ACMILBC(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
return;
}
@@ -33,31 +33,32 @@
return;
}
-WebRtc_Word16 ACMILBC::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMILBC::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMILBC::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMILBC::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -81,7 +82,7 @@
return;
}
-void ACMILBC::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMILBC::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -91,88 +92,88 @@
#else //===================== Actual Implementation =======================
-ACMILBC::ACMILBC(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
- _codecID = codecID;
+ACMILBC::ACMILBC(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
+ codec_id_ = codec_id;
return;
}
ACMILBC::~ACMILBC() {
- if (_encoderInstPtr != NULL) {
- WebRtcIlbcfix_EncoderFree(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcIlbcfix_EncoderFree(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcIlbcfix_DecoderFree(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcIlbcfix_DecoderFree(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMILBC::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- *bitStreamLenByte = WebRtcIlbcfix_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- (WebRtc_Word16*) bitStream);
- if (*bitStreamLenByte < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word16 ACMILBC::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ *bitstream_len_byte = WebRtcIlbcfix_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ (WebRtc_Word16*)bitstream);
+ if (*bitstream_len_byte < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: error in encode for ILBC");
return -1;
}
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _frameLenSmpl;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
-WebRtc_Word16 ACMILBC::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMILBC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// initialize with a correct processing block length
- if ((160 == (codecParams->codecInstant).pacsize) ||
- (320 == (codecParams->codecInstant).pacsize)) {
+ if ((160 == (codec_params->codec_inst).pacsize) ||
+ (320 == (codec_params->codec_inst).pacsize)) {
// processing block of 20ms
- return WebRtcIlbcfix_EncoderInit(_encoderInstPtr, 20);
- } else if ((240 == (codecParams->codecInstant).pacsize) ||
- (480 == (codecParams->codecInstant).pacsize)) {
+ return WebRtcIlbcfix_EncoderInit(encoder_inst_ptr_, 20);
+ } else if ((240 == (codec_params->codec_inst).pacsize) ||
+ (480 == (codec_params->codec_inst).pacsize)) {
// processing block of 30ms
- return WebRtcIlbcfix_EncoderInit(_encoderInstPtr, 30);
+ return WebRtcIlbcfix_EncoderInit(encoder_inst_ptr_, 30);
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitEncoder: invalid processing block");
return -1;
}
}
-WebRtc_Word16 ACMILBC::InternalInitDecoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMILBC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
// initialize with a correct processing block length
- if ((160 == (codecParams->codecInstant).pacsize) ||
- (320 == (codecParams->codecInstant).pacsize)) {
+ if ((160 == (codec_params->codec_inst).pacsize) ||
+ (320 == (codec_params->codec_inst).pacsize)) {
// processing block of 20ms
- return WebRtcIlbcfix_DecoderInit(_decoderInstPtr, 20);
- } else if ((240 == (codecParams->codecInstant).pacsize) ||
- (480 == (codecParams->codecInstant).pacsize)) {
+ return WebRtcIlbcfix_DecoderInit(decoder_inst_ptr_, 20);
+ } else if ((240 == (codec_params->codec_inst).pacsize) ||
+ (480 == (codec_params->codec_inst).pacsize)) {
// processing block of 30ms
- return WebRtcIlbcfix_DecoderInit(_decoderInstPtr, 30);
+ return WebRtcIlbcfix_DecoderInit(decoder_inst_ptr_, 30);
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalInitDecoder: invalid processing block");
return -1;
}
}
-WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: decoder not initialized for ILBC");
return -1;
}
@@ -180,9 +181,9 @@
// "SET_CODEC_PAR" & "SET_ILBC_FUNCTION."
// Then return the structure back to NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderILBC, codecInst.pltype, _decoderInstPtr,
+ SET_CODEC_PAR((codec_def), kDecoderILBC, codec_inst.pltype, decoder_inst_ptr_,
8000);
- SET_ILBC_FUNCTIONS((codecDef));
+ SET_ILBC_FUNCTIONS((codec_def));
return 0;
}
@@ -191,44 +192,46 @@
}
WebRtc_Word16 ACMILBC::InternalCreateEncoder() {
- if (WebRtcIlbcfix_EncoderCreate(&_encoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InternalCreateEncoder: cannot create instance for ILBC encoder");
+ if (WebRtcIlbcfix_EncoderCreate(&encoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InternalCreateEncoder: cannot create instance for ILBC "
+ "encoder");
return -1;
}
return 0;
}
void ACMILBC::DestructEncoderSafe() {
- _encoderInitialized = false;
- _encoderExist = false;
- if (_encoderInstPtr != NULL) {
- WebRtcIlbcfix_EncoderFree(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ encoder_initialized_ = false;
+ encoder_exist_ = false;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcIlbcfix_EncoderFree(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
}
WebRtc_Word16 ACMILBC::InternalCreateDecoder() {
- if (WebRtcIlbcfix_DecoderCreate(&_decoderInstPtr) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "InternalCreateDecoder: cannot create instance for ILBC decoder");
+ if (WebRtcIlbcfix_DecoderCreate(&decoder_inst_ptr_) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "InternalCreateDecoder: cannot create instance for ILBC "
+ "decoder");
return -1;
}
return 0;
}
void ACMILBC::DestructDecoderSafe() {
- _decoderInitialized = false;
- _decoderExist = false;
- if (_decoderInstPtr != NULL) {
- WebRtcIlbcfix_DecoderFree(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ decoder_initialized_ = false;
+ decoder_exist_ = false;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcIlbcfix_DecoderFree(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
}
-void ACMILBC::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcIlbcfix_EncoderFree((iLBC_encinst_t_*) ptrInst);
+void ACMILBC::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcIlbcfix_EncoderFree((iLBC_encinst_t_*) ptr_inst);
}
return;
}
@@ -236,13 +239,13 @@
WebRtc_Word16 ACMILBC::SetBitRateSafe(const WebRtc_Word32 rate) {
// Check that rate is valid. No need to store the value
if (rate == 13300) {
- WebRtcIlbcfix_EncoderInit(_encoderInstPtr, 30);
+ WebRtcIlbcfix_EncoderInit(encoder_inst_ptr_, 30);
} else if (rate == 15200) {
- WebRtcIlbcfix_EncoderInit(_encoderInstPtr, 20);
+ WebRtcIlbcfix_EncoderInit(encoder_inst_ptr_, 20);
} else {
return -1;
}
- _encoderParams.codecInstant.rate = rate;
+ encoder_params_.codec_inst.rate = rate;
return 0;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_ilbc.h b/webrtc/modules/audio_coding/main/source/acm_ilbc.h
index c7d4466..a61e34e 100644
--- a/webrtc/modules/audio_coding/main/source/acm_ilbc.h
+++ b/webrtc/modules/audio_coding/main/source/acm_ilbc.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct iLBC_encinst_t_;
@@ -21,27 +21,28 @@
class ACMILBC : public ACMGenericCodec {
public:
- ACMILBC(WebRtc_Word16 codecID);
+ explicit ACMILBC(WebRtc_Word16 codec_id);
~ACMILBC();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
@@ -53,10 +54,10 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
- iLBC_encinst_t_* _encoderInstPtr;
- iLBC_decinst_t_* _decoderInstPtr;
+ iLBC_encinst_t_* encoder_inst_ptr_;
+ iLBC_decinst_t_* decoder_inst_ptr_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_isac.cc b/webrtc/modules/audio_coding/main/source/acm_isac.cc
index 052251e..defcb8b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_isac.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_isac.cc
@@ -7,23 +7,23 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/modules/audio_coding/main/source/acm_isac.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_isac.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_ISAC
-#include "acm_isac_macros.h"
-#include "isac.h"
+#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac_macros.h"
#endif
#ifdef WEBRTC_CODEC_ISACFX
-#include "acm_isac_macros.h"
-#include "isacfix.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
+#include "webrtc/modules/audio_coding/main/source/acm_isac_macros.h"
#endif
namespace webrtc {
@@ -39,6 +39,194 @@
#define ISAC_MIN_RATE 10000
#define ISAC_MAX_RATE 56000
+// Tables for bandwidth estimates
+#define NR_ISAC_BANDWIDTHS 24
+static const WebRtc_Word32 kIsacRatesWb[NR_ISAC_BANDWIDTHS] = {
+ 10000, 11100, 12300, 13700, 15200, 16900,
+ 18800, 20900, 23300, 25900, 28700, 31900,
+ 10100, 11200, 12400, 13800, 15300, 17000,
+ 18900, 21000, 23400, 26000, 28800, 32000
+};
+
+static const WebRtc_Word32 kIsacRatesSwb[NR_ISAC_BANDWIDTHS] = {
+ 10000, 11000, 12400, 13800, 15300, 17000,
+ 18900, 21000, 23200, 25400, 27600, 29800,
+ 32000, 34100, 36300, 38500, 40700, 42900,
+ 45100, 47300, 49500, 51700, 53900, 56000,
+};
+
+#if (!defined(WEBRTC_CODEC_ISAC) && !defined(WEBRTC_CODEC_ISACFX))
+
+ACMISAC::ACMISAC(WebRtc_Word16 /* codec_id */)
+ : codec_inst_ptr_(NULL),
+ is_enc_initialized_(false),
+ isac_coding_mode_(CHANNEL_INDEPENDENT),
+ enforce_frame_size_(false),
+ isac_currentBN_(32000),
+ samples_in10MsAudio_(160) { // Initiates to 16 kHz mode.
+ // Initiate decoder parameters for the 32 kHz mode.
+ memset(&decoder_params32kHz_, 0, sizeof(WebRtcACMCodecParams));
+ decoder_params32kHz_.codec_inst.pltype = -1;
+
+ return;
+}
+
+ACMISAC::~ACMISAC() {
+ return;
+}
+
+ACMGenericCodec* ACMISAC::CreateInstance(void) {
+ return NULL;
+}
+
+WebRtc_Word16 ACMISAC::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
+ WebRtc_Word16* /* audio */,
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
+ return 0;
+}
+
+WebRtc_Word16 ACMISAC::InternalInitEncoder(
+ WebRtcACMCodecParams* /* codec_params */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::InternalInitDecoder(
+ WebRtcACMCodecParams* /* codec_params */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::InternalCreateDecoder() {
+ return -1;
+}
+
+void ACMISAC::DestructDecoderSafe() {
+ return;
+}
+
+WebRtc_Word16 ACMISAC::InternalCreateEncoder() {
+ return -1;
+}
+
+void ACMISAC::DestructEncoderSafe() {
+ return;
+}
+
+WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
+ return -1;
+}
+
+void ACMISAC::InternalDestructEncoderInst(void* /* ptr_inst */) {
+ return;
+}
+
+WebRtc_Word16 ACMISAC::DeliverCachedIsacData(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */,
+ WebRtc_UWord32* /* timestamp */,
+ WebRtcACMEncodingType* /* encoding_type */,
+ const WebRtc_UWord16 /* isac_rate */,
+ const WebRtc_UWord8 /* isac_bw_estimate */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */,
+ WebRtc_Word16 /* q_bwe */,
+ WebRtc_Word32 /* scale */,
+ bool /* is_red */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 /* bit_rate */) {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
+ WebRtc_Word32 /* estimated_bandwidth */) {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::GetRedPayloadSafe(WebRtc_UWord8* /* red_payload */,
+ WebRtc_Word16* /* payload_bytes */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(WebRtc_Word16 /* codec_id */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
+ WebRtc_UWord16 /* encoder_samp_freq_hz */) {
+ return -1;
+}
+
+WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& /* samp_freq_hz */) {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
+ const WebRtc_UWord8 /* init_frame_size_msec */,
+ const WebRtc_UWord16 /* init_rate_bit_per_sec */,
+ const bool /* enforce_frame_size */) {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::SetISACMaxPayloadSize(
+ const WebRtc_UWord16 /* max_payload_len_bytes */) {
+ return -1;
+}
+
+WebRtc_Word32 ACMISAC::SetISACMaxRate(
+ const WebRtc_UWord32 /* max_rate_bit_per_sec */) {
+ return -1;
+}
+
+void ACMISAC::UpdateFrameLen() {
+ return;
+}
+
+void ACMISAC::CurrentRate(WebRtc_Word32& /*rate_bit_per_sec */) {
+ return;
+}
+
+bool
+ACMISAC::DecoderParamsSafe(
+ WebRtcACMCodecParams* /* dec_params */,
+ const WebRtc_UWord8 /* payload_type */) {
+ return false;
+}
+
+void
+ACMISAC::SaveDecoderParamSafe(
+ const WebRtcACMCodecParams* /* codec_params */) {
+ return;
+}
+
+WebRtc_Word16 ACMISAC::REDPayloadISAC(
+ const WebRtc_Word32 /* isac_rate */,
+ const WebRtc_Word16 /* isac_bw_estimate */,
+ WebRtc_UWord8* /* payload */,
+ WebRtc_Word16* /* payload_len_bytes */) {
+ return -1;
+}
+
+#else //===================== Actual Implementation =======================
+
+#ifdef WEBRTC_CODEC_ISACFX
+
// How the scaling is computed. iSAC computes a gain based on the
// bottleneck. It follows the following expression for that
//
@@ -54,209 +242,29 @@
// S(BN_kbps) = G(BN_kbps) / G(32);
#define ISAC_NUM_SUPPORTED_RATES 9
-const WebRtc_UWord16 isacSuportedRates[ISAC_NUM_SUPPORTED_RATES] = {
+
+static const WebRtc_UWord16 kIsacSuportedRates[ISAC_NUM_SUPPORTED_RATES] = {
32000, 30000, 26000, 23000, 21000,
19000, 17000, 15000, 12000
};
-const float isacScale[ISAC_NUM_SUPPORTED_RATES] = {
- 1.0f, 0.8954f, 0.7178f, 0.6081f, 0.5445f,
- 0.4875f, 0.4365f, 0.3908f, 0.3311f
+static const float kIsacScale[ISAC_NUM_SUPPORTED_RATES] = {
+ 1.0f, 0.8954f, 0.7178f, 0.6081f, 0.5445f,
+ 0.4875f, 0.4365f, 0.3908f, 0.3311f
};
-// Tables for bandwidth estimates
-#define NR_ISAC_BANDWIDTHS 24
-const WebRtc_Word32 isacRatesWB[NR_ISAC_BANDWIDTHS] = {
- 10000, 11100, 12300, 13700, 15200, 16900,
- 18800, 20900, 23300, 25900, 28700, 31900,
- 10100, 11200, 12400, 13800, 15300, 17000,
- 18900, 21000, 23400, 26000, 28800, 32000
+enum IsacSamplingRate {
+ kIsacWideband = 16,
+ kIsacSuperWideband = 32
};
-const WebRtc_Word32 isacRatesSWB[NR_ISAC_BANDWIDTHS] = {
- 10000, 11000, 12400, 13800, 15300, 17000,
- 18900, 21000, 23200, 25400, 27600, 29800,
- 32000, 34100, 36300, 38500, 40700, 42900,
- 45100, 47300, 49500, 51700, 53900, 56000,
-};
-
-#if (!defined(WEBRTC_CODEC_ISAC) && !defined(WEBRTC_CODEC_ISACFX))
-
-ACMISAC::ACMISAC(WebRtc_Word16 /* codecID */)
- : _codecInstPtr(NULL),
- _isEncInitialized(false),
- _isacCodingMode(CHANNEL_INDEPENDENT),
- _enforceFrameSize(false),
- _isacCurrentBN(32000),
- _samplesIn10MsAudio(160) { // Initiates to 16 kHz mode.
- // Initiate decoder parameters for the 32 kHz mode.
- memset(&_decoderParams32kHz, 0, sizeof(WebRtcACMCodecParams));
- _decoderParams32kHz.codecInstant.pltype = -1;
-
- return;
-}
-
-ACMISAC::~ACMISAC() {
- return;
-}
-
-ACMGenericCodec* ACMISAC::CreateInstance(void) {
- return NULL;
-}
-
-WebRtc_Word16 ACMISAC::InternalEncode(WebRtc_UWord8* /* bitstream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
- WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
- return 0;
-}
-
-WebRtc_Word16 ACMISAC::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::InternalCreateDecoder() {
- return -1;
-}
-
-void ACMISAC::DestructDecoderSafe() {
- return;
-}
-
-WebRtc_Word16 ACMISAC::InternalCreateEncoder() {
- return -1;
-}
-
-void ACMISAC::DestructEncoderSafe() {
- return;
-}
-
-WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
- return -1;
-}
-
-void ACMISAC::InternalDestructEncoderInst(void* /* ptrInst */) {
- return;
-}
-
-WebRtc_Word16 ACMISAC::DeliverCachedIsacData(
- WebRtc_UWord8* /* bitStream */, WebRtc_Word16* /* bitStreamLenByte */,
- WebRtc_UWord32* /* timestamp */, WebRtcACMEncodingType* /* encodingType */,
- const WebRtc_UWord16 /* isacRate */,
- const WebRtc_UWord8 /* isacBWestimate */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */,
- WebRtc_Word16 /* qBWE */,
- WebRtc_Word32 /* scale */,
- bool /* isRED */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 /* bitRate */) {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
- WebRtc_Word32 /* estimatedBandwidth */) {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::GetRedPayloadSafe(WebRtc_UWord8* /* redPayload */,
- WebRtc_Word16* /* payloadBytes */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(WebRtc_Word16 /* codecId */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
- WebRtc_UWord16 /* encoderSampFreqHz */) {
- return -1;
-}
-
-WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& /* sampFreqHz */) {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
- const WebRtc_UWord8 /* initFrameSizeMsec */,
- const WebRtc_UWord16 /* initRateBitPerSec */,
- const bool /* enforceFrameSize */) {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::SetISACMaxPayloadSize(
- const WebRtc_UWord16 /* maxPayloadLenBytes */) {
- return -1;
-}
-
-WebRtc_Word32 ACMISAC::SetISACMaxRate(
- const WebRtc_UWord32 /* maxRateBitPerSec */) {
- return -1;
-}
-
-void ACMISAC::UpdateFrameLen() {
- return;
-}
-
-void ACMISAC::CurrentRate(WebRtc_Word32& /*rateBitPerSec */) {
- return;
-}
-
-bool
-ACMISAC::DecoderParamsSafe(
- WebRtcACMCodecParams* /* decParams */,
- const WebRtc_UWord8 /* payloadType */)
-{
- return false;
-}
-
-void
-ACMISAC::SaveDecoderParamSafe(
- const WebRtcACMCodecParams* /* codecParams */)
-{
- return;
-}
-
-WebRtc_Word16 ACMISAC::REDPayloadISAC(const WebRtc_Word32 /* isacRate */,
- const WebRtc_Word16 /* isacBwEstimate */,
- WebRtc_UWord8* /* payload */,
- WebRtc_Word16* /* payloadLenBytes */) {
- return -1;
-}
-
-#else //===================== Actual Implementation =======================
-
-#ifdef WEBRTC_CODEC_ISACFX
-
static float ACMISACFixTranscodingScale(WebRtc_UWord16 rate) {
// find the scale for transcoding, the scale is rounded
// downward
float scale = -1;
for (WebRtc_Word16 n = 0; n < ISAC_NUM_SUPPORTED_RATES; n++) {
- if (rate >= isacSuportedRates[n]) {
- scale = isacScale[n];
+ if (rate >= kIsacSuportedRates[n]) {
+ scale = kIsacScale[n];
break;
}
}
@@ -264,50 +272,50 @@
}
static void ACMISACFixGetSendBitrate(ACM_ISAC_STRUCT* inst,
- WebRtc_Word32* bottleNeck) {
- *bottleNeck = WebRtcIsacfix_GetUplinkBw(inst);
+ WebRtc_Word32* bottleneck) {
+ *bottleneck = WebRtcIsacfix_GetUplinkBw(inst);
}
static WebRtc_Word16 ACMISACFixGetNewBitstream(ACM_ISAC_STRUCT* inst,
- WebRtc_Word16 BWEIndex,
- WebRtc_Word16 /* jitterIndex */,
+ WebRtc_Word16 bwe_index,
+ WebRtc_Word16 /* jitter_index */,
WebRtc_Word32 rate,
- WebRtc_Word16* bitStream,
- bool isRED) {
- if (isRED) {
+ WebRtc_Word16* bitstream,
+ bool is_red) {
+ if (is_red) {
// RED not supported with iSACFIX
return -1;
}
float scale = ACMISACFixTranscodingScale((WebRtc_UWord16) rate);
- return WebRtcIsacfix_GetNewBitStream(inst, BWEIndex, scale, bitStream);
+ return WebRtcIsacfix_GetNewBitStream(inst, bwe_index, scale, bitstream);
}
static WebRtc_Word16 ACMISACFixGetSendBWE(ACM_ISAC_STRUCT* inst,
- WebRtc_Word16* rateIndex,
+ WebRtc_Word16* rate_index,
WebRtc_Word16* /* dummy */) {
- WebRtc_Word16 localRateIndex;
+ WebRtc_Word16 local_rate_index;
WebRtc_Word16 status = WebRtcIsacfix_GetDownLinkBwIndex(inst,
- &localRateIndex);
+ &local_rate_index);
if (status < 0) {
return -1;
} else {
- *rateIndex = localRateIndex;
+ *rate_index = local_rate_index;
return 0;
}
}
static WebRtc_Word16 ACMISACFixControlBWE(ACM_ISAC_STRUCT* inst,
- WebRtc_Word32 rateBPS,
- WebRtc_Word16 frameSizeMs,
- WebRtc_Word16 enforceFrameSize) {
- return WebRtcIsacfix_ControlBwe(inst, (WebRtc_Word16) rateBPS, frameSizeMs,
- enforceFrameSize);
+ WebRtc_Word32 rate_bps,
+ WebRtc_Word16 frame_size_ms,
+ WebRtc_Word16 enforce_frame_size) {
+ return WebRtcIsacfix_ControlBwe(inst, (WebRtc_Word16) rate_bps, frame_size_ms,
+ enforce_frame_size);
}
static WebRtc_Word16 ACMISACFixControl(ACM_ISAC_STRUCT* inst,
- WebRtc_Word32 rateBPS,
- WebRtc_Word16 frameSizeMs) {
- return WebRtcIsacfix_Control(inst, (WebRtc_Word16) rateBPS, frameSizeMs);
+ WebRtc_Word32 rate_bps,
+ WebRtc_Word16 frame_size_ms) {
+ return WebRtcIsacfix_Control(inst, (WebRtc_Word16) rate_bps, frame_size_ms);
}
// The following two function should have the same signature as their counter
@@ -323,39 +331,39 @@
#endif
-ACMISAC::ACMISAC(WebRtc_Word16 codecID)
- : _isEncInitialized(false),
- _isacCodingMode(CHANNEL_INDEPENDENT),
- _enforceFrameSize(false),
- _isacCurrentBN(32000),
- _samplesIn10MsAudio(160) { // Initiates to 16 kHz mode.
- _codecID = codecID;
+ACMISAC::ACMISAC(WebRtc_Word16 codec_id)
+ : is_enc_initialized_(false),
+ isac_coding_mode_(CHANNEL_INDEPENDENT),
+ enforce_frame_size_(false),
+ isac_current_bn_(32000),
+ samples_in_10ms_audio_(160) { // Initiates to 16 kHz mode.
+ codec_id_ = codec_id;
// Create codec instance.
- _codecInstPtr = new ACMISACInst;
- if (_codecInstPtr == NULL) {
+ codec_inst_ptr_ = new ACMISACInst;
+ if (codec_inst_ptr_ == NULL) {
return;
}
- _codecInstPtr->inst = NULL;
+ codec_inst_ptr_->inst = NULL;
// Initiate decoder parameters for the 32 kHz mode.
- memset(&_decoderParams32kHz, 0, sizeof(WebRtcACMCodecParams));
- _decoderParams32kHz.codecInstant.pltype = -1;
+ memset(&decoder_params_32khz_, 0, sizeof(WebRtcACMCodecParams));
+ decoder_params_32khz_.codec_inst.pltype = -1;
// TODO(tlegrand): Check if the following is really needed, now that
// ACMGenericCodec has been updated to initialize this value.
// Initialize values that can be used uninitialized otherwise
- _decoderParams.codecInstant.pltype = -1;
+ decoder_params_.codec_inst.pltype = -1;
}
ACMISAC::~ACMISAC() {
- if (_codecInstPtr != NULL) {
- if (_codecInstPtr->inst != NULL) {
- ACM_ISAC_FREE(_codecInstPtr->inst);
- _codecInstPtr->inst = NULL;
+ if (codec_inst_ptr_ != NULL) {
+ if (codec_inst_ptr_->inst != NULL) {
+ ACM_ISAC_FREE(codec_inst_ptr_->inst);
+ codec_inst_ptr_->inst = NULL;
}
- delete _codecInstPtr;
- _codecInstPtr = NULL;
+ delete codec_inst_ptr_;
+ codec_inst_ptr_ = NULL;
}
return;
}
@@ -365,7 +373,7 @@
}
WebRtc_Word16 ACMISAC::InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte) {
+ WebRtc_Word16* bitstream_len_byte) {
// ISAC takes 10ms audio everytime we call encoder, therefor,
// it should be treated like codecs with 'basic coding block'
// non-zero, and the following 'while-loop' should not be necessary.
@@ -373,98 +381,98 @@
// at the first 10ms pushed in to iSAC if the bit-rate is low, this is
// sort of a bug in iSAC. to address this we treat iSAC as the
// following.
- if (_codecInstPtr == NULL) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- *bitStreamLenByte = 0;
- while ((*bitStreamLenByte == 0) && (_inAudioIxRead < _frameLenSmpl)) {
- if (_inAudioIxRead > _inAudioIxWrite) {
+ *bitstream_len_byte = 0;
+ while ((*bitstream_len_byte == 0) && (in_audio_ix_read_ < frame_len_smpl_)) {
+ if (in_audio_ix_read_ > in_audio_ix_write_) {
// something is wrong.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
- "The actual fram-size of iSAC appears to be larger that expected. "
- "All audio pushed in but no bit-stream is generated.");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
+ "The actual fram-size of iSAC appears to be larger that "
+ "expected. All audio pushed in but no bit-stream is "
+ "generated.");
return -1;
}
- *bitStreamLenByte = ACM_ISAC_ENCODE(_codecInstPtr->inst,
- &_inAudio[_inAudioIxRead],
- (WebRtc_Word16*) bitstream);
+ *bitstream_len_byte = ACM_ISAC_ENCODE(codec_inst_ptr_->inst,
+ &in_audio_[in_audio_ix_read_],
+ (WebRtc_Word16*)bitstream);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _samplesIn10MsAudio;
+ in_audio_ix_read_ += samples_in_10ms_audio_;
}
- if (*bitStreamLenByte == 0) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _uniqueID,
- "ISAC Has encoded the whole frame but no bit-stream is generated.");
+ if (*bitstream_len_byte == 0) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, unique_id_,
+ "ISAC Has encoded the whole frame but no bit-stream is "
+ "generated.");
}
// a packet is generated iSAC, is set in adaptive mode may change
// the frame length and we like to update the bottleneck value as
// well, although updating bottleneck is not crucial
- if ((*bitStreamLenByte > 0) && (_isacCodingMode == ADAPTIVE)) {
- //_frameLenSmpl = ACM_ISAC_GETNEWFRAMELEN(_codecInstPtr->inst);
- ACM_ISAC_GETSENDBITRATE(_codecInstPtr->inst, &_isacCurrentBN);
+ if ((*bitstream_len_byte > 0) && (isac_coding_mode_ == ADAPTIVE)) {
+ ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &isac_current_bn_);
}
UpdateFrameLen();
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSample */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_sample */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
-WebRtc_Word16 ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// if rate is set to -1 then iSAC has to be in adaptive mode
- if (codecParams->codecInstant.rate == -1) {
- _isacCodingMode = ADAPTIVE;
- }
-
- // sanity check that rate is in acceptable range
- else if ((codecParams->codecInstant.rate >= ISAC_MIN_RATE) &&
- (codecParams->codecInstant.rate <= ISAC_MAX_RATE)) {
- _isacCodingMode = CHANNEL_INDEPENDENT;
- _isacCurrentBN = codecParams->codecInstant.rate;
+ if (codec_params->codec_inst.rate == -1) {
+ isac_coding_mode_ = ADAPTIVE;
+ } else if ((codec_params->codec_inst.rate >= ISAC_MIN_RATE) &&
+ (codec_params->codec_inst.rate <= ISAC_MAX_RATE)) {
+ // sanity check that rate is in acceptable range
+ isac_coding_mode_ = CHANNEL_INDEPENDENT;
+ isac_current_bn_ = codec_params->codec_inst.rate;
} else {
return -1;
}
// we need to set the encoder sampling frequency.
- if (UpdateEncoderSampFreq((WebRtc_UWord16) codecParams->codecInstant.plfreq)
+ if (UpdateEncoderSampFreq((WebRtc_UWord16) codec_params->codec_inst.plfreq)
< 0) {
return -1;
}
- if (ACM_ISAC_ENCODERINIT(_codecInstPtr->inst, _isacCodingMode) < 0) {
+ if (ACM_ISAC_ENCODERINIT(codec_inst_ptr_->inst, isac_coding_mode_) < 0) {
return -1;
}
// apply the frame-size and rate if operating in
// channel-independent mode
- if (_isacCodingMode == CHANNEL_INDEPENDENT) {
- if (ACM_ISAC_CONTROL(_codecInstPtr->inst, codecParams->codecInstant.rate,
- codecParams->codecInstant.pacsize /
- (codecParams->codecInstant.plfreq / 1000)) < 0) {
+ if (isac_coding_mode_ == CHANNEL_INDEPENDENT) {
+ if (ACM_ISAC_CONTROL(codec_inst_ptr_->inst,
+ codec_params->codec_inst.rate,
+ codec_params->codec_inst.pacsize /
+ (codec_params->codec_inst.plfreq / 1000)) < 0) {
return -1;
}
} else {
// We need this for adaptive case and has to be called
// after initialization
- ACM_ISAC_GETSENDBITRATE(_codecInstPtr->inst, &_isacCurrentBN);
+ ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &isac_current_bn_);
}
- _frameLenSmpl = ACM_ISAC_GETNEWFRAMELEN(_codecInstPtr->inst);
+ frame_len_smpl_ = ACM_ISAC_GETNEWFRAMELEN(codec_inst_ptr_->inst);
return 0;
}
-WebRtc_Word16 ACMISAC::InternalInitDecoder(WebRtcACMCodecParams* codecParams) {
- if (_codecInstPtr == NULL) {
+WebRtc_Word16 ACMISAC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
// set decoder sampling frequency.
- if (codecParams->codecInstant.plfreq == 32000 ||
- codecParams->codecInstant.plfreq == 48000) {
+ if (codec_params->codec_inst.plfreq == 32000 ||
+ codec_params->codec_inst.plfreq == 48000) {
UpdateDecoderSampFreq(ACMCodecDB::kISACSWB);
} else {
UpdateDecoderSampFreq(ACMCodecDB::kISAC);
@@ -474,165 +482,165 @@
// However we like that the BWE to work properly so it has to
// be initialized. The BWE is initialized when iSAC encoder is initialized.
// Therefore, we need this.
- if (!_encoderInitialized) {
+ if (!encoder_initialized_) {
// 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 = kIsacWbDefaultRate;
- codecParams->codecInstant.pacsize = kIsacPacSize960;
- if (InternalInitEncoder(codecParams) < 0) {
+ codec_params->codec_inst.rate = kIsacWbDefaultRate;
+ codec_params->codec_inst.pacsize = kIsacPacSize960;
+ if (InternalInitEncoder(codec_params) < 0) {
return -1;
}
- _encoderInitialized = true;
+ encoder_initialized_ = true;
}
- return ACM_ISAC_DECODERINIT(_codecInstPtr->inst);
+ return ACM_ISAC_DECODERINIT(codec_inst_ptr_->inst);
}
WebRtc_Word16 ACMISAC::InternalCreateDecoder() {
- if (_codecInstPtr == NULL) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- WebRtc_Word16 status = ACM_ISAC_CREATE(&(_codecInstPtr->inst));
+ WebRtc_Word16 status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
// specific to codecs with one instance for encoding and decoding
- _encoderInitialized = false;
+ encoder_initialized_ = false;
if (status < 0) {
- _encoderExist = false;
+ encoder_exist_ = false;
} else {
- _encoderExist = true;
+ encoder_exist_ = true;
}
return status;
}
void ACMISAC::DestructDecoderSafe() {
// codec with shared instance cannot delete.
- _decoderInitialized = false;
+ decoder_initialized_ = false;
return;
}
WebRtc_Word16 ACMISAC::InternalCreateEncoder() {
- if (_codecInstPtr == NULL) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- WebRtc_Word16 status = ACM_ISAC_CREATE(&(_codecInstPtr->inst));
+ WebRtc_Word16 status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
// specific to codecs with one instance for encoding and decoding
- _decoderInitialized = false;
+ decoder_initialized_ = false;
if (status < 0) {
- _decoderExist = false;
+ decoder_exist_ = false;
} else {
- _decoderExist = true;
+ decoder_exist_ = true;
}
return status;
}
void ACMISAC::DestructEncoderSafe() {
// codec with shared instance cannot delete.
- _encoderInitialized = false;
+ encoder_initialized_ = false;
return;
}
-WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
+WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
// Sanity checks
- if (_codecInstPtr == NULL) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- if (!_decoderInitialized || !_decoderExist) {
+ if (!decoder_initialized_ || !decoder_exist_) {
return -1;
}
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_ISAC_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- if (codecInst.plfreq == 16000) {
- SET_CODEC_PAR((codecDef), kDecoderISAC, codecInst.pltype,
- _codecInstPtr->inst, 16000);
+ if (codec_inst.plfreq == 16000) {
+ SET_CODEC_PAR((codec_def), kDecoderISAC, codec_inst.pltype,
+ codec_inst_ptr_->inst, 16000);
#ifdef WEBRTC_CODEC_ISAC
- SET_ISAC_FUNCTIONS((codecDef));
+ SET_ISAC_FUNCTIONS((codec_def));
#else
- SET_ISACfix_FUNCTIONS((codecDef));
+ SET_ISACfix_FUNCTIONS((codec_def));
#endif
} else {
#ifdef WEBRTC_CODEC_ISAC
// Decoder is either @ 16 kHz or 32 kHz. Even if encoder is set @ 48 kHz
// decoding is @ 32 kHz.
- if (codecInst.plfreq == 32000) {
- SET_CODEC_PAR((codecDef), kDecoderISACswb, codecInst.pltype,
- _codecInstPtr->inst, 32000);
- SET_ISACSWB_FUNCTIONS((codecDef));
+ if (codec_inst.plfreq == 32000) {
+ SET_CODEC_PAR((codec_def), kDecoderISACswb, codec_inst.pltype,
+ codec_inst_ptr_->inst, 32000);
+ SET_ISACSWB_FUNCTIONS((codec_def));
} else {
- SET_CODEC_PAR((codecDef), kDecoderISACfb, codecInst.pltype,
- _codecInstPtr->inst, 32000);
- SET_ISACFB_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderISACfb, codec_inst.pltype,
+ codec_inst_ptr_->inst, 32000);
+ SET_ISACFB_FUNCTIONS((codec_def));
}
#else
- return -1;
+ return -1;
#endif
}
return 0;
}
-void ACMISAC::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- ACM_ISAC_FREE((ACM_ISAC_STRUCT *) ptrInst);
+void ACMISAC::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ ACM_ISAC_FREE((ACM_ISAC_STRUCT *) ptr_inst);
}
return;
}
-WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte,
- WebRtc_Word16 qBWE, WebRtc_Word32 rate,
- bool isRED) {
- WebRtc_Word16 jitterInfo = 0;
+WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte,
+ WebRtc_Word16 q_bwe,
+ WebRtc_Word32 rate,
+ bool is_red) {
+ WebRtc_Word16 jitter_info = 0;
// transcode from a higher rate to lower rate sanity check
- if (_codecInstPtr == NULL) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- *bitStreamLenByte = ACM_ISAC_GETNEWBITSTREAM(_codecInstPtr->inst, qBWE,
- jitterInfo, rate,
- (WebRtc_Word16*) bitStream,
- (isRED) ? 1 : 0);
+ *bitstream_len_byte = ACM_ISAC_GETNEWBITSTREAM(codec_inst_ptr_->inst, q_bwe,
+ jitter_info, rate,
+ (WebRtc_Word16*)bitstream,
+ (is_red) ? 1 : 0);
- if (*bitStreamLenByte < 0) {
+ if (*bitstream_len_byte < 0) {
// error happened
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
} else {
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
}
-WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 bitRate) {
- if (_codecInstPtr == NULL) {
+WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 bit_rate) {
+ if (codec_inst_ptr_ == NULL) {
return -1;
}
- WebRtc_UWord16 encoderSampFreq;
- EncoderSampFreq(encoderSampFreq);
+ WebRtc_UWord16 encoder_samp_freq;
+ EncoderSampFreq(encoder_samp_freq);
bool reinit = false;
// change the BN of iSAC
- if (bitRate == -1) {
+ if (bit_rate == -1) {
// ADAPTIVE MODE
// Check if it was already in adaptive mode
- if (_isacCodingMode != ADAPTIVE) {
+ if (isac_coding_mode_ != ADAPTIVE) {
// was not in adaptive, then set the mode to adaptive
// and flag for re-initialization
- _isacCodingMode = ADAPTIVE;
+ isac_coding_mode_ = ADAPTIVE;
reinit = true;
}
- }
- // Sanity check if the rate valid
- else if ((bitRate >= ISAC_MIN_RATE) && (bitRate <= ISAC_MAX_RATE)) {
- //check if it was in channel-independent mode before
- if (_isacCodingMode != CHANNEL_INDEPENDENT) {
+ } else if ((bit_rate >= ISAC_MIN_RATE) && (bit_rate <= ISAC_MAX_RATE)) {
+ // Sanity check if the rate valid
+ // check if it was in channel-independent mode before
+ if (isac_coding_mode_ != CHANNEL_INDEPENDENT) {
// was not in channel independent, set the mode to
// channel-independent and flag for re-initialization
- _isacCodingMode = CHANNEL_INDEPENDENT;
+ isac_coding_mode_ = CHANNEL_INDEPENDENT;
reinit = true;
}
// store the bottleneck
- _isacCurrentBN = (WebRtc_UWord16) bitRate;
+ isac_current_bn_ = (WebRtc_UWord16) bit_rate;
} else {
// invlaid rate
return -1;
@@ -641,243 +649,248 @@
WebRtc_Word16 status = 0;
if (reinit) {
// initialize and check if it is successful
- if (ACM_ISAC_ENCODERINIT(_codecInstPtr->inst, _isacCodingMode) < 0) {
+ if (ACM_ISAC_ENCODERINIT(codec_inst_ptr_->inst, isac_coding_mode_) < 0) {
// failed initialization
return -1;
}
}
- if (_isacCodingMode == CHANNEL_INDEPENDENT) {
-
+ if (isac_coding_mode_ == CHANNEL_INDEPENDENT) {
status = ACM_ISAC_CONTROL(
- _codecInstPtr->inst, _isacCurrentBN,
- (encoderSampFreq == 32000 || encoderSampFreq == 48000) ? 30 :
- (_frameLenSmpl / 16));
+ codec_inst_ptr_->inst, isac_current_bn_,
+ (encoder_samp_freq == 32000 || encoder_samp_freq == 48000) ? 30 :
+ (frame_len_smpl_ / 16));
if (status < 0) {
status = -1;
}
}
// Update encoder parameters
- _encoderParams.codecInstant.rate = bitRate;
+ encoder_params_.codec_inst.rate = bit_rate;
UpdateFrameLen();
return status;
}
WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
- WebRtc_Word16 bandwidthIndex = 0;
- WebRtc_Word16 delayIndex = 0;
- int sampRate;
+ WebRtc_Word16 bandwidth_index = 0;
+ WebRtc_Word16 delay_index = 0;
+ int samp_rate;
// Get bandwidth information
- ACM_ISAC_GETSENDBWE(_codecInstPtr->inst, &bandwidthIndex, &delayIndex);
+ ACM_ISAC_GETSENDBWE(codec_inst_ptr_->inst, &bandwidth_index, &delay_index);
// Validy check of index
- if ((bandwidthIndex < 0) || (bandwidthIndex >= NR_ISAC_BANDWIDTHS)) {
+ if ((bandwidth_index < 0) || (bandwidth_index >= NR_ISAC_BANDWIDTHS)) {
return -1;
}
// Check sample frequency
- sampRate = ACM_ISAC_GETDECSAMPRATE(_codecInstPtr->inst);
- if (sampRate == 16000) {
- return isacRatesWB[bandwidthIndex];
+ samp_rate = ACM_ISAC_GETDECSAMPRATE(codec_inst_ptr_->inst);
+ if (samp_rate == 16000) {
+ return kIsacRatesWb[bandwidth_index];
} else {
- return isacRatesSWB[bandwidthIndex];
+ return kIsacRatesSwb[bandwidth_index];
}
}
WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
- WebRtc_Word32 estimatedBandwidth) {
- int sampRate;
- WebRtc_Word16 bandwidthIndex;
+ WebRtc_Word32 estimated_bandwidth) {
+ int samp_rate;
+ WebRtc_Word16 bandwidth_index;
// Check sample frequency and choose appropriate table
- sampRate = ACM_ISAC_GETENCSAMPRATE(_codecInstPtr->inst);
+ samp_rate = ACM_ISAC_GETENCSAMPRATE(codec_inst_ptr_->inst);
- if (sampRate == 16000) {
+ if (samp_rate == 16000) {
// Search through the WB rate table to find the index
- bandwidthIndex = NR_ISAC_BANDWIDTHS / 2 - 1;
+ bandwidth_index = NR_ISAC_BANDWIDTHS / 2 - 1;
for (int i = 0; i < (NR_ISAC_BANDWIDTHS / 2); i++) {
- if (estimatedBandwidth == isacRatesWB[i]) {
- bandwidthIndex = i;
+ if (estimated_bandwidth == kIsacRatesWb[i]) {
+ bandwidth_index = i;
break;
- } else if (estimatedBandwidth
- == isacRatesWB[i + NR_ISAC_BANDWIDTHS / 2]) {
- bandwidthIndex = i + NR_ISAC_BANDWIDTHS / 2;
+ } else if (estimated_bandwidth
+ == kIsacRatesWb[i + NR_ISAC_BANDWIDTHS / 2]) {
+ bandwidth_index = i + NR_ISAC_BANDWIDTHS / 2;
break;
- } else if (estimatedBandwidth < isacRatesWB[i]) {
- bandwidthIndex = i;
+ } else if (estimated_bandwidth < kIsacRatesWb[i]) {
+ bandwidth_index = i;
break;
}
}
} else {
// Search through the SWB rate table to find the index
- bandwidthIndex = NR_ISAC_BANDWIDTHS - 1;
+ bandwidth_index = NR_ISAC_BANDWIDTHS - 1;
for (int i = 0; i < NR_ISAC_BANDWIDTHS; i++) {
- if (estimatedBandwidth <= isacRatesSWB[i]) {
- bandwidthIndex = i;
+ if (estimated_bandwidth <= kIsacRatesSwb[i]) {
+ bandwidth_index = i;
break;
}
}
}
// Set iSAC Bandwidth Estimate
- ACM_ISAC_SETBWE(_codecInstPtr->inst, bandwidthIndex);
+ ACM_ISAC_SETBWE(codec_inst_ptr_->inst, bandwidth_index);
return 0;
}
WebRtc_Word32 ACMISAC::GetRedPayloadSafe(
#if (!defined(WEBRTC_CODEC_ISAC))
- WebRtc_UWord8* /* redPayload */, WebRtc_Word16* /* payloadBytes */) {
+ WebRtc_UWord8* /* red_payload */, WebRtc_Word16* /* payload_bytes */) {
return -1;
#else
- WebRtc_UWord8* redPayload, WebRtc_Word16* payloadBytes) {
- WebRtc_Word16 bytes = WebRtcIsac_GetRedPayload(_codecInstPtr->inst,
- (WebRtc_Word16*)redPayload);
+ WebRtc_UWord8* red_payload, WebRtc_Word16* payload_bytes) {
+ WebRtc_Word16 bytes = WebRtcIsac_GetRedPayload(codec_inst_ptr_->inst,
+ (WebRtc_Word16*)red_payload);
if (bytes < 0) {
return -1;
}
- *payloadBytes = bytes;
+ *payload_bytes = bytes;
return 0;
#endif
}
WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(
#ifdef WEBRTC_CODEC_ISAC
- WebRtc_Word16 codecId) {
- // The decoder supports only wideband and super-wideband.
- if (ACMCodecDB::kISAC == codecId) {
- return WebRtcIsac_SetDecSampRate(_codecInstPtr->inst, 16000);
- } else if (ACMCodecDB::kISACSWB == codecId ||
- ACMCodecDB::kISACFB == codecId) {
- return WebRtcIsac_SetDecSampRate(_codecInstPtr->inst, 32000);
+ WebRtc_Word16 codec_id) {
+ // The decoder supports only wideband and super-wideband.
+ if (ACMCodecDB::kISAC == codec_id) {
+ return WebRtcIsac_SetDecSampRate(codec_inst_ptr_->inst, 16000);
+ } else if (ACMCodecDB::kISACSWB == codec_id ||
+ ACMCodecDB::kISACFB == codec_id) {
+ return WebRtcIsac_SetDecSampRate(codec_inst_ptr_->inst, 32000);
} else {
return -1;
}
#else
- WebRtc_Word16 /* codecId */) {
+ WebRtc_Word16 /* codec_id */) {
return 0;
#endif
}
WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
#ifdef WEBRTC_CODEC_ISAC
- WebRtc_UWord16 encoderSampFreqHz) {
- WebRtc_UWord16 currentSampRateHz;
- EncoderSampFreq(currentSampRateHz);
+ WebRtc_UWord16 encoder_samp_freq_hz) {
+ WebRtc_UWord16 current_samp_rate_hz;
+ EncoderSampFreq(current_samp_rate_hz);
- if (currentSampRateHz != encoderSampFreqHz) {
- if ((encoderSampFreqHz != 16000) && (encoderSampFreqHz != 32000) &&
- (encoderSampFreqHz != 48000)) {
+ if (current_samp_rate_hz != encoder_samp_freq_hz) {
+ if ((encoder_samp_freq_hz != 16000) &&
+ (encoder_samp_freq_hz != 32000) &&
+ (encoder_samp_freq_hz != 48000)) {
return -1;
} else {
- _inAudioIxRead = 0;
- _inAudioIxWrite = 0;
- _inTimestampIxWrite = 0;
- if (WebRtcIsac_SetEncSampRate(_codecInstPtr->inst,
- encoderSampFreqHz) < 0) {
+ in_audio_ix_read_ = 0;
+ in_audio_ix_write_ = 0;
+ in_timestamp_ix_write_ = 0;
+ if (WebRtcIsac_SetEncSampRate(codec_inst_ptr_->inst,
+ encoder_samp_freq_hz) < 0) {
return -1;
}
- _samplesIn10MsAudio = encoderSampFreqHz / 100;
- _frameLenSmpl = ACM_ISAC_GETNEWFRAMELEN(_codecInstPtr->inst);
- _encoderParams.codecInstant.pacsize = _frameLenSmpl;
- _encoderParams.codecInstant.plfreq = encoderSampFreqHz;
+ samples_in_10ms_audio_ = encoder_samp_freq_hz / 100;
+ frame_len_smpl_ = ACM_ISAC_GETNEWFRAMELEN(codec_inst_ptr_->inst);
+ encoder_params_.codec_inst.pacsize = frame_len_smpl_;
+ encoder_params_.codec_inst.plfreq = encoder_samp_freq_hz;
return 0;
}
}
#else
- WebRtc_UWord16 /* codecId */) {
+ WebRtc_UWord16 /* codec_id */) {
#endif
return 0;
}
-WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& sampFreqHz) {
- sampFreqHz = ACM_ISAC_GETENCSAMPRATE(_codecInstPtr->inst);
+WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& samp_freq_hz) {
+ samp_freq_hz = ACM_ISAC_GETENCSAMPRATE(codec_inst_ptr_->inst);
return 0;
}
WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
- const WebRtc_UWord8 initFrameSizeMsec,
- const WebRtc_UWord16 initRateBitPerSec, const bool enforceFrameSize) {
+ const WebRtc_UWord8 init_frame_size_msec,
+ const WebRtc_UWord16 init_rate_bit_per_sec,
+ const bool enforce_frame_size) {
WebRtc_Word16 status;
{
- WebRtc_UWord16 sampFreqHz;
- EncoderSampFreq(sampFreqHz);
+ WebRtc_UWord16 samp_freq_hz;
+ EncoderSampFreq(samp_freq_hz);
// TODO(turajs): at 32kHz we hardcode calling with 30ms and enforce
// the frame-size otherwise we might get error. Revise if
// control-bwe is changed.
- if (sampFreqHz == 32000 || sampFreqHz == 48000) {
- status = ACM_ISAC_CONTROL_BWE(_codecInstPtr->inst, initRateBitPerSec, 30,
- 1);
+ if (samp_freq_hz == 32000 || samp_freq_hz == 48000) {
+ status = ACM_ISAC_CONTROL_BWE(codec_inst_ptr_->inst,
+ init_rate_bit_per_sec, 30, 1);
} else {
- status = ACM_ISAC_CONTROL_BWE(_codecInstPtr->inst, initRateBitPerSec,
- initFrameSizeMsec,
- enforceFrameSize ? 1 : 0);
+ status = ACM_ISAC_CONTROL_BWE(codec_inst_ptr_->inst,
+ init_rate_bit_per_sec,
+ init_frame_size_msec,
+ enforce_frame_size ? 1 : 0);
}
}
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Couldn't config iSAC BWE.");
return -1;
}
UpdateFrameLen();
- ACM_ISAC_GETSENDBITRATE(_codecInstPtr->inst, &_isacCurrentBN);
+ ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &isac_current_bn_);
return 0;
}
WebRtc_Word32 ACMISAC::SetISACMaxPayloadSize(
- const WebRtc_UWord16 maxPayloadLenBytes) {
- return ACM_ISAC_SETMAXPAYLOADSIZE(_codecInstPtr->inst, maxPayloadLenBytes);
+ const WebRtc_UWord16 max_payload_len_bytes) {
+ return ACM_ISAC_SETMAXPAYLOADSIZE(codec_inst_ptr_->inst,
+ max_payload_len_bytes);
}
-WebRtc_Word32 ACMISAC::SetISACMaxRate(const WebRtc_UWord32 maxRateBitPerSec) {
- return ACM_ISAC_SETMAXRATE(_codecInstPtr->inst, maxRateBitPerSec);
+WebRtc_Word32 ACMISAC::SetISACMaxRate(
+ const WebRtc_UWord32 max_rate_bit_per_sec) {
+ return ACM_ISAC_SETMAXRATE(codec_inst_ptr_->inst, max_rate_bit_per_sec);
}
void ACMISAC::UpdateFrameLen() {
- _frameLenSmpl = ACM_ISAC_GETNEWFRAMELEN(_codecInstPtr->inst);
- _encoderParams.codecInstant.pacsize = _frameLenSmpl;
+ frame_len_smpl_ = ACM_ISAC_GETNEWFRAMELEN(codec_inst_ptr_->inst);
+ encoder_params_.codec_inst.pacsize = frame_len_smpl_;
}
-void ACMISAC::CurrentRate(WebRtc_Word32& rateBitPerSec) {
- if (_isacCodingMode == ADAPTIVE) {
- ACM_ISAC_GETSENDBITRATE(_codecInstPtr->inst, &rateBitPerSec);
+void ACMISAC::CurrentRate(WebRtc_Word32& rate_bit_per_sec) {
+ if (isac_coding_mode_ == ADAPTIVE) {
+ ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &rate_bit_per_sec);
}
}
-bool ACMISAC::DecoderParamsSafe(WebRtcACMCodecParams* decParams,
- const WebRtc_UWord8 payloadType) {
- if (_decoderInitialized) {
- if (payloadType == _decoderParams.codecInstant.pltype) {
- memcpy(decParams, &_decoderParams, sizeof(WebRtcACMCodecParams));
+bool ACMISAC::DecoderParamsSafe(WebRtcACMCodecParams* dec_params,
+ const WebRtc_UWord8 payload_type) {
+ if (decoder_initialized_) {
+ if (payload_type == decoder_params_.codec_inst.pltype) {
+ memcpy(dec_params, &decoder_params_, sizeof(WebRtcACMCodecParams));
return true;
}
- if (payloadType == _decoderParams32kHz.codecInstant.pltype) {
- memcpy(decParams, &_decoderParams32kHz, sizeof(WebRtcACMCodecParams));
+ if (payload_type == decoder_params_32khz_.codec_inst.pltype) {
+ memcpy(dec_params, &decoder_params_32khz_, sizeof(WebRtcACMCodecParams));
return true;
}
}
return false;
}
-void ACMISAC::SaveDecoderParamSafe(const WebRtcACMCodecParams* codecParams) {
+void ACMISAC::SaveDecoderParamSafe(const WebRtcACMCodecParams* codec_params) {
// set decoder sampling frequency.
- if (codecParams->codecInstant.plfreq == 32000 ||
- codecParams->codecInstant.plfreq == 48000) {
- memcpy(&_decoderParams32kHz, codecParams, sizeof(WebRtcACMCodecParams));
+ if (codec_params->codec_inst.plfreq == 32000 ||
+ codec_params->codec_inst.plfreq == 48000) {
+ memcpy(&decoder_params_32khz_, codec_params, sizeof(WebRtcACMCodecParams));
} else {
- memcpy(&_decoderParams, codecParams, sizeof(WebRtcACMCodecParams));
+ memcpy(&decoder_params_, codec_params, sizeof(WebRtcACMCodecParams));
}
}
-WebRtc_Word16 ACMISAC::REDPayloadISAC(const WebRtc_Word32 isacRate,
- const WebRtc_Word16 isacBwEstimate,
+WebRtc_Word16 ACMISAC::REDPayloadISAC(const WebRtc_Word32 isac_rate,
+ const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
- WebRtc_Word16* payloadLenBytes) {
+ WebRtc_Word16* payload_len_bytes) {
WebRtc_Word16 status;
- ReadLockScoped rl(_codecWrapperLock);
- status = Transcode(payload, payloadLenBytes, isacBwEstimate, isacRate, true);
+ ReadLockScoped rl(codec_wrapper_lock_);
+ status = Transcode(payload, payload_len_bytes, isac_bw_estimate, isac_rate,
+ true);
return status;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_isac.h b/webrtc/modules/audio_coding/main/source/acm_isac.h
index ee22637..1724cf8 100644
--- a/webrtc/modules/audio_coding/main/source/acm_isac.h
+++ b/webrtc/modules/audio_coding/main/source/acm_isac.h
@@ -11,112 +11,118 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
struct ACMISACInst;
-enum iSACCodingMode {
+enum IsacCodingMode {
ADAPTIVE,
CHANNEL_INDEPENDENT
};
class ACMISAC : public ACMGenericCodec {
public:
- ACMISAC(WebRtc_Word16 codecID);
+ explicit ACMISAC(WebRtc_Word16 codec_id);
~ACMISAC();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 DeliverCachedIsacData(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte,
+ WebRtc_Word16 DeliverCachedIsacData(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte,
WebRtc_UWord32* timestamp,
- WebRtcACMEncodingType* encodingType,
- const WebRtc_UWord16 isacRate,
- const WebRtc_UWord8 isacBWestimate);
+ WebRtcACMEncodingType* encoding_type,
+ const WebRtc_UWord16 isac_rate,
+ const WebRtc_UWord8 isac_bwestimate);
- WebRtc_Word16 DeliverCachedData(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */,
+ WebRtc_Word16 DeliverCachedData(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */,
WebRtc_UWord32* /* timestamp */,
- WebRtcACMEncodingType* /* encodingType */) {
+ WebRtcACMEncodingType* /* encoding_type */) {
return -1;
}
- WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 codecId);
+ WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 codec_id);
- WebRtc_Word16 UpdateEncoderSampFreq(WebRtc_UWord16 sampFreqHz);
+ WebRtc_Word16 UpdateEncoderSampFreq(WebRtc_UWord16 samp_freq_hz);
- WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& sampFreqHz);
+ WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& samp_freq_hz);
WebRtc_Word32 ConfigISACBandwidthEstimator(
- const WebRtc_UWord8 initFrameSizeMsec,
- const WebRtc_UWord16 initRateBitPerSec, const bool enforceFrameSize);
+ const WebRtc_UWord8 init_frame_size_msec,
+ const WebRtc_UWord16 init_rate_bit_per_sec,
+ const bool enforce_frame_size);
- WebRtc_Word32 SetISACMaxPayloadSize(const WebRtc_UWord16 maxPayloadLenBytes);
+ WebRtc_Word32 SetISACMaxPayloadSize(
+ const WebRtc_UWord16 max_payload_len_bytes);
- WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 maxRateBitPerSec);
+ WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_rate_bit_per_sec);
- WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isacRate,
- const WebRtc_Word16 isacBwEstimate,
+ WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isac_rate,
+ const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
- WebRtc_Word16* payloadLenBytes);
+ WebRtc_Word16* payload_len_bytes);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte, WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
+ WebRtc_Word16* audio,
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
- WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bitRate);
+ WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bit_rate);
WebRtc_Word32 GetEstimatedBandwidthSafe();
- WebRtc_Word32 SetEstimatedBandwidthSafe(WebRtc_Word32 estimatedBandwidth);
+ WebRtc_Word32 SetEstimatedBandwidthSafe(WebRtc_Word32 estimated_bandwidth);
- WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* redPayload,
- WebRtc_Word16* payloadBytes);
+ WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* red_payload,
+ WebRtc_Word16* payload_bytes);
WebRtc_Word16 InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
- WebRtc_Word16 Transcode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte, WebRtc_Word16 qBWE,
- WebRtc_Word32 rate, bool isRED);
+ WebRtc_Word16 Transcode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte,
+ WebRtc_Word16 q_bwe,
+ WebRtc_Word32 rate,
+ bool is_red);
- void CurrentRate(WebRtc_Word32& rateBitPerSec);
+ void CurrentRate(WebRtc_Word32& rate_bit_per_sec);
void UpdateFrameLen();
- bool DecoderParamsSafe(WebRtcACMCodecParams *decParams,
- const WebRtc_UWord8 payloadType);
+ bool DecoderParamsSafe(WebRtcACMCodecParams *dec_params,
+ const WebRtc_UWord8 payload_type);
- void SaveDecoderParamSafe(const WebRtcACMCodecParams* codecParams);
+ void SaveDecoderParamSafe(const WebRtcACMCodecParams* codec_params);
- ACMISACInst* _codecInstPtr;
- bool _isEncInitialized;
- iSACCodingMode _isacCodingMode;
- bool _enforceFrameSize;
- WebRtc_Word32 _isacCurrentBN;
- WebRtc_UWord16 _samplesIn10MsAudio;
- WebRtcACMCodecParams _decoderParams32kHz;
+ ACMISACInst* codec_inst_ptr_;
+ bool is_enc_initialized_;
+ IsacCodingMode isac_coding_mode_;
+ bool enforce_frame_size_;
+ WebRtc_Word32 isac_current_bn_;
+ WebRtc_UWord16 samples_in_10ms_audio_;
+ WebRtcACMCodecParams decoder_params_32khz_;
};
} // namespace
diff --git a/webrtc/modules/audio_coding/main/source/acm_isac_macros.h b/webrtc/modules/audio_coding/main/source/acm_isac_macros.h
index 07031d6..99d7084 100644
--- a/webrtc/modules/audio_coding/main/source/acm_isac_macros.h
+++ b/webrtc/modules/audio_coding/main/source/acm_isac_macros.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/engine_configurations.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/main/source/acm_neteq.cc b/webrtc/modules/audio_coding/main/source/acm_neteq.cc
index 671a5e3..497be79 100644
--- a/webrtc/modules/audio_coding/main/source/acm_neteq.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_neteq.cc
@@ -8,19 +8,21 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <algorithm> // sort
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+
#include <stdlib.h> // malloc
+
+#include <algorithm> // sort
#include <vector>
-#include "acm_neteq.h"
-#include "common_types.h"
-#include "critical_section_wrapper.h"
-#include "rw_lock_wrapper.h"
-#include "signal_processing_library.h"
-#include "tick_util.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_internal.h"
+#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
+#include "webrtc/common_types.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_internal.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
+#include "webrtc/system_wrappers/interface/tick_util.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -30,81 +32,81 @@
#define NETEQ_ERR_MSG_LEN_BYTE (WEBRTC_NETEQ_MAX_ERROR_NAME + 1)
ACMNetEQ::ACMNetEQ()
- : _id(0),
- _currentSampFreqKHz(NETEQ_INIT_FREQ_KHZ),
- _avtPlayout(false),
- _playoutMode(voice),
- _netEqCritSect(CriticalSectionWrapper::CreateCriticalSection()),
- _vadStatus(false),
- _vadMode(VADNormal),
- _decodeLock(RWLockWrapper::CreateRWLock()),
- _numSlaves(0),
- _receivedStereo(false),
- _masterSlaveInfo(NULL),
- _previousAudioActivity(AudioFrame::kVadUnknown),
- _extraDelay(0),
- _callbackCritSect(CriticalSectionWrapper::CreateCriticalSection()) {
+ : id_(0),
+ current_samp_freq_khz_(NETEQ_INIT_FREQ_KHZ),
+ avt_playout_(false),
+ playout_mode_(voice),
+ neteq_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
+ vad_status_(false),
+ vad_mode_(VADNormal),
+ decode_lock_(RWLockWrapper::CreateRWLock()),
+ num_slaves_(0),
+ received_stereo_(false),
+ master_slave_info_(NULL),
+ previous_audio_activity_(AudioFrame::kVadUnknown),
+ extra_delay_(0),
+ callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()) {
for (int n = 0; n < MAX_NUM_SLAVE_NETEQ + 1; n++) {
- _isInitialized[n] = false;
- _ptrVADInst[n] = NULL;
- _inst[n] = NULL;
- _instMem[n] = NULL;
- _netEqPacketBuffer[n] = NULL;
+ is_initialized_[n] = false;
+ ptr_vadinst_[n] = NULL;
+ inst_[n] = NULL;
+ inst_mem_[n] = NULL;
+ neteq_packet_buffer_[n] = NULL;
}
}
ACMNetEQ::~ACMNetEQ() {
{
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
RemoveNetEQSafe(0); // Master.
RemoveSlavesSafe();
}
- if (_netEqCritSect != NULL) {
- delete _netEqCritSect;
+ if (neteq_crit_sect_ != NULL) {
+ delete neteq_crit_sect_;
}
- if (_decodeLock != NULL) {
- delete _decodeLock;
+ if (decode_lock_ != NULL) {
+ delete decode_lock_;
}
- if (_callbackCritSect != NULL) {
- delete _callbackCritSect;
+ if (callback_crit_sect_ != NULL) {
+ delete callback_crit_sect_;
}
}
WebRtc_Word32 ACMNetEQ::Init() {
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
if (InitByIdxSafe(idx) < 0) {
return -1;
}
// delete VAD instance and start fresh if required.
- if (_ptrVADInst[idx] != NULL) {
- WebRtcVad_Free(_ptrVADInst[idx]);
- _ptrVADInst[idx] = NULL;
+ if (ptr_vadinst_[idx] != NULL) {
+ WebRtcVad_Free(ptr_vadinst_[idx]);
+ ptr_vadinst_[idx] = NULL;
}
- if (_vadStatus) {
+ if (vad_status_) {
// Has to enable VAD
if (EnableVADByIdxSafe(idx) < 0) {
// Failed to enable VAD.
// Delete VAD instance, if it is created
- if (_ptrVADInst[idx] != NULL) {
- WebRtcVad_Free(_ptrVADInst[idx]);
- _ptrVADInst[idx] = NULL;
+ if (ptr_vadinst_[idx] != NULL) {
+ WebRtcVad_Free(ptr_vadinst_[idx]);
+ ptr_vadinst_[idx] = NULL;
}
// We are at initialization of NetEq, if failed to
// enable VAD, we delete the NetEq instance.
- if (_instMem[idx] != NULL) {
- free(_instMem[idx]);
- _instMem[idx] = NULL;
- _inst[idx] = NULL;
+ if (inst_mem_[idx] != NULL) {
+ free(inst_mem_[idx]);
+ inst_mem_[idx] = NULL;
+ inst_[idx] = NULL;
}
- _isInitialized[idx] = false;
+ is_initialized_[idx] = false;
return -1;
}
}
- _isInitialized[idx] = true;
+ is_initialized_[idx] = true;
}
if (EnableVAD() == -1) {
return -1;
@@ -113,56 +115,56 @@
}
WebRtc_Word16 ACMNetEQ::InitByIdxSafe(const WebRtc_Word16 idx) {
- int memorySizeBytes;
- if (WebRtcNetEQ_AssignSize(&memorySizeBytes) != 0) {
+ int memory_size_bytes;
+ if (WebRtcNetEQ_AssignSize(&memory_size_bytes) != 0) {
LogError("AssignSize", idx);
return -1;
}
- if (_instMem[idx] != NULL) {
- free(_instMem[idx]);
- _instMem[idx] = NULL;
+ if (inst_mem_[idx] != NULL) {
+ free(inst_mem_[idx]);
+ inst_mem_[idx] = NULL;
}
- _instMem[idx] = malloc(memorySizeBytes);
- if (_instMem[idx] == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "InitByIdxSafe: NetEq Initialization error: could not allocate memory "
- "for NetEq");
- _isInitialized[idx] = false;
+ inst_mem_[idx] = malloc(memory_size_bytes);
+ if (inst_mem_[idx] == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "InitByIdxSafe: NetEq Initialization error: could not "
+ "allocate memory for NetEq");
+ is_initialized_[idx] = false;
return -1;
}
- if (WebRtcNetEQ_Assign(&_inst[idx], _instMem[idx]) != 0) {
- if (_instMem[idx] != NULL) {
- free(_instMem[idx]);
- _instMem[idx] = NULL;
+ if (WebRtcNetEQ_Assign(&inst_[idx], inst_mem_[idx]) != 0) {
+ if (inst_mem_[idx] != NULL) {
+ free(inst_mem_[idx]);
+ inst_mem_[idx] = NULL;
}
LogError("Assign", idx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"InitByIdxSafe: NetEq Initialization error: could not Assign");
- _isInitialized[idx] = false;
+ is_initialized_[idx] = false;
return -1;
}
- if (WebRtcNetEQ_Init(_inst[idx], NETEQ_INIT_FREQ) != 0) {
- if (_instMem[idx] != NULL) {
- free(_instMem[idx]);
- _instMem[idx] = NULL;
+ if (WebRtcNetEQ_Init(inst_[idx], NETEQ_INIT_FREQ) != 0) {
+ if (inst_mem_[idx] != NULL) {
+ free(inst_mem_[idx]);
+ inst_mem_[idx] = NULL;
}
LogError("Init", idx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "InitByIdxSafe: NetEq Initialization error: could not initialize "
- "NetEq");
- _isInitialized[idx] = false;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "InitByIdxSafe: NetEq Initialization error: could not "
+ "initialize NetEq");
+ is_initialized_[idx] = false;
return -1;
}
- _isInitialized[idx] = true;
+ is_initialized_[idx] = true;
return 0;
}
WebRtc_Word16 ACMNetEQ::EnableVADByIdxSafe(const WebRtc_Word16 idx) {
- if (_ptrVADInst[idx] == NULL) {
- if (WebRtcVad_Create(&_ptrVADInst[idx]) < 0) {
- _ptrVADInst[idx] = NULL;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (ptr_vadinst_[idx] == NULL) {
+ if (WebRtcVad_Create(&ptr_vadinst_[idx]) < 0) {
+ ptr_vadinst_[idx] = NULL;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"EnableVADByIdxSafe: NetEq Initialization error: could not "
"create VAD");
return -1;
@@ -170,37 +172,37 @@
}
if (WebRtcNetEQ_SetVADInstance(
- _inst[idx], _ptrVADInst[idx],
+ inst_[idx], ptr_vadinst_[idx],
(WebRtcNetEQ_VADInitFunction) WebRtcVad_Init,
(WebRtcNetEQ_VADSetmodeFunction) WebRtcVad_set_mode,
(WebRtcNetEQ_VADFunction) WebRtcVad_Process) < 0) {
LogError("setVADinstance", idx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "EnableVADByIdxSafe: NetEq Initialization error: could not set "
- "VAD instance");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "EnableVADByIdxSafe: NetEq Initialization error: could not "
+ "set VAD instance");
return -1;
}
- if (WebRtcNetEQ_SetVADMode(_inst[idx], _vadMode) < 0) {
+ if (WebRtcNetEQ_SetVADMode(inst_[idx], vad_mode_) < 0) {
LogError("setVADmode", idx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "EnableVADByIdxSafe: NetEq Initialization error: could not set "
- "VAD mode");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "EnableVADByIdxSafe: NetEq Initialization error: could not "
+ "set VAD mode");
return -1;
}
return 0;
}
WebRtc_Word32 ACMNetEQ::AllocatePacketBuffer(
- const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs) {
+ const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs) {
// Due to WebRtcNetEQ_GetRecommendedBufferSize
// the following has to be int otherwise we will have compiler error
// if not casted
- CriticalSectionScoped lock(_netEqCritSect);
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (AllocatePacketBufferByIdxSafe(usedCodecs, noOfCodecs, idx) < 0) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (AllocatePacketBufferByIdxSafe(used_codecs, num_codecs, idx) < 0) {
return -1;
}
}
@@ -208,42 +210,43 @@
}
WebRtc_Word16 ACMNetEQ::AllocatePacketBufferByIdxSafe(
- const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs,
+ const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs,
const WebRtc_Word16 idx) {
- int maxNoPackets;
- int bufferSizeInBytes;
+ int max_num_packets;
+ int buffer_size_in_bytes;
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AllocatePacketBufferByIdxSafe: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_GetRecommendedBufferSize(_inst[idx], usedCodecs, noOfCodecs,
- kTCPLargeJitter, &maxNoPackets,
- &bufferSizeInBytes) != 0) {
+ if (WebRtcNetEQ_GetRecommendedBufferSize(inst_[idx], used_codecs,
+ num_codecs,
+ kTCPLargeJitter,
+ &max_num_packets,
+ &buffer_size_in_bytes) != 0) {
LogError("GetRecommendedBufferSize", idx);
return -1;
}
- if (_netEqPacketBuffer[idx] != NULL) {
- free(_netEqPacketBuffer[idx]);
- _netEqPacketBuffer[idx] = NULL;
+ if (neteq_packet_buffer_[idx] != NULL) {
+ free(neteq_packet_buffer_[idx]);
+ neteq_packet_buffer_[idx] = NULL;
}
- _netEqPacketBuffer[idx] = (WebRtc_Word16 *) malloc(bufferSizeInBytes);
- if (_netEqPacketBuffer[idx] == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "AllocatePacketBufferByIdxSafe: NetEq Initialization error: could not "
- "allocate memory for NetEq Packet Buffer");
+ neteq_packet_buffer_[idx] = (WebRtc_Word16 *) malloc(buffer_size_in_bytes);
+ if (neteq_packet_buffer_[idx] == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "AllocatePacketBufferByIdxSafe: NetEq Initialization error: "
+ "could not allocate memory for NetEq Packet Buffer");
return -1;
-
}
- if (WebRtcNetEQ_AssignBuffer(_inst[idx], maxNoPackets,
- _netEqPacketBuffer[idx],
- bufferSizeInBytes) != 0) {
- if (_netEqPacketBuffer[idx] != NULL) {
- free(_netEqPacketBuffer[idx]);
- _netEqPacketBuffer[idx] = NULL;
+ if (WebRtcNetEQ_AssignBuffer(inst_[idx], max_num_packets,
+ neteq_packet_buffer_[idx],
+ buffer_size_in_bytes) != 0) {
+ if (neteq_packet_buffer_[idx] != NULL) {
+ free(neteq_packet_buffer_[idx]);
+ neteq_packet_buffer_[idx] = NULL;
}
LogError("AssignBuffer", idx);
return -1;
@@ -251,109 +254,109 @@
return 0;
}
-WebRtc_Word32 ACMNetEQ::SetExtraDelay(const WebRtc_Word32 delayInMS) {
- CriticalSectionScoped lock(_netEqCritSect);
+WebRtc_Word32 ACMNetEQ::SetExtraDelay(const WebRtc_Word32 delay_in_ms) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetExtraDelay: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_SetExtraDelay(_inst[idx], delayInMS) < 0) {
+ if (WebRtcNetEQ_SetExtraDelay(inst_[idx], delay_in_ms) < 0) {
LogError("SetExtraDelay", idx);
return -1;
}
}
- _extraDelay = delayInMS;
+ extra_delay_ = delay_in_ms;
return 0;
}
WebRtc_Word32 ACMNetEQ::SetAVTPlayout(const bool enable) {
- CriticalSectionScoped lock(_netEqCritSect);
- if (_avtPlayout != enable) {
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (avt_playout_ != enable) {
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetAVTPlayout: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_SetAVTPlayout(_inst[idx], (enable) ? 1 : 0) < 0) {
+ if (WebRtcNetEQ_SetAVTPlayout(inst_[idx], (enable) ? 1 : 0) < 0) {
LogError("SetAVTPlayout", idx);
return -1;
}
}
}
- _avtPlayout = enable;
+ avt_playout_ = enable;
return 0;
}
-bool ACMNetEQ::AVTPlayout() const {
- CriticalSectionScoped lock(_netEqCritSect);
- return _avtPlayout;
+bool ACMNetEQ::avt_playout() const {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ return avt_playout_;
}
WebRtc_Word32 ACMNetEQ::CurrentSampFreqHz() const {
- CriticalSectionScoped lock(_netEqCritSect);
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"CurrentSampFreqHz: NetEq is not initialized.");
return -1;
}
- return (WebRtc_Word32)(1000 * _currentSampFreqKHz);
+ return (WebRtc_Word32)(1000 * current_samp_freq_khz_);
}
WebRtc_Word32 ACMNetEQ::SetPlayoutMode(const AudioPlayoutMode mode) {
- CriticalSectionScoped lock(_netEqCritSect);
- if (_playoutMode != mode) {
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (playout_mode_ != mode) {
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetPlayoutMode: NetEq is not initialized.");
return -1;
}
- enum WebRtcNetEQPlayoutMode playoutMode = kPlayoutOff;
+ enum WebRtcNetEQPlayoutMode playout_mode = kPlayoutOff;
switch (mode) {
case voice:
- playoutMode = kPlayoutOn;
+ playout_mode = kPlayoutOn;
break;
case fax:
- playoutMode = kPlayoutFax;
+ playout_mode = kPlayoutFax;
break;
case streaming:
- playoutMode = kPlayoutStreaming;
+ playout_mode = kPlayoutStreaming;
break;
case off:
- playoutMode = kPlayoutOff;
+ playout_mode = kPlayoutOff;
break;
}
- if (WebRtcNetEQ_SetPlayoutMode(_inst[idx], playoutMode) < 0) {
+ if (WebRtcNetEQ_SetPlayoutMode(inst_[idx], playout_mode) < 0) {
LogError("SetPlayoutMode", idx);
return -1;
}
}
- _playoutMode = mode;
+ playout_mode_ = mode;
}
return 0;
}
-AudioPlayoutMode ACMNetEQ::PlayoutMode() const {
- CriticalSectionScoped lock(_netEqCritSect);
- return _playoutMode;
+AudioPlayoutMode ACMNetEQ::playout_mode() const {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ return playout_mode_;
}
WebRtc_Word32 ACMNetEQ::NetworkStatistics(
ACMNetworkStatistics* statistics) const {
WebRtcNetEQ_NetworkStatistics stats;
- CriticalSectionScoped lock(_netEqCritSect);
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"NetworkStatistics: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_GetNetworkStatistics(_inst[0], &stats) == 0) {
+ if (WebRtcNetEQ_GetNetworkStatistics(inst_[0], &stats) == 0) {
statistics->currentAccelerateRate = stats.currentAccelerateRate;
statistics->currentBufferSize = stats.currentBufferSize;
statistics->jitterPeaksFound = (stats.jitterPeaksFound > 0);
@@ -369,7 +372,7 @@
}
const int kArrayLen = 100;
int waiting_times[kArrayLen];
- int waiting_times_len = WebRtcNetEQ_GetRawFrameWaitingTimes(_inst[0],
+ int waiting_times_len = WebRtcNetEQ_GetRawFrameWaitingTimes(inst_[0],
kArrayLen,
waiting_times);
if (waiting_times_len > 0) {
@@ -379,8 +382,8 @@
size_t size = waiting_times_vec.size();
assert(size == static_cast<size_t>(waiting_times_len));
if (size % 2 == 0) {
- statistics->medianWaitingTimeMs = (waiting_times_vec[size / 2 - 1]
- + waiting_times_vec[size / 2]) / 2;
+ statistics->medianWaitingTimeMs = (waiting_times_vec[size / 2 - 1] +
+ waiting_times_vec[size / 2]) / 2;
} else {
statistics->medianWaitingTimeMs = waiting_times_vec[size / 2];
}
@@ -403,67 +406,68 @@
return 0;
}
-WebRtc_Word32 ACMNetEQ::RecIn(const WebRtc_UWord8* incomingPayload,
- const WebRtc_Word32 payloadLength,
- const WebRtcRTPHeader& rtpInfo) {
- WebRtc_Word16 payload_length = static_cast<WebRtc_Word16>(payloadLength);
+WebRtc_Word32 ACMNetEQ::RecIn(const WebRtc_UWord8* incoming_payload,
+ const WebRtc_Word32 length_payload,
+ const WebRtcRTPHeader& rtp_info) {
+ WebRtc_Word16 payload_length = static_cast<WebRtc_Word16>(length_payload);
// translate to NetEq struct
- WebRtcNetEQ_RTPInfo netEqRTPInfo;
- netEqRTPInfo.payloadType = rtpInfo.header.payloadType;
- netEqRTPInfo.sequenceNumber = rtpInfo.header.sequenceNumber;
- netEqRTPInfo.timeStamp = rtpInfo.header.timestamp;
- netEqRTPInfo.SSRC = rtpInfo.header.ssrc;
- netEqRTPInfo.markerBit = rtpInfo.header.markerBit;
+ WebRtcNetEQ_RTPInfo neteq_rtpinfo;
+ neteq_rtpinfo.payloadType = rtp_info.header.payloadType;
+ neteq_rtpinfo.sequenceNumber = rtp_info.header.sequenceNumber;
+ neteq_rtpinfo.timeStamp = rtp_info.header.timestamp;
+ neteq_rtpinfo.SSRC = rtp_info.header.ssrc;
+ neteq_rtpinfo.markerBit = rtp_info.header.markerBit;
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
// Down-cast the time to (32-6)-bit since we only care about
// the least significant bits. (32-6) bits cover 2^(32-6) = 67108864 ms.
// we masked 6 most significant bits of 32-bit so we don't loose resolution
// when do the following multiplication.
- const WebRtc_UWord32 nowInMs =
+ const WebRtc_UWord32 now_in_ms =
static_cast<WebRtc_UWord32>(
TickTime::MillisecondTimestamp() & 0x03ffffff);
- WebRtc_UWord32 recvTimestamp = static_cast<WebRtc_UWord32>(
- _currentSampFreqKHz * nowInMs);
+ WebRtc_UWord32 recv_timestamp = static_cast<WebRtc_UWord32>(
+ current_samp_freq_khz_ * now_in_ms);
int status;
// In case of stereo payload, first half of the data should be pushed into
// master, and the second half into slave.
- if (rtpInfo.type.Audio.channel == 2) {
+ if (rtp_info.type.Audio.channel == 2) {
payload_length = payload_length / 2;
}
// Check that master is initialized.
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecIn: NetEq is not initialized.");
return -1;
}
// PUSH into Master
- status = WebRtcNetEQ_RecInRTPStruct(_inst[0], &netEqRTPInfo, incomingPayload,
- payload_length, recvTimestamp);
+ status = WebRtcNetEQ_RecInRTPStruct(inst_[0], &neteq_rtpinfo,
+ incoming_payload, payload_length,
+ recv_timestamp);
if (status < 0) {
LogError("RecInRTPStruct", 0);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecIn: NetEq, error in pushing in Master");
return -1;
}
// If the received stream is stereo, insert second half of paket into slave.
- if (rtpInfo.type.Audio.channel == 2) {
- if (!_isInitialized[1]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (rtp_info.type.Audio.channel == 2) {
+ if (!is_initialized_[1]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecIn: NetEq is not initialized.");
return -1;
}
// PUSH into Slave
- status = WebRtcNetEQ_RecInRTPStruct(_inst[1], &netEqRTPInfo,
- &incomingPayload[payload_length],
- payload_length, recvTimestamp);
+ status = WebRtcNetEQ_RecInRTPStruct(inst_[1], &neteq_rtpinfo,
+ &incoming_payload[payload_length],
+ payload_length, recv_timestamp);
if (status < 0) {
LogError("RecInRTPStruct", 1);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecIn: NetEq, error in pushing in Slave");
return -1;
}
@@ -472,183 +476,185 @@
return 0;
}
-WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audioFrame) {
+WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
enum WebRtcNetEQOutputType type;
- WebRtc_Word16 payloadLenSample;
- enum WebRtcNetEQOutputType typeMaster;
- enum WebRtcNetEQOutputType typeSlave;
+ WebRtc_Word16 payload_len_sample;
+ enum WebRtcNetEQOutputType type_master;
+ enum WebRtcNetEQOutputType type_slave;
- WebRtc_Word16 payloadLenSampleSlave;
+ WebRtc_Word16 payload_len_sample_slave;
- CriticalSectionScoped lockNetEq(_netEqCritSect);
+ CriticalSectionScoped lockNetEq(neteq_crit_sect_);
- if (!_receivedStereo) {
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!received_stereo_) {
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecOut: NetEq is not initialized.");
return -1;
}
{
- WriteLockScoped lockCodec(*_decodeLock);
- if (WebRtcNetEQ_RecOut(_inst[0], &(audioFrame.data_[0]),
- &payloadLenSample) != 0) {
+ WriteLockScoped lockCodec(*decode_lock_);
+ if (WebRtcNetEQ_RecOut(inst_[0], &(audio_frame.data_[0]),
+ &payload_len_sample) != 0) {
LogError("RecOut", 0);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecOut: NetEq, error in pulling out for mono case");
// Check for errors that can be recovered from:
// RECOUT_ERROR_SAMPLEUNDERRUN = 2003
- int errorCode = WebRtcNetEQ_GetErrorCode(_inst[0]);
- if (errorCode != 2003) {
+ int error_code = WebRtcNetEQ_GetErrorCode(inst_[0]);
+ if (error_code != 2003) {
// Cannot recover; return an error
return -1;
}
}
}
- WebRtcNetEQ_GetSpeechOutputType(_inst[0], &type);
- audioFrame.num_channels_ = 1;
+ WebRtcNetEQ_GetSpeechOutputType(inst_[0], &type);
+ audio_frame.num_channels_ = 1;
} else {
- if (!_isInitialized[0] || !_isInitialized[1]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!is_initialized_[0] || !is_initialized_[1]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecOut: NetEq is not initialized.");
return -1;
}
- WebRtc_Word16 payloadMaster[480];
- WebRtc_Word16 payloadSlave[480];
+ WebRtc_Word16 payload_master[480];
+ WebRtc_Word16 payload_slave[480];
{
- WriteLockScoped lockCodec(*_decodeLock);
- if (WebRtcNetEQ_RecOutMasterSlave(_inst[0], payloadMaster,
- &payloadLenSample, _masterSlaveInfo, 1)
- != 0) {
+ WriteLockScoped lockCodec(*decode_lock_);
+ if (WebRtcNetEQ_RecOutMasterSlave(inst_[0], payload_master,
+ &payload_len_sample, master_slave_info_,
+ 1) != 0) {
LogError("RecOutMasterSlave", 0);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecOut: NetEq, error in pulling out for master");
// Check for errors that can be recovered from:
// RECOUT_ERROR_SAMPLEUNDERRUN = 2003
- int errorCode = WebRtcNetEQ_GetErrorCode(_inst[0]);
- if (errorCode != 2003) {
+ int error_code = WebRtcNetEQ_GetErrorCode(inst_[0]);
+ if (error_code != 2003) {
// Cannot recover; return an error
return -1;
}
}
- if (WebRtcNetEQ_RecOutMasterSlave(_inst[1], payloadSlave,
- &payloadLenSampleSlave,
- _masterSlaveInfo, 0) != 0) {
+ if (WebRtcNetEQ_RecOutMasterSlave(inst_[1], payload_slave,
+ &payload_len_sample_slave,
+ master_slave_info_, 0) != 0) {
LogError("RecOutMasterSlave", 1);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RecOut: NetEq, error in pulling out for slave");
// Check for errors that can be recovered from:
// RECOUT_ERROR_SAMPLEUNDERRUN = 2003
- int errorCode = WebRtcNetEQ_GetErrorCode(_inst[1]);
- if (errorCode != 2003) {
+ int error_code = WebRtcNetEQ_GetErrorCode(inst_[1]);
+ if (error_code != 2003) {
// Cannot recover; return an error
return -1;
}
}
}
- if (payloadLenSample != payloadLenSampleSlave) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _id,
- "RecOut: mismatch between the lenght of the decoded audio by Master "
- "(%d samples) and Slave (%d samples).",
- payloadLenSample, payloadLenSampleSlave);
- if (payloadLenSample > payloadLenSampleSlave) {
- memset(&payloadSlave[payloadLenSampleSlave], 0,
- (payloadLenSample - payloadLenSampleSlave) * sizeof(WebRtc_Word16));
+ if (payload_len_sample != payload_len_sample_slave) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
+ "RecOut: mismatch between the lenght of the decoded audio "
+ "by Master (%d samples) and Slave (%d samples).",
+ payload_len_sample, payload_len_sample_slave);
+ if (payload_len_sample > payload_len_sample_slave) {
+ memset(&payload_slave[payload_len_sample_slave], 0,
+ (payload_len_sample - payload_len_sample_slave) *
+ sizeof(WebRtc_Word16));
}
}
- for (WebRtc_Word16 n = 0; n < payloadLenSample; n++) {
- audioFrame.data_[n << 1] = payloadMaster[n];
- audioFrame.data_[(n << 1) + 1] = payloadSlave[n];
+ for (WebRtc_Word16 n = 0; n < payload_len_sample; n++) {
+ audio_frame.data_[n << 1] = payload_master[n];
+ audio_frame.data_[(n << 1) + 1] = payload_slave[n];
}
- audioFrame.num_channels_ = 2;
+ audio_frame.num_channels_ = 2;
- WebRtcNetEQ_GetSpeechOutputType(_inst[0], &typeMaster);
- WebRtcNetEQ_GetSpeechOutputType(_inst[1], &typeSlave);
- if ((typeMaster == kOutputNormal) || (typeSlave == kOutputNormal)) {
+ WebRtcNetEQ_GetSpeechOutputType(inst_[0], &type_master);
+ WebRtcNetEQ_GetSpeechOutputType(inst_[1], &type_slave);
+ if ((type_master == kOutputNormal) || (type_slave == kOutputNormal)) {
type = kOutputNormal;
} else {
- type = typeMaster;
+ type = type_master;
}
}
- audioFrame.samples_per_channel_ =
- static_cast<WebRtc_UWord16>(payloadLenSample);
+ audio_frame.samples_per_channel_ =
+ static_cast<WebRtc_UWord16>(payload_len_sample);
// NetEq always returns 10 ms of audio.
- _currentSampFreqKHz =
- static_cast<float>(audioFrame.samples_per_channel_) / 10.0f;
- audioFrame.sample_rate_hz_ = audioFrame.samples_per_channel_ * 100;
- if (_vadStatus) {
+ current_samp_freq_khz_ =
+ static_cast<float>(audio_frame.samples_per_channel_) / 10.0f;
+ audio_frame.sample_rate_hz_ = audio_frame.samples_per_channel_ * 100;
+ if (vad_status_) {
if (type == kOutputVADPassive) {
- audioFrame.vad_activity_ = AudioFrame::kVadPassive;
- audioFrame.speech_type_ = AudioFrame::kNormalSpeech;
+ audio_frame.vad_activity_ = AudioFrame::kVadPassive;
+ audio_frame.speech_type_ = AudioFrame::kNormalSpeech;
} else if (type == kOutputNormal) {
- audioFrame.vad_activity_ = AudioFrame::kVadActive;
- audioFrame.speech_type_ = AudioFrame::kNormalSpeech;
+ audio_frame.vad_activity_ = AudioFrame::kVadActive;
+ audio_frame.speech_type_ = AudioFrame::kNormalSpeech;
} else if (type == kOutputPLC) {
- audioFrame.vad_activity_ = _previousAudioActivity;
- audioFrame.speech_type_ = AudioFrame::kPLC;
+ audio_frame.vad_activity_ = previous_audio_activity_;
+ audio_frame.speech_type_ = AudioFrame::kPLC;
} else if (type == kOutputCNG) {
- audioFrame.vad_activity_ = AudioFrame::kVadPassive;
- audioFrame.speech_type_ = AudioFrame::kCNG;
+ audio_frame.vad_activity_ = AudioFrame::kVadPassive;
+ audio_frame.speech_type_ = AudioFrame::kCNG;
} else {
- audioFrame.vad_activity_ = AudioFrame::kVadPassive;
- audioFrame.speech_type_ = AudioFrame::kPLCCNG;
+ audio_frame.vad_activity_ = AudioFrame::kVadPassive;
+ audio_frame.speech_type_ = AudioFrame::kPLCCNG;
}
} else {
// Always return kVadUnknown when receive VAD is inactive
- audioFrame.vad_activity_ = AudioFrame::kVadUnknown;
+ audio_frame.vad_activity_ = AudioFrame::kVadUnknown;
if (type == kOutputNormal) {
- audioFrame.speech_type_ = AudioFrame::kNormalSpeech;
+ audio_frame.speech_type_ = AudioFrame::kNormalSpeech;
} else if (type == kOutputPLC) {
- audioFrame.speech_type_ = AudioFrame::kPLC;
+ audio_frame.speech_type_ = AudioFrame::kPLC;
} else if (type == kOutputPLCtoCNG) {
- audioFrame.speech_type_ = AudioFrame::kPLCCNG;
+ audio_frame.speech_type_ = AudioFrame::kPLCCNG;
} else if (type == kOutputCNG) {
- audioFrame.speech_type_ = AudioFrame::kCNG;
+ audio_frame.speech_type_ = AudioFrame::kCNG;
} else {
// type is kOutputVADPassive which
- // we don't expect to get if _vadStatus is false
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _id,
- "RecOut: NetEq returned kVadPassive while _vadStatus is false.");
- audioFrame.vad_activity_ = AudioFrame::kVadUnknown;
- audioFrame.speech_type_ = AudioFrame::kNormalSpeech;
+ // we don't expect to get if vad_status_ is false
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
+ "RecOut: NetEq returned kVadPassive while vad_status_ is "
+ "false.");
+ audio_frame.vad_activity_ = AudioFrame::kVadUnknown;
+ audio_frame.speech_type_ = AudioFrame::kNormalSpeech;
}
}
- _previousAudioActivity = audioFrame.vad_activity_;
+ previous_audio_activity_ = audio_frame.vad_activity_;
return 0;
}
-// When ACMGenericCodec has set the codec specific parameters in codecDef
+// When ACMGenericCodec has set the codec specific parameters in codec_def
// it calls AddCodec() to add the new codec to the NetEQ database.
-WebRtc_Word32 ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codecDef,
- bool toMaster) {
- if (codecDef == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "ACMNetEQ::AddCodec: error, codecDef is NULL");
+WebRtc_Word32 ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codec_def,
+ bool to_master) {
+ if (codec_def == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "ACMNetEQ::AddCodec: error, codec_def is NULL");
return -1;
}
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
WebRtc_Word16 idx;
- if (toMaster) {
+ if (to_master) {
idx = 0;
} else {
idx = 1;
}
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ACMNetEQ::AddCodec: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_CodecDbAdd(_inst[idx], codecDef) < 0) {
+ if (WebRtcNetEQ_CodecDbAdd(inst_[idx], codec_def) < 0) {
LogError("CodecDB_Add", idx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ACMNetEQ::AddCodec: NetEq, error in adding codec");
return -1;
} else {
@@ -658,65 +664,69 @@
// Creates a Word16 RTP packet out of a Word8 payload and an rtp info struct.
// Must be byte order safe.
-void ACMNetEQ::RTPPack(WebRtc_Word16* rtpPacket, const WebRtc_Word8* payload,
- const WebRtc_Word32 payloadLengthW8,
- const WebRtcRTPHeader& rtpInfo) {
+void ACMNetEQ::RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
+ const WebRtc_Word32 payload_length_bytes,
+ const WebRtcRTPHeader& rtp_info) {
WebRtc_Word32 idx = 0;
- WEBRTC_SPL_SET_BYTE(rtpPacket, (WebRtc_Word8) 0x80, idx);
+ WEBRTC_SPL_SET_BYTE(rtp_packet, (WebRtc_Word8) 0x80, idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket, rtpInfo.header.payloadType, idx);
+ WEBRTC_SPL_SET_BYTE(rtp_packet, rtp_info.header.payloadType, idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.sequenceNumber), 1),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.sequenceNumber), 1),
idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.sequenceNumber), 0),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.sequenceNumber), 0),
idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.timestamp), 3), idx);
- idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.timestamp), 2), idx);
- idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.timestamp), 1), idx);
- idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket,
- WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.timestamp), 0), idx);
- idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket, WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.ssrc), 3),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.timestamp), 3),
idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket, WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.ssrc), 2),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.timestamp), 2),
idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket, WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.ssrc), 1),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.timestamp), 1),
idx);
idx++;
- WEBRTC_SPL_SET_BYTE(rtpPacket, WEBRTC_SPL_GET_BYTE(&(rtpInfo.header.ssrc), 0),
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.timestamp), 0),
idx);
idx++;
- for (WebRtc_Word16 i = 0; i < payloadLengthW8; i++) {
- WEBRTC_SPL_SET_BYTE(rtpPacket, payload[i], idx);
+ WEBRTC_SPL_SET_BYTE(rtp_packet,
+ WEBRTC_SPL_GET_BYTE(&(rtp_info.header.ssrc), 3), idx);
+ idx++;
+ WEBRTC_SPL_SET_BYTE(rtp_packet, WEBRTC_SPL_GET_BYTE(&(rtp_info.header.ssrc),
+ 2), idx);
+ idx++;
+ WEBRTC_SPL_SET_BYTE(rtp_packet, WEBRTC_SPL_GET_BYTE(&(rtp_info.header.ssrc),
+ 1), idx);
+ idx++;
+ WEBRTC_SPL_SET_BYTE(rtp_packet, WEBRTC_SPL_GET_BYTE(&(rtp_info.header.ssrc),
+ 0), idx);
+ idx++;
+ for (WebRtc_Word16 i = 0; i < payload_length_bytes; i++) {
+ WEBRTC_SPL_SET_BYTE(rtp_packet, payload[i], idx);
idx++;
}
- if (payloadLengthW8 & 1) {
+ if (payload_length_bytes & 1) {
// Our 16 bits buffer is one byte too large, set that
// last byte to zero.
- WEBRTC_SPL_SET_BYTE(rtpPacket, 0x0, idx);
+ WEBRTC_SPL_SET_BYTE(rtp_packet, 0x0, idx);
}
}
WebRtc_Word16 ACMNetEQ::EnableVAD() {
- CriticalSectionScoped lock(_netEqCritSect);
- if (_vadStatus) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (vad_status_) {
return 0;
}
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVADStatus: NetEq is not initialized.");
return -1;
}
@@ -726,50 +736,50 @@
}
// Set previous VAD status to PASSIVE
- _previousAudioActivity = AudioFrame::kVadPassive;
+ previous_audio_activity_ = AudioFrame::kVadPassive;
}
- _vadStatus = true;
+ vad_status_ = true;
return 0;
}
-ACMVADMode ACMNetEQ::VADMode() const {
- CriticalSectionScoped lock(_netEqCritSect);
- return _vadMode;
+ACMVADMode ACMNetEQ::vad_mode() const {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ return vad_mode_;
}
WebRtc_Word16 ACMNetEQ::SetVADMode(const ACMVADMode mode) {
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
if ((mode < VADNormal) || (mode > VADVeryAggr)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVADMode: NetEq error: could not set VAD mode, mode is not "
"supported");
return -1;
} else {
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVADMode: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_SetVADMode(_inst[idx], mode) < 0) {
+ if (WebRtcNetEQ_SetVADMode(inst_[idx], mode) < 0) {
LogError("SetVADmode", idx);
return -1;
}
}
- _vadMode = mode;
+ vad_mode_ = mode;
return 0;
}
}
WebRtc_Word32 ACMNetEQ::FlushBuffers() {
- CriticalSectionScoped lock(_netEqCritSect);
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"FlushBuffers: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_FlushBuffers(_inst[idx]) < 0) {
+ if (WebRtcNetEQ_FlushBuffers(inst_[idx]) < 0) {
LogError("FlushBuffers", idx);
return -1;
}
@@ -777,30 +787,30 @@
return 0;
}
-WebRtc_Word16 ACMNetEQ::RemoveCodec(WebRtcNetEQDecoder codecIdx,
- bool isStereo) {
+WebRtc_Word16 ACMNetEQ::RemoveCodec(WebRtcNetEQDecoder codec_idx,
+ bool is_stereo) {
// sanity check
- if ((codecIdx <= kDecoderReservedStart) ||
- (codecIdx >= kDecoderReservedEnd)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "RemoveCodec: NetEq error: could not Remove Codec, codec index out "
- "of range");
+ if ((codec_idx <= kDecoderReservedStart) ||
+ (codec_idx >= kDecoderReservedEnd)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "RemoveCodec: NetEq error: could not Remove Codec, codec "
+ "index out of range");
return -1;
}
- CriticalSectionScoped lock(_netEqCritSect);
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RemoveCodec: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_CodecDbRemove(_inst[0], codecIdx) < 0) {
+ if (WebRtcNetEQ_CodecDbRemove(inst_[0], codec_idx) < 0) {
LogError("CodecDB_Remove", 0);
return -1;
}
- if (isStereo) {
- if (WebRtcNetEQ_CodecDbRemove(_inst[1], codecIdx) < 0) {
+ if (is_stereo) {
+ if (WebRtcNetEQ_CodecDbRemove(inst_[1], codec_idx) < 0) {
LogError("CodecDB_Remove", 1);
return -1;
}
@@ -811,14 +821,14 @@
WebRtc_Word16 ACMNetEQ::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode) {
- CriticalSectionScoped lock(_netEqCritSect);
- for (WebRtc_Word16 idx = 0; idx < _numSlaves + 1; idx++) {
- if (!_isInitialized[idx]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
+ if (!is_initialized_[idx]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetBackgroundNoiseMode: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_SetBGNMode(_inst[idx], (WebRtcNetEQBGNMode) mode) < 0) {
+ if (WebRtcNetEQ_SetBGNMode(inst_[idx], (WebRtcNetEQBGNMode) mode) < 0) {
LogError("SetBGNMode", idx);
return -1;
}
@@ -827,45 +837,45 @@
}
WebRtc_Word16 ACMNetEQ::BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) {
- WebRtcNetEQBGNMode myMode;
- CriticalSectionScoped lock(_netEqCritSect);
- if (!_isInitialized[0]) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WebRtcNetEQBGNMode my_mode;
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (!is_initialized_[0]) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"BackgroundNoiseMode: NetEq is not initialized.");
return -1;
}
- if (WebRtcNetEQ_GetBGNMode(_inst[0], &myMode) < 0) {
+ if (WebRtcNetEQ_GetBGNMode(inst_[0], &my_mode) < 0) {
LogError("WebRtcNetEQ_GetBGNMode", 0);
return -1;
} else {
- mode = (ACMBackgroundNoiseMode) myMode;
+ mode = (ACMBackgroundNoiseMode) my_mode;
}
return 0;
}
-void ACMNetEQ::SetUniqueId(WebRtc_Word32 id) {
- CriticalSectionScoped lock(_netEqCritSect);
- _id = id;
+void ACMNetEQ::set_id(WebRtc_Word32 id) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ id_ = id;
}
-void ACMNetEQ::LogError(const char* neteqFuncName,
+void ACMNetEQ::LogError(const char* neteq_func_name,
const WebRtc_Word16 idx) const {
- char errorName[NETEQ_ERR_MSG_LEN_BYTE];
- char myFuncName[50];
- int neteqErrorCode = WebRtcNetEQ_GetErrorCode(_inst[idx]);
- WebRtcNetEQ_GetErrorName(neteqErrorCode, errorName,
+ char error_name[NETEQ_ERR_MSG_LEN_BYTE];
+ char my_func_name[50];
+ int neteq_error_code = WebRtcNetEQ_GetErrorCode(inst_[idx]);
+ WebRtcNetEQ_GetErrorName(neteq_error_code, error_name,
NETEQ_ERR_MSG_LEN_BYTE - 1);
- strncpy(myFuncName, neteqFuncName, 49);
- errorName[NETEQ_ERR_MSG_LEN_BYTE - 1] = '\0';
- myFuncName[49] = '\0';
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "NetEq-%d Error in function %s, error-code: %d, error-string: %s", idx,
- myFuncName, neteqErrorCode, errorName);
+ strncpy(my_func_name, neteq_func_name, 49);
+ error_name[NETEQ_ERR_MSG_LEN_BYTE - 1] = '\0';
+ my_func_name[49] = '\0';
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "NetEq-%d Error in function %s, error-code: %d, error-string: "
+ " %s", idx, my_func_name, neteq_error_code, error_name);
}
WebRtc_Word32 ACMNetEQ::PlayoutTimestamp(WebRtc_UWord32& timestamp) {
- CriticalSectionScoped lock(_netEqCritSect);
- if (WebRtcNetEQ_GetSpeechTimeStamp(_inst[0], ×tamp) < 0) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ if (WebRtcNetEQ_GetSpeechTimeStamp(inst_[0], ×tamp) < 0) {
LogError("GetSpeechTimeStamp", 0);
return -1;
} else {
@@ -874,65 +884,67 @@
}
void ACMNetEQ::RemoveSlaves() {
- CriticalSectionScoped lock(_netEqCritSect);
+ CriticalSectionScoped lock(neteq_crit_sect_);
RemoveSlavesSafe();
}
void ACMNetEQ::RemoveSlavesSafe() {
- for (int i = 1; i < _numSlaves + 1; i++) {
+ for (int i = 1; i < num_slaves_ + 1; i++) {
RemoveNetEQSafe(i);
}
- if (_masterSlaveInfo != NULL) {
- free(_masterSlaveInfo);
- _masterSlaveInfo = NULL;
+ if (master_slave_info_ != NULL) {
+ free(master_slave_info_);
+ master_slave_info_ = NULL;
}
- _numSlaves = 0;
+ num_slaves_ = 0;
}
void ACMNetEQ::RemoveNetEQSafe(int index) {
- if (_instMem[index] != NULL) {
- free(_instMem[index]);
- _instMem[index] = NULL;
+ if (inst_mem_[index] != NULL) {
+ free(inst_mem_[index]);
+ inst_mem_[index] = NULL;
}
- if (_netEqPacketBuffer[index] != NULL) {
- free(_netEqPacketBuffer[index]);
- _netEqPacketBuffer[index] = NULL;
+ if (neteq_packet_buffer_[index] != NULL) {
+ free(neteq_packet_buffer_[index]);
+ neteq_packet_buffer_[index] = NULL;
}
- if (_ptrVADInst[index] != NULL) {
- WebRtcVad_Free(_ptrVADInst[index]);
- _ptrVADInst[index] = NULL;
+ if (ptr_vadinst_[index] != NULL) {
+ WebRtcVad_Free(ptr_vadinst_[index]);
+ ptr_vadinst_[index] = NULL;
}
}
-WebRtc_Word16 ACMNetEQ::AddSlave(const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs) {
- CriticalSectionScoped lock(_netEqCritSect);
- const WebRtc_Word16 slaveIdx = 1;
- if (_numSlaves < 1) {
+WebRtc_Word16 ACMNetEQ::AddSlave(const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ const WebRtc_Word16 slave_idx = 1;
+ if (num_slaves_ < 1) {
// initialize the receiver, this also sets up VAD.
- if (InitByIdxSafe(slaveIdx) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (InitByIdxSafe(slave_idx) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not Initialize");
return -1;
}
// Allocate buffer.
- if (AllocatePacketBufferByIdxSafe(usedCodecs, noOfCodecs, slaveIdx) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "AddSlave: AddSlave Failed, Could not Allocate Packet Buffer");
+ if (AllocatePacketBufferByIdxSafe(used_codecs, num_codecs,
+ slave_idx) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "AddSlave: AddSlave Failed, Could not Allocate Packet "
+ "Buffer");
return -1;
}
- if (_masterSlaveInfo != NULL) {
- free(_masterSlaveInfo);
- _masterSlaveInfo = NULL;
+ if (master_slave_info_ != NULL) {
+ free(master_slave_info_);
+ master_slave_info_ = NULL;
}
- int msInfoSize = WebRtcNetEQ_GetMasterSlaveInfoSize();
- _masterSlaveInfo = malloc(msInfoSize);
+ int ms_info_size = WebRtcNetEQ_GetMasterSlaveInfoSize();
+ master_slave_info_ = malloc(ms_info_size);
- if (_masterSlaveInfo == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (master_slave_info_ == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not Allocate memory for "
"Master-Slave Info");
return -1;
@@ -940,60 +952,62 @@
// We accept this as initialized NetEQ, the rest is to synchronize
// Slave with Master.
- _numSlaves = 1;
- _isInitialized[slaveIdx] = true;
+ num_slaves_ = 1;
+ is_initialized_[slave_idx] = true;
// Set Slave delay as all other instances.
- if (WebRtcNetEQ_SetExtraDelay(_inst[slaveIdx], _extraDelay) < 0) {
- LogError("SetExtraDelay", slaveIdx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (WebRtcNetEQ_SetExtraDelay(inst_[slave_idx], extra_delay_) < 0) {
+ LogError("SetExtraDelay", slave_idx);
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not set delay");
return -1;
}
// Set AVT
- if (WebRtcNetEQ_SetAVTPlayout(_inst[slaveIdx], (_avtPlayout) ? 1 : 0) < 0) {
- LogError("SetAVTPlayout", slaveIdx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (WebRtcNetEQ_SetAVTPlayout(inst_[slave_idx],
+ (avt_playout_) ? 1 : 0) < 0) {
+ LogError("SetAVTPlayout", slave_idx);
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not set AVT playout.");
return -1;
}
// Set Background Noise
- WebRtcNetEQBGNMode currentMode;
- if (WebRtcNetEQ_GetBGNMode(_inst[0], ¤tMode) < 0) {
+ WebRtcNetEQBGNMode current_mode;
+ if (WebRtcNetEQ_GetBGNMode(inst_[0], ¤t_mode) < 0) {
LogError("GetBGNMode", 0);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "AAddSlave: AddSlave Failed, Could not Get BGN form Master.");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "AAddSlave: AddSlave Failed, Could not Get BGN form "
+ "Master.");
return -1;
}
- if (WebRtcNetEQ_SetBGNMode(_inst[slaveIdx],
- (WebRtcNetEQBGNMode) currentMode) < 0) {
- LogError("SetBGNMode", slaveIdx);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (WebRtcNetEQ_SetBGNMode(inst_[slave_idx],
+ (WebRtcNetEQBGNMode) current_mode) < 0) {
+ LogError("SetBGNMode", slave_idx);
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not set BGN mode.");
return -1;
}
- enum WebRtcNetEQPlayoutMode playoutMode = kPlayoutOff;
- switch (_playoutMode) {
+ enum WebRtcNetEQPlayoutMode playout_mode = kPlayoutOff;
+ switch (playout_mode_) {
case voice:
- playoutMode = kPlayoutOn;
+ playout_mode = kPlayoutOn;
break;
case fax:
- playoutMode = kPlayoutFax;
+ playout_mode = kPlayoutFax;
break;
case streaming:
- playoutMode = kPlayoutStreaming;
+ playout_mode = kPlayoutStreaming;
break;
case off:
- playoutMode = kPlayoutOff;
+ playout_mode = kPlayoutOff;
break;
}
- if (WebRtcNetEQ_SetPlayoutMode(_inst[slaveIdx], playoutMode) < 0) {
+ if (WebRtcNetEQ_SetPlayoutMode(inst_[slave_idx], playout_mode) < 0) {
LogError("SetPlayoutMode", 1);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AddSlave: AddSlave Failed, Could not Set Playout Mode.");
return -1;
}
@@ -1002,14 +1016,14 @@
return 0;
}
-void ACMNetEQ::SetReceivedStereo(bool receivedStereo) {
- CriticalSectionScoped lock(_netEqCritSect);
- _receivedStereo = receivedStereo;
+void ACMNetEQ::set_received_stereo(bool received_stereo) {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ received_stereo_ = received_stereo;
}
-WebRtc_UWord8 ACMNetEQ::NumSlaves() {
- CriticalSectionScoped lock(_netEqCritSect);
- return _numSlaves;
+WebRtc_UWord8 ACMNetEQ::num_slaves() {
+ CriticalSectionScoped lock(neteq_crit_sect_);
+ return num_slaves_;
}
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_neteq.h b/webrtc/modules/audio_coding/main/source/acm_neteq.h
index 0086460..1ee4309 100644
--- a/webrtc/modules/audio_coding/main/source/acm_neteq.h
+++ b/webrtc/modules/audio_coding/main/source/acm_neteq.h
@@ -11,26 +11,29 @@
#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"
-#include "engine_configurations.h"
-#include "module_common_types.h"
-#include "typedefs.h"
-#include "webrtc_neteq.h"
-#include "webrtc_vad.h"
+#include "webrtc/common_audio/vad/include/webrtc_vad.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/typedefs.h"
namespace webrtc {
class CriticalSectionWrapper;
class RWLockWrapper;
struct CodecInst;
-enum AudioPlayoutMode;
-enum ACMSpeechType;
#define MAX_NUM_SLAVE_NETEQ 1
class ACMNetEQ {
public:
+ enum JitterBuffer {
+ kMasterJb = 0,
+ kSlaveJb = 1
+ };
+
// Constructor of the class
ACMNetEQ();
@@ -41,9 +44,9 @@
// Init()
// Allocates memory for NetEQ and VAD and initializes them.
//
- // Return value : 0 if ok.
- // -1 if NetEQ or VAD returned an error or
- // if out of memory.
+ // Return value : 0 if ok.
+ // -1 if NetEQ or VAD returned an error or
+ // if out of memory.
//
WebRtc_Word32 Init();
@@ -52,82 +55,83 @@
// Gives the payload to NetEQ.
//
// Input:
- // - incomingPayload : Incoming audio payload.
- // - payloadLength : Length of incoming audio payload.
- // - rtpInfo : RTP header for the incoming payload containing
+ // - incoming_payload : Incoming audio payload.
+ // - length_payload : Length of incoming audio payload.
+ // - rtp_info : RTP header for the incoming payload containing
// information about payload type, sequence number,
- // timestamp, ssrc and marker bit.
+ // timestamp, SSRC and marker bit.
//
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
- WebRtc_Word32 RecIn(const WebRtc_UWord8* incomingPayload,
- const WebRtc_Word32 payloadLength,
- const WebRtcRTPHeader& rtpInfo);
+ WebRtc_Word32 RecIn(const WebRtc_UWord8* incoming_payload,
+ const WebRtc_Word32 length_payload,
+ const WebRtcRTPHeader& rtp_info);
//
// RecOut()
// Asks NetEQ for 10 ms of decoded audio.
//
// Input:
- // -audioFrame : an audio frame were output data and
- // associated parameters are written to.
+ // -audio_frame : an audio frame were output data and
+ // associated parameters are written to.
//
- // Return value : 0 if ok.
- // -1 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // -1 if NetEQ returned an error.
//
- WebRtc_Word32 RecOut(AudioFrame& audioFrame);
+ WebRtc_Word32 RecOut(AudioFrame& audio_frame);
//
// AddCodec()
// Adds a new codec to the NetEQ codec database.
//
// Input:
- // - codecDef : The codec to be added.
- // - toMaster : true if the codec has to be added to Master
- // NetEq, otherwise will be added to the Slave
- // NetEQ.
+ // - codec_def : The codec to be added.
+ // - to_master : true if the codec has to be added to Master
+ // NetEq, otherwise will be added to the Slave
+ // NetEQ.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
- WebRtc_Word32 AddCodec(WebRtcNetEQ_CodecDef *codecDef, bool toMaster = true);
+ WebRtc_Word32 AddCodec(WebRtcNetEQ_CodecDef *codec_def,
+ bool to_master = true);
//
// AllocatePacketBuffer()
// Allocates the NetEQ packet buffer.
//
// Input:
- // - usedCodecs : An array of the codecs to be used by NetEQ.
- // - noOfCodecs : Number of codecs in usedCodecs.
+ // - used_codecs : An array of the codecs to be used by NetEQ.
+ // - num_codecs : Number of codecs in used_codecs.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
- WebRtc_Word32 AllocatePacketBuffer(const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs);
+ WebRtc_Word32 AllocatePacketBuffer(const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs);
//
// SetExtraDelay()
- // Sets an delayInMS milliseconds extra delay in NetEQ.
+ // Sets a |delay_in_ms| milliseconds extra delay in NetEQ.
//
// Input:
- // - delayInMS : Extra delay in milliseconds.
+ // - delay_in_ms : Extra delay in milliseconds.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
- WebRtc_Word32 SetExtraDelay(const WebRtc_Word32 delayInMS);
+ WebRtc_Word32 SetExtraDelay(const WebRtc_Word32 delay_in_ms);
//
// SetAVTPlayout()
// Enable/disable playout of AVT payloads.
//
// Input:
- // - enable : Enable if true, disable if false.
+ // - enable : Enable if true, disable if false.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
WebRtc_Word32 SetAVTPlayout(const bool enable);
@@ -135,16 +139,16 @@
// AVTPlayout()
// Get the current AVT playout state.
//
- // Return value : True if AVT playout is enabled.
- // False if AVT playout is disabled.
+ // Return value : True if AVT playout is enabled.
+ // False if AVT playout is disabled.
//
- bool AVTPlayout() const;
+ bool avt_playout() const;
//
// CurrentSampFreqHz()
// Get the current sampling frequency in Hz.
//
- // Return value : Sampling frequency in Hz.
+ // Return value : Sampling frequency in Hz.
//
WebRtc_Word32 CurrentSampFreqHz() const;
@@ -153,11 +157,11 @@
// Sets the playout mode to voice or fax.
//
// Input:
- // - mode : The playout mode to be used, voice,
- // fax, or streaming.
+ // - mode : The playout mode to be used, voice,
+ // fax, or streaming.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
WebRtc_Word32 SetPlayoutMode(const AudioPlayoutMode mode);
@@ -165,19 +169,19 @@
// PlayoutMode()
// Get the current playout mode.
//
- // Return value : The current playout mode.
+ // Return value : The current playout mode.
//
- AudioPlayoutMode PlayoutMode() const;
+ AudioPlayoutMode playout_mode() const;
//
// NetworkStatistics()
// Get the current network statistics from NetEQ.
//
// Output:
- // - statistics : The current network statistics.
+ // - statistics : The current network statistics.
//
- // Return value : 0 if ok.
- // <0 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // <0 if NetEQ returned an error.
//
WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics* statistics) const;
@@ -185,19 +189,19 @@
// VADMode()
// Get the current VAD Mode.
//
- // Return value : The current VAD mode.
+ // Return value : The current VAD mode.
//
- ACMVADMode VADMode() const;
+ ACMVADMode vad_mode() const;
//
// SetVADMode()
// Set the VAD mode.
//
// Input:
- // - mode : The new VAD mode.
+ // - mode : The new VAD mode.
//
- // Return value : 0 if ok.
- // -1 if an error occurred.
+ // Return value : 0 if ok.
+ // -1 if an error occurred.
//
WebRtc_Word16 SetVADMode(const ACMVADMode mode);
@@ -205,18 +209,18 @@
// DecodeLock()
// Get the decode lock used to protect decoder instances while decoding.
//
- // Return value : Pointer to the decode lock.
+ // Return value : Pointer to the decode lock.
//
RWLockWrapper* DecodeLock() const {
- return _decodeLock;
+ return decode_lock_;
}
//
// FlushBuffers()
// Flushes the NetEQ packet and speech buffers.
//
- // Return value : 0 if ok.
- // -1 if NetEQ returned an error.
+ // Return value : 0 if ok.
+ // -1 if NetEQ returned an error.
//
WebRtc_Word32 FlushBuffers();
@@ -225,23 +229,24 @@
// Removes a codec from the NetEQ codec database.
//
// Input:
- // - codecIdx : Codec to be removed.
+ // - codec_idx : Codec to be removed.
//
- // Return value : 0 if ok.
- // -1 if an error occurred.
+ // Return value : 0 if ok.
+ // -1 if an error occurred.
//
- WebRtc_Word16 RemoveCodec(WebRtcNetEQDecoder codecIdx, bool isStereo = false);
+ WebRtc_Word16 RemoveCodec(WebRtcNetEQDecoder codec_idx,
+ bool is_stereo = false);
//
// SetBackgroundNoiseMode()
// Set the mode of the background noise.
//
// Input:
- // - mode : an enumerator specifying the mode of the
- // background noise.
+ // - mode : an enumerator specifying the mode of the
+ // background noise.
//
- // Return value : 0 if succeeded,
- // -1 if failed to set the mode.
+ // Return value : 0 if succeeded,
+ // -1 if failed to set the mode.
//
WebRtc_Word16 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
@@ -249,28 +254,23 @@
// BackgroundNoiseMode()
// return the mode of the background noise.
//
- // Return value : The mode of background noise.
+ // Return value : The mode of background noise.
//
WebRtc_Word16 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode);
- void SetUniqueId(WebRtc_Word32 id);
+ void set_id(WebRtc_Word32 id);
WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp);
- void SetReceivedStereo(bool receivedStereo);
+ void set_received_stereo(bool received_stereo);
- WebRtc_UWord8 NumSlaves();
-
- enum JB {
- masterJB = 0,
- slaveJB = 1
- };
+ WebRtc_UWord8 num_slaves();
// Delete all slaves.
void RemoveSlaves();
- WebRtc_Word16 AddSlave(const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs);
+ WebRtc_Word16 AddSlave(const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs);
private:
//
@@ -279,34 +279,35 @@
// a WebRtcRTPHeader.
//
// Input:
- // - payload : Payload to be packetized.
- // - payloadLengthW8 : Length of the payload in bytes.
- // - rtpInfo : RTP header struct.
+ // - payload : Payload to be packetized.
+ // - payload_length_bytes : Length of the payload in bytes.
+ // - rtp_info : RTP header structure.
//
// Output:
- // - rtpPacket : The RTP packet.
+ // - rtp_packet : The RTP packet.
//
- static void RTPPack(WebRtc_Word16* rtpPacket, const WebRtc_Word8* payload,
- const WebRtc_Word32 payloadLengthW8,
- const WebRtcRTPHeader& rtpInfo);
+ static void RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
+ const WebRtc_Word32 payload_length_bytes,
+ const WebRtcRTPHeader& rtp_info);
- void LogError(const char* neteqFuncName, const WebRtc_Word16 idx) const;
+ void LogError(const char* neteq_func_name, const WebRtc_Word16 idx) const;
WebRtc_Word16 InitByIdxSafe(const WebRtc_Word16 idx);
+ //
// EnableVAD()
// Enable VAD.
//
- // Return value : 0 if ok.
- // -1 if an error occurred.
+ // Return value : 0 if ok.
+ // -1 if an error occurred.
//
WebRtc_Word16 EnableVAD();
WebRtc_Word16 EnableVADByIdxSafe(const WebRtc_Word16 idx);
WebRtc_Word16 AllocatePacketBufferByIdxSafe(
- const WebRtcNetEQDecoder* usedCodecs,
- WebRtc_Word16 noOfCodecs,
+ const WebRtcNetEQDecoder* used_codecs,
+ WebRtc_Word16 num_codecs,
const WebRtc_Word16 idx);
// Delete the NetEQ corresponding to |index|.
@@ -314,32 +315,32 @@
void RemoveSlavesSafe();
- void* _inst[MAX_NUM_SLAVE_NETEQ + 1];
- void* _instMem[MAX_NUM_SLAVE_NETEQ + 1];
+ void* inst_[MAX_NUM_SLAVE_NETEQ + 1];
+ void* inst_mem_[MAX_NUM_SLAVE_NETEQ + 1];
- WebRtc_Word16* _netEqPacketBuffer[MAX_NUM_SLAVE_NETEQ + 1];
+ WebRtc_Word16* neteq_packet_buffer_[MAX_NUM_SLAVE_NETEQ + 1];
- WebRtc_Word32 _id;
- float _currentSampFreqKHz;
- bool _avtPlayout;
- AudioPlayoutMode _playoutMode;
- CriticalSectionWrapper* _netEqCritSect;
+ WebRtc_Word32 id_;
+ float current_samp_freq_khz_;
+ bool avt_playout_;
+ AudioPlayoutMode playout_mode_;
+ CriticalSectionWrapper* neteq_crit_sect_;
- WebRtcVadInst* _ptrVADInst[MAX_NUM_SLAVE_NETEQ + 1];
+ WebRtcVadInst* ptr_vadinst_[MAX_NUM_SLAVE_NETEQ + 1];
- bool _vadStatus;
- ACMVADMode _vadMode;
- RWLockWrapper* _decodeLock;
- bool _isInitialized[MAX_NUM_SLAVE_NETEQ + 1];
- WebRtc_UWord8 _numSlaves;
- bool _receivedStereo;
- void* _masterSlaveInfo;
- AudioFrame::VADActivity _previousAudioActivity;
- WebRtc_Word32 _extraDelay;
+ bool vad_status_;
+ ACMVADMode vad_mode_;
+ RWLockWrapper* decode_lock_;
+ bool is_initialized_[MAX_NUM_SLAVE_NETEQ + 1];
+ WebRtc_UWord8 num_slaves_;
+ bool received_stereo_;
+ void* master_slave_info_;
+ AudioFrame::VADActivity previous_audio_activity_;
+ WebRtc_Word32 extra_delay_;
- CriticalSectionWrapper* _callbackCritSect;
+ CriticalSectionWrapper* callback_crit_sect_;
};
-} //namespace webrtc
+} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_NETEQ_H_
diff --git a/webrtc/modules/audio_coding/main/source/acm_neteq_unittest.cc b/webrtc/modules/audio_coding/main/source/acm_neteq_unittest.cc
index 8f73592..d7f3f83 100644
--- a/webrtc/modules/audio_coding/main/source/acm_neteq_unittest.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_neteq_unittest.cc
@@ -10,16 +10,17 @@
// This file contains unit tests for ACM's NetEQ wrapper (class ACMNetEQ).
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+
#include <stdlib.h>
#include "gtest/gtest.h"
-#include "modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
-#include "modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
-#include "modules/audio_coding/main/source/acm_codec_database.h"
-#include "modules/audio_coding/main/source/acm_neteq.h"
-#include "modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
-#include "modules/interface/module_common_types.h"
-#include "typedefs.h" // NOLINT(build/include)
+#include "webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/typedefs.h"
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/main/source/acm_opus.cc b/webrtc/modules/audio_coding/main/source/acm_opus.cc
index 4e9e5a2..83c5694 100644
--- a/webrtc/modules/audio_coding/main/source/acm_opus.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_opus.cc
@@ -8,29 +8,29 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_opus.h"
+#include "webrtc/modules/audio_coding/main/source/acm_opus.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_OPUS
-#include "modules/audio_coding/codecs/opus/interface/opus_interface.h"
+#include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h"
#endif
namespace webrtc {
#ifndef WEBRTC_CODEC_OPUS
-ACMOpus::ACMOpus(int16_t /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _sampleFreq(0),
- _bitrate(0),
- _channels(1) {
+ACMOpus::ACMOpus(int16_t /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ sample_freq_(0),
+ bitrate_(0),
+ channels_(1) {
return;
}
@@ -38,29 +38,29 @@
return;
}
-int16_t ACMOpus::InternalEncode(uint8_t* /* bitStream */,
- int16_t* /* bitStreamLenByte */) {
+int16_t ACMOpus::InternalEncode(uint8_t* /* bitstream */,
+ int16_t* /* bitstream_len_byte */) {
return -1;
}
-int16_t ACMOpus::DecodeSafe(uint8_t* /* bitStream */,
- int16_t /* bitStreamLenByte */,
+int16_t ACMOpus::DecodeSafe(uint8_t* /* bitstream */,
+ int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
- int16_t* /* audioSamples */,
- int8_t* /* speechType */) {
+ int16_t* /* audio_samples */,
+ int8_t* /* speech_type */) {
return -1;
}
-int16_t ACMOpus::InternalInitEncoder(WebRtcACMCodecParams* /* codecParams */) {
+int16_t ACMOpus::InternalInitEncoder(WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-int16_t ACMOpus::InternalInitDecoder(WebRtcACMCodecParams* /* codecParams */) {
+int16_t ACMOpus::InternalInitDecoder(WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-int32_t ACMOpus::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+int32_t ACMOpus::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -84,7 +84,7 @@
return;
}
-void ACMOpus::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMOpus::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -101,119 +101,120 @@
#else //===================== Actual Implementation =======================
-ACMOpus::ACMOpus(int16_t codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _sampleFreq(32000), // Default sampling frequency.
- _bitrate(20000), // Default bit-rate.
- _channels(1) { // Default mono
- _codecID = codecID;
+ACMOpus::ACMOpus(int16_t codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ sample_freq_(32000), // Default sampling frequency.
+ bitrate_(20000), // Default bit-rate.
+ channels_(1) { // Default mono
+ codec_id_ = codec_id;
// Opus has internal DTX, but we dont use it for now.
- _hasInternalDTX = false;
+ has_internal_dtx_ = false;
- if (_codecID != ACMCodecDB::kOpus) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (codec_id_ != ACMCodecDB::kOpus) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Wrong codec id for Opus.");
- _sampleFreq = -1;
- _bitrate = -1;
+ sample_freq_ = -1;
+ bitrate_ = -1;
}
return;
}
ACMOpus::~ACMOpus() {
- if (_encoderInstPtr != NULL) {
- WebRtcOpus_EncoderFree(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcOpus_EncoderFree(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcOpus_DecoderFree(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcOpus_DecoderFree(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-int16_t ACMOpus::InternalEncode(uint8_t* bitStream, int16_t* bitStreamLenByte) {
+int16_t ACMOpus::InternalEncode(uint8_t* bitstream,
+ int16_t* bitstream_len_byte) {
// Call Encoder.
- *bitStreamLenByte = WebRtcOpus_Encode(_encoderInstPtr,
- &_inAudio[_inAudioIxRead],
- _frameLenSmpl,
- MAX_PAYLOAD_SIZE_BYTE,
- bitStream);
+ *bitstream_len_byte = WebRtcOpus_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_,
+ MAX_PAYLOAD_SIZE_BYTE, bitstream);
// Check for error reported from encoder.
- if (*bitStreamLenByte < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (*bitstream_len_byte < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: Encode error for Opus");
- *bitStreamLenByte = 0;
+ *bitstream_len_byte = 0;
return -1;
}
// Increment the read index. This tells the caller how far
// we have gone forward in reading the audio buffer.
- _inAudioIxRead += _frameLenSmpl * _channels;
+ in_audio_ix_read_ += frame_len_smpl_ * channels_;
- return *bitStreamLenByte;
+ return *bitstream_len_byte;
}
-int16_t ACMOpus::DecodeSafe(uint8_t* bitStream, int16_t bitStreamLenByte,
- int16_t* audio, int16_t* audioSamples,
- int8_t* speechType) {
+int16_t ACMOpus::DecodeSafe(uint8_t* bitstream, int16_t bitstream_len_byte,
+ int16_t* audio, int16_t* audio_samples,
+ int8_t* speech_type) {
return 0;
}
-int16_t ACMOpus::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+int16_t ACMOpus::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t ret;
- if (_encoderInstPtr != NULL) {
- WebRtcOpus_EncoderFree(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcOpus_EncoderFree(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- ret = WebRtcOpus_EncoderCreate(&_encoderInstPtr,
- codecParams->codecInstant.channels);
+ ret = WebRtcOpus_EncoderCreate(&encoder_inst_ptr_,
+ codec_params->codec_inst.channels);
// Store number of channels.
- _channels = codecParams->codecInstant.channels;
+ channels_ = codec_params->codec_inst.channels;
if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Encoder creation failed for Opus");
return ret;
}
- ret = WebRtcOpus_SetBitRate(_encoderInstPtr, codecParams->codecInstant.rate);
+ ret = WebRtcOpus_SetBitRate(encoder_inst_ptr_,
+ codec_params->codec_inst.rate);
if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Setting initial bitrate failed for Opus");
return ret;
}
// Store bitrate.
- _bitrate = codecParams->codecInstant.rate;
+ bitrate_ = codec_params->codec_inst.rate;
return 0;
}
-int16_t ACMOpus::InternalInitDecoder(WebRtcACMCodecParams* codecParams) {
- if(_decoderInstPtr == NULL) {
- if (WebRtcOpus_DecoderCreate(&_decoderInstPtr,
- codecParams->codecInstant.channels) < 0) {
+int16_t ACMOpus::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
+ if (decoder_inst_ptr_ == NULL) {
+ if (WebRtcOpus_DecoderCreate(&decoder_inst_ptr_,
+ codec_params->codec_inst.channels) < 0) {
return -1;
}
}
- // Number of channels in decoder should match the number in |codecParams|.
- assert(codecParams->codecInstant.channels ==
- WebRtcOpus_DecoderChannels(_decoderInstPtr));
+ // Number of channels in decoder should match the number in |codec_params|.
+ assert(codec_params->codec_inst.channels ==
+ WebRtcOpus_DecoderChannels(decoder_inst_ptr_));
- if (WebRtcOpus_DecoderInit(_decoderInstPtr) < 0) {
+ if (WebRtcOpus_DecoderInit(decoder_inst_ptr_) < 0) {
return -1;
}
- if (WebRtcOpus_DecoderInitSlave(_decoderInstPtr) < 0) {
+ if (WebRtcOpus_DecoderInitSlave(decoder_inst_ptr_) < 0) {
return -1;
}
return 0;
}
-int32_t ACMOpus::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+int32_t ACMOpus::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: Decoder uninitialized for Opus");
return -1;
}
@@ -223,21 +224,20 @@
// TODO(tlegrand): Decoder is registered in NetEQ as a 32 kHz decoder, which
// is true until we have a full 48 kHz system, and remove the downsampling
// in the Opus decoder wrapper.
- SET_CODEC_PAR(codecDef, kDecoderOpus, codecInst.pltype,
- _decoderInstPtr, 32000);
+ SET_CODEC_PAR(codec_def, kDecoderOpus, codec_inst.pltype,
+ decoder_inst_ptr_, 32000);
// If this is the master of NetEQ, regular decoder will be added, otherwise
// the slave decoder will be used.
- if (_isMaster) {
- SET_OPUS_FUNCTIONS(codecDef);
+ if (is_master_) {
+ SET_OPUS_FUNCTIONS(codec_def);
} else {
- SET_OPUSSLAVE_FUNCTIONS(codecDef);
+ SET_OPUSSLAVE_FUNCTIONS(codec_def);
}
return 0;
}
-
ACMGenericCodec* ACMOpus::CreateInstance(void) {
return NULL;
}
@@ -248,9 +248,9 @@
}
void ACMOpus::DestructEncoderSafe() {
- if (_encoderInstPtr) {
- WebRtcOpus_EncoderFree(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_) {
+ WebRtcOpus_EncoderFree(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
}
@@ -260,32 +260,32 @@
}
void ACMOpus::DestructDecoderSafe() {
- _decoderInitialized = false;
- if (_decoderInstPtr) {
- WebRtcOpus_DecoderFree(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ decoder_initialized_ = false;
+ if (decoder_inst_ptr_) {
+ WebRtcOpus_DecoderFree(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
}
-void ACMOpus::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcOpus_EncoderFree((OpusEncInst*) ptrInst);
+void ACMOpus::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcOpus_EncoderFree((OpusEncInst*) ptr_inst);
}
return;
}
int16_t ACMOpus::SetBitRateSafe(const int32_t rate) {
if (rate < 6000 || rate > 510000) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"SetBitRateSafe: Invalid rate Opus");
return -1;
}
- _bitrate = rate;
+ bitrate_ = rate;
// Ask the encoder for the new rate.
- if (WebRtcOpus_SetBitRate(_encoderInstPtr, _bitrate) >= 0) {
- _encoderParams.codecInstant.rate = _bitrate;
+ if (WebRtcOpus_SetBitRate(encoder_inst_ptr_, bitrate_) >= 0) {
+ encoder_params_.codec_inst.rate = bitrate_;
return 0;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_opus.h b/webrtc/modules/audio_coding/main/source/acm_opus.h
index 34cd376..bd8ff32 100644
--- a/webrtc/modules/audio_coding/main/source/acm_opus.h
+++ b/webrtc/modules/audio_coding/main/source/acm_opus.h
@@ -11,8 +11,8 @@
#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"
-#include "resampler.h"
+#include "webrtc/common_audio/resampler/include/resampler.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
struct WebRtcOpusEncInst;
struct WebRtcOpusDecInst;
@@ -21,22 +21,26 @@
class ACMOpus : public ACMGenericCodec {
public:
- ACMOpus(int16_t codecID);
+ explicit ACMOpus(int16_t codec_id);
~ACMOpus();
ACMGenericCodec* CreateInstance(void);
- int16_t InternalEncode(uint8_t* bitstream, int16_t* bitStreamLenByte);
+ int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
- int16_t InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- int16_t InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- int16_t DecodeSafe(uint8_t* bitStream, int16_t bitStreamLenByte,
- int16_t* audio, int16_t* audioSamples, int8_t* speechType);
+ int16_t DecodeSafe(uint8_t* bitstream,
+ int16_t bitstream_len_byte,
+ int16_t* audio,
+ int16_t* audio_samples,
+ int8_t* speech_type);
- int32_t CodecDef(WebRtcNetEQ_CodecDef& codecDef, const CodecInst& codecInst);
+ int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -46,7 +50,7 @@
int16_t InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
int16_t SetBitRateSafe(const int32_t rate);
@@ -54,11 +58,11 @@
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
- WebRtcOpusEncInst* _encoderInstPtr;
- WebRtcOpusDecInst* _decoderInstPtr;
- uint16_t _sampleFreq;
- uint16_t _bitrate;
- int _channels;
+ WebRtcOpusEncInst* encoder_inst_ptr_;
+ WebRtcOpusDecInst* decoder_inst_ptr_;
+ uint16_t sample_freq_;
+ uint16_t bitrate_;
+ int channels_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcm16b.cc b/webrtc/modules/audio_coding/main/source/acm_pcm16b.cc
index 4e88743..f341295 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcm16b.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_pcm16b.cc
@@ -8,24 +8,24 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_pcm16b.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcm16b.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_PCM16
-#include "pcm16b.h"
+#include "webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
#endif
namespace webrtc {
#ifndef WEBRTC_CODEC_PCM16
-ACMPCM16B::ACMPCM16B(WebRtc_Word16 /* codecID */) {
+ACMPCM16B::ACMPCM16B(WebRtc_Word16 /* codec_id */) {
return;
}
@@ -33,31 +33,32 @@
return;
}
-WebRtc_Word16 ACMPCM16B::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMPCM16B::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMPCM16B::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMPCM16B::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -73,7 +74,7 @@
return -1;
}
-void ACMPCM16B::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMPCM16B::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -90,67 +91,67 @@
}
#else //===================== Actual Implementation =======================
-ACMPCM16B::ACMPCM16B(WebRtc_Word16 codecID) {
- _codecID = codecID;
- _samplingFreqHz = ACMCodecDB::CodecFreq(_codecID);
+ACMPCM16B::ACMPCM16B(WebRtc_Word16 codec_id) {
+ codec_id_ = codec_id;
+ sampling_freq_hz_ = ACMCodecDB::CodecFreq(codec_id_);
}
ACMPCM16B::~ACMPCM16B() {
return;
}
-WebRtc_Word16 ACMPCM16B::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- *bitStreamLenByte = WebRtcPcm16b_Encode(&_inAudio[_inAudioIxRead],
- _frameLenSmpl * _noChannels,
- bitStream);
+WebRtc_Word16 ACMPCM16B::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ *bitstream_len_byte = WebRtcPcm16b_Encode(&in_audio_[in_audio_ix_read_],
+ frame_len_smpl_ * num_channels_,
+ bitstream);
// Increment the read index to tell the caller that how far
// we have gone forward in reading the audio buffer.
- _inAudioIxRead += _frameLenSmpl * _noChannels;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCM16B::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCM16B::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
-WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
+WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
// Fill up the structure by calling "SET_CODEC_PAR" & "SET_PCMU_FUNCTION".
// Then call NetEQ to add the codec to it's database.
- if (codecInst.channels == 1) {
- switch(_samplingFreqHz) {
+ if (codec_inst.channels == 1) {
+ switch (sampling_freq_hz_) {
case 8000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16B, codecInst.pltype, NULL, 8000);
- SET_PCM16B_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16B, codec_inst.pltype, NULL, 8000);
+ SET_PCM16B_FUNCTIONS(codec_def);
break;
}
case 16000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16Bwb, codecInst.pltype, NULL,
- 16000);
- SET_PCM16B_WB_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16Bwb, codec_inst.pltype, NULL,
+ 16000);
+ SET_PCM16B_WB_FUNCTIONS(codec_def);
break;
}
case 32000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16Bswb32kHz, codecInst.pltype,
- NULL, 32000);
- SET_PCM16B_SWB32_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16Bswb32kHz, codec_inst.pltype,
+ NULL, 32000);
+ SET_PCM16B_SWB32_FUNCTIONS(codec_def);
break;
}
default: {
@@ -158,23 +159,23 @@
}
}
} else {
- switch(_samplingFreqHz) {
+ switch (sampling_freq_hz_) {
case 8000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16B_2ch, codecInst.pltype, NULL,
- 8000);
- SET_PCM16B_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16B_2ch, codec_inst.pltype, NULL,
+ 8000);
+ SET_PCM16B_FUNCTIONS(codec_def);
break;
}
case 16000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16Bwb_2ch, codecInst.pltype,
- NULL, 16000);
- SET_PCM16B_WB_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16Bwb_2ch, codec_inst.pltype,
+ NULL, 16000);
+ SET_PCM16B_WB_FUNCTIONS(codec_def);
break;
}
case 32000: {
- SET_CODEC_PAR(codecDef, kDecoderPCM16Bswb32kHz_2ch, codecInst.pltype,
- NULL, 32000);
- SET_PCM16B_SWB32_FUNCTIONS(codecDef);
+ SET_CODEC_PAR(codec_def, kDecoderPCM16Bswb32kHz_2ch, codec_inst.pltype,
+ NULL, 32000);
+ SET_PCM16B_SWB32_FUNCTIONS(codec_def);
break;
}
default: {
@@ -199,22 +200,22 @@
return 0;
}
-void ACMPCM16B::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMPCM16B::InternalDestructEncoderInst(void* /* ptr_inst */) {
// PCM has no instance.
return;
}
void ACMPCM16B::DestructEncoderSafe() {
// PCM has no instance.
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
return;
}
void ACMPCM16B::DestructDecoderSafe() {
// PCM has no instance.
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcm16b.h b/webrtc/modules/audio_coding/main/source/acm_pcm16b.h
index cd81070..314e3bb 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcm16b.h
+++ b/webrtc/modules/audio_coding/main/source/acm_pcm16b.h
@@ -11,33 +11,34 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
class ACMPCM16B : public ACMGenericCodec {
public:
- ACMPCM16B(WebRtc_Word16 codecID);
+ explicit ACMPCM16B(WebRtc_Word16 codec_id);
~ACMPCM16B();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -47,11 +48,11 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
- WebRtc_Word32 _samplingFreqHz;
+ WebRtc_Word32 sampling_freq_hz_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcma.cc b/webrtc/modules/audio_coding/main/source/acm_pcma.cc
index 867f543..24a6fe2 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcma.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_pcma.cc
@@ -8,71 +8,71 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_pcma.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcma.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
// Codec interface
-#include "g711_interface.h"
namespace webrtc {
-ACMPCMA::ACMPCMA(WebRtc_Word16 codecID) {
- _codecID = codecID;
+ACMPCMA::ACMPCMA(WebRtc_Word16 codec_id) {
+ codec_id_ = codec_id;
}
ACMPCMA::~ACMPCMA() {
return;
}
-WebRtc_Word16 ACMPCMA::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- *bitStreamLenByte = WebRtcG711_EncodeA(NULL, &_inAudio[_inAudioIxRead],
- _frameLenSmpl * _noChannels,
- (WebRtc_Word16*) bitStream);
+WebRtc_Word16 ACMPCMA::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ *bitstream_len_byte = WebRtcG711_EncodeA(NULL, &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_ * num_channels_,
+ (WebRtc_Word16*) bitstream);
// Increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer.
- _inAudioIxRead += _frameLenSmpl * _noChannels;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMPCMA::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMPCMA::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCMA::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMA::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
-WebRtc_Word32 ACMPCMA::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
+WebRtc_Word32 ACMPCMA::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_PCMA_FUNCTION."
// Then call NetEQ to add the codec to it's database.
- if (codecInst.channels == 1) {
+ if (codec_inst.channels == 1) {
// Mono mode.
- SET_CODEC_PAR(codecDef, kDecoderPCMa, codecInst.pltype, NULL, 8000);
+ SET_CODEC_PAR(codec_def, kDecoderPCMa, codec_inst.pltype, NULL, 8000);
} else {
// Stereo mode.
- SET_CODEC_PAR(codecDef, kDecoderPCMa_2ch, codecInst.pltype, NULL, 8000);
+ SET_CODEC_PAR(codec_def, kDecoderPCMa_2ch, codec_inst.pltype, NULL, 8000);
}
- SET_PCMA_FUNCTIONS(codecDef);
+ SET_PCMA_FUNCTIONS(codec_def);
return 0;
}
@@ -90,7 +90,7 @@
return 0;
}
-void ACMPCMA::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMPCMA::InternalDestructEncoderInst(void* /* ptr_inst */) {
// PCM has no instance.
return;
}
@@ -102,8 +102,8 @@
void ACMPCMA::DestructDecoderSafe() {
// PCM has no instance.
- _decoderInitialized = false;
- _decoderExist = false;
+ decoder_initialized_ = false;
+ decoder_exist_ = false;
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcma.h b/webrtc/modules/audio_coding/main/source/acm_pcma.h
index 56dac16..cf12dca 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcma.h
+++ b/webrtc/modules/audio_coding/main/source/acm_pcma.h
@@ -11,33 +11,34 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
class ACMPCMA : public ACMGenericCodec {
public:
- ACMPCMA(WebRtc_Word16 codecID);
+ explicit ACMPCMA(WebRtc_Word16 codec_id);
~ACMPCMA();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -47,7 +48,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
};
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcmu.cc b/webrtc/modules/audio_coding/main/source/acm_pcmu.cc
index 92f7f5c..919826d 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcmu.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_pcmu.cc
@@ -8,71 +8,71 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_pcmu.h"
+#include "webrtc/modules/audio_coding/main/source/acm_pcmu.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
// Codec interface
-#include "g711_interface.h"
namespace webrtc {
-ACMPCMU::ACMPCMU(WebRtc_Word16 codecID) {
- _codecID = codecID;
+ACMPCMU::ACMPCMU(WebRtc_Word16 codec_id) {
+ codec_id_ = codec_id;
}
ACMPCMU::~ACMPCMU() {
return;
}
-WebRtc_Word16 ACMPCMU::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
- *bitStreamLenByte = WebRtcG711_EncodeU(NULL, &_inAudio[_inAudioIxRead],
- _frameLenSmpl * _noChannels,
- (WebRtc_Word16*) bitStream);
+WebRtc_Word16 ACMPCMU::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
+ *bitstream_len_byte = WebRtcG711_EncodeU(NULL, &in_audio_[in_audio_ix_read_],
+ frame_len_smpl_ * num_channels_,
+ (WebRtc_Word16*)bitstream);
// Increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer.
- _inAudioIxRead += _frameLenSmpl * _noChannels;
- return *bitStreamLenByte;
+ in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMPCMU::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMPCMU::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCMU::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMU::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
-WebRtc_Word32 ACMPCMU::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
+WebRtc_Word32 ACMPCMU::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_PCMU_FUNCTION."
// Then call NetEQ to add the codec to it's database.
- if (codecInst.channels == 1) {
+ if (codec_inst.channels == 1) {
// Mono mode.
- SET_CODEC_PAR(codecDef, kDecoderPCMu, codecInst.pltype, NULL, 8000);
+ SET_CODEC_PAR(codec_def, kDecoderPCMu, codec_inst.pltype, NULL, 8000);
} else {
// Stereo mode.
- SET_CODEC_PAR(codecDef, kDecoderPCMu_2ch, codecInst.pltype, NULL, 8000);
+ SET_CODEC_PAR(codec_def, kDecoderPCMu_2ch, codec_inst.pltype, NULL, 8000);
}
- SET_PCMU_FUNCTIONS(codecDef);
+ SET_PCMU_FUNCTIONS(codec_def);
return 0;
}
@@ -90,22 +90,22 @@
return 0;
}
-void ACMPCMU::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMPCMU::InternalDestructEncoderInst(void* /* ptr_inst */) {
// PCM has no instance.
return;
}
void ACMPCMU::DestructEncoderSafe() {
// PCM has no instance.
- _encoderExist = false;
- _encoderInitialized = false;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
return;
}
void ACMPCMU::DestructDecoderSafe() {
// PCM has no instance.
- _decoderInitialized = false;
- _decoderExist = false;
+ decoder_initialized_ = false;
+ decoder_exist_ = false;
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_pcmu.h b/webrtc/modules/audio_coding/main/source/acm_pcmu.h
index c8b999a..f75e7aa 100644
--- a/webrtc/modules/audio_coding/main/source/acm_pcmu.h
+++ b/webrtc/modules/audio_coding/main/source/acm_pcmu.h
@@ -11,33 +11,34 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
class ACMPCMU : public ACMGenericCodec {
public:
- ACMPCMU(WebRtc_Word16 codecID);
+ explicit ACMPCMU(WebRtc_Word16 codec_id);
~ACMPCMU();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -47,7 +48,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
};
diff --git a/webrtc/modules/audio_coding/main/source/acm_red.cc b/webrtc/modules/audio_coding/main/source/acm_red.cc
index cad985e..a249449 100644
--- a/webrtc/modules/audio_coding/main/source/acm_red.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_red.cc
@@ -8,55 +8,56 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_red.h"
-#include "acm_neteq.h"
-#include "acm_common_defs.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_red.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
-ACMRED::ACMRED(WebRtc_Word16 codecID) {
- _codecID = codecID;
+ACMRED::ACMRED(WebRtc_Word16 codec_id) {
+ codec_id_ = codec_id;
}
ACMRED::~ACMRED() {
return;
}
-WebRtc_Word16 ACMRED::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMRED::InternalEncode(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
// RED is never used as an encoder
// RED has no instance
return 0;
}
-WebRtc_Word16 ACMRED::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMRED::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMRED::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// RED has no instance
return 0;
}
WebRtc_Word16 ACMRED::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// RED has no instance
return 0;
}
-WebRtc_Word32 ACMRED::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
+WebRtc_Word32 ACMRED::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
// Todo:
// log error
return -1;
@@ -66,8 +67,8 @@
// "SET_CODEC_PAR" & "SET_PCMU_FUNCTION."
// Then call NetEQ to add the codec to it's
// database.
- SET_CODEC_PAR((codecDef), kDecoderRED, codecInst.pltype, NULL, 8000);
- SET_RED_FUNCTIONS((codecDef));
+ SET_CODEC_PAR((codec_def), kDecoderRED, codec_inst.pltype, NULL, 8000);
+ SET_RED_FUNCTIONS((codec_def));
return 0;
}
@@ -85,7 +86,7 @@
return 0;
}
-void ACMRED::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMRED::InternalDestructEncoderInst(void* /* ptr_inst */) {
// RED has no instance
return;
}
diff --git a/webrtc/modules/audio_coding/main/source/acm_red.h b/webrtc/modules/audio_coding/main/source/acm_red.h
index 1e07823..5f4cb9b 100644
--- a/webrtc/modules/audio_coding/main/source/acm_red.h
+++ b/webrtc/modules/audio_coding/main/source/acm_red.h
@@ -11,33 +11,34 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
namespace webrtc {
class ACMRED : public ACMGenericCodec {
public:
- ACMRED(WebRtc_Word16 codecID);
+ explicit ACMRED(WebRtc_Word16 codec_id);
~ACMRED();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -47,7 +48,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_resampler.cc b/webrtc/modules/audio_coding/main/source/acm_resampler.cc
index f8965ce..a776052 100644
--- a/webrtc/modules/audio_coding/main/source/acm_resampler.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_resampler.cc
@@ -8,65 +8,66 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/modules/audio_coding/main/source/acm_resampler.h"
+
#include <string.h>
-#include "acm_resampler.h"
-
-#include "critical_section_wrapper.h"
-#include "resampler.h"
-#include "signal_processing_library.h"
-#include "trace.h"
+#include "webrtc/common_audio/resampler/include/resampler.h"
+#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
ACMResampler::ACMResampler()
- : _resamplerCritSect(CriticalSectionWrapper::CreateCriticalSection()) {
+ : resampler_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()) {
}
ACMResampler::~ACMResampler() {
- delete _resamplerCritSect;
+ delete resampler_crit_sect_;
}
-WebRtc_Word16 ACMResampler::Resample10Msec(const WebRtc_Word16* inAudio,
- WebRtc_Word32 inFreqHz,
- WebRtc_Word16* outAudio,
- WebRtc_Word32 outFreqHz,
- WebRtc_UWord8 numAudioChannels) {
- CriticalSectionScoped cs(_resamplerCritSect);
+WebRtc_Word16 ACMResampler::Resample10Msec(const WebRtc_Word16* in_audio,
+ WebRtc_Word32 in_freq_hz,
+ WebRtc_Word16* out_audio,
+ WebRtc_Word32 out_freq_hz,
+ WebRtc_UWord8 num_audio_channels) {
+ CriticalSectionScoped cs(resampler_crit_sect_);
- if (inFreqHz == outFreqHz) {
- size_t length = static_cast<size_t>(inFreqHz * numAudioChannels / 100);
- memcpy(outAudio, inAudio, length * sizeof(WebRtc_Word16));
- return static_cast<WebRtc_Word16>(inFreqHz / 100);
+ if (in_freq_hz == out_freq_hz) {
+ size_t length = static_cast<size_t>(in_freq_hz * num_audio_channels / 100);
+ memcpy(out_audio, in_audio, length * sizeof(WebRtc_Word16));
+ return static_cast<WebRtc_Word16>(in_freq_hz / 100);
}
// |maxLen| is maximum number of samples for 10ms at 48kHz.
- int maxLen = 480 * numAudioChannels;
- int lengthIn = (WebRtc_Word16)(inFreqHz / 100) * numAudioChannels;
- int outLen;
+ int max_len = 480 * num_audio_channels;
+ int length_in = (WebRtc_Word16)(in_freq_hz / 100) * num_audio_channels;
+ int out_len;
WebRtc_Word32 ret;
ResamplerType type;
- type = (numAudioChannels == 1) ? kResamplerSynchronous :
+ type = (num_audio_channels == 1) ? kResamplerSynchronous :
kResamplerSynchronousStereo;
- ret = _resampler.ResetIfNeeded(inFreqHz, outFreqHz, type);
+ ret = resampler_.ResetIfNeeded(in_freq_hz, out_freq_hz, type);
if (ret < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0,
"Error in reset of resampler");
return -1;
}
- ret = _resampler.Push(inAudio, lengthIn, outAudio, maxLen, outLen);
+ ret = resampler_.Push(in_audio, length_in, out_audio, max_len, out_len);
if (ret < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0,
"Error in resampler: resampler.Push");
return -1;
}
- WebRtc_Word16 outAudioLenSmpl = (WebRtc_Word16) outLen / numAudioChannels;
+ WebRtc_Word16 out_audio_len_smpl = (WebRtc_Word16) out_len /
+ num_audio_channels;
- return outAudioLenSmpl;
+ return out_audio_len_smpl;
}
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_resampler.h b/webrtc/modules/audio_coding/main/source/acm_resampler.h
index 1586f02..aacd222 100644
--- a/webrtc/modules/audio_coding/main/source/acm_resampler.h
+++ b/webrtc/modules/audio_coding/main/source/acm_resampler.h
@@ -11,8 +11,8 @@
#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"
+#include "webrtc/common_audio/resampler/include/resampler.h"
+#include "webrtc/typedefs.h"
namespace webrtc {
@@ -23,16 +23,16 @@
ACMResampler();
~ACMResampler();
- WebRtc_Word16 Resample10Msec(const WebRtc_Word16* inAudio,
- const WebRtc_Word32 inFreqHz,
- WebRtc_Word16* outAudio,
- const WebRtc_Word32 outFreqHz,
- WebRtc_UWord8 numAudioChannels);
+ WebRtc_Word16 Resample10Msec(const WebRtc_Word16* in_audio,
+ const WebRtc_Word32 in_freq_hz,
+ WebRtc_Word16* out_audio,
+ const WebRtc_Word32 out_freq_hz,
+ WebRtc_UWord8 num_audio_channels);
private:
// Use the Resampler class.
- Resampler _resampler;
- CriticalSectionWrapper* _resamplerCritSect;
+ Resampler resampler_;
+ CriticalSectionWrapper* resampler_crit_sect_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/acm_speex.cc b/webrtc/modules/audio_coding/main/source/acm_speex.cc
index ae5f366..73ab7fc 100644
--- a/webrtc/modules/audio_coding/main/source/acm_speex.cc
+++ b/webrtc/modules/audio_coding/main/source/acm_speex.cc
@@ -8,13 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_speex.h"
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_neteq.h"
-#include "trace.h"
-#include "webrtc_neteq.h"
-#include "webrtc_neteq_help_macros.h"
+#include "webrtc/modules/audio_coding/main/source/acm_speex.h"
+
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
+#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"
+#include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_CODEC_SPEEX
// NOTE! Speex is not included in the open-source package. Modify this file or
@@ -25,14 +26,14 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_SPEEX
-ACMSPEEX::ACMSPEEX(WebRtc_Word16 /* codecID */)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL),
- _complMode(0),
- _vbrEnabled(false),
- _encodingRate(-1),
- _samplingFrequency(-1),
- _samplesIn20MsAudio(-1) {
+ACMSPEEX::ACMSPEEX(WebRtc_Word16 /* codec_id */)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL),
+ compl_mode_(0),
+ vbr_enabled_(false),
+ encoding_rate_(-1),
+ sampling_frequency_(-1),
+ samples_in_20ms_audio_(-1) {
return;
}
@@ -40,16 +41,17 @@
return;
}
-WebRtc_Word16 ACMSPEEX::InternalEncode(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16* /* bitStreamLenByte */) {
+WebRtc_Word16 ACMSPEEX::InternalEncode(
+ WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16* /* bitstream_len_byte */) {
return -1;
}
-WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return -1;
}
@@ -62,17 +64,17 @@
}
WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMSPEEX::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
-WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& /* codecDef */,
- const CodecInst& /* codecInst */) {
+WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
+ const CodecInst& /* codec_inst */) {
return -1;
}
@@ -100,7 +102,7 @@
return -1;
}
-void ACMSPEEX::InternalDestructEncoderInst(void* /* ptrInst */) {
+void ACMSPEEX::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
@@ -120,111 +122,110 @@
#else //===================== Actual Implementation =======================
-ACMSPEEX::ACMSPEEX(WebRtc_Word16 codecID)
- : _encoderInstPtr(NULL),
- _decoderInstPtr(NULL) {
- _codecID = codecID;
+ACMSPEEX::ACMSPEEX(WebRtc_Word16 codec_id)
+ : encoder_inst_ptr_(NULL),
+ decoder_inst_ptr_(NULL) {
+ codec_id_ = codec_id;
// Set sampling frequency, frame size and rate Speex
- if (_codecID == ACMCodecDB::kSPEEX8) {
- _samplingFrequency = 8000;
- _samplesIn20MsAudio = 160;
- _encodingRate = 11000;
- } else if (_codecID == ACMCodecDB::kSPEEX16) {
- _samplingFrequency = 16000;
- _samplesIn20MsAudio = 320;
- _encodingRate = 22000;
+ if (codec_id_ == ACMCodecDB::kSPEEX8) {
+ sampling_frequency_ = 8000;
+ samples_in_20ms_audio_ = 160;
+ encoding_rate_ = 11000;
+ } else if (codec_id_ == ACMCodecDB::kSPEEX16) {
+ sampling_frequency_ = 16000;
+ samples_in_20ms_audio_ = 320;
+ encoding_rate_ = 22000;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Wrong codec id for Speex.");
- _samplingFrequency = -1;
- _samplesIn20MsAudio = -1;
- _encodingRate = -1;
+ sampling_frequency_ = -1;
+ samples_in_20ms_audio_ = -1;
+ encoding_rate_ = -1;
}
- _hasInternalDTX = true;
- _dtxEnabled = false;
- _vbrEnabled = false;
- _complMode = 3; // default complexity value
+ has_internal_dtx_ = true;
+ dtx_enabled_ = false;
+ vbr_enabled_ = false;
+ compl_mode_ = 3; // default complexity value
return;
}
ACMSPEEX::~ACMSPEEX() {
- if (_encoderInstPtr != NULL) {
- WebRtcSpeex_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcSpeex_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
- if (_decoderInstPtr != NULL) {
- WebRtcSpeex_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcSpeex_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
return;
}
-WebRtc_Word16 ACMSPEEX::InternalEncode(WebRtc_UWord8* bitStream,
- WebRtc_Word16* bitStreamLenByte) {
+WebRtc_Word16 ACMSPEEX::InternalEncode(WebRtc_UWord8* bitstream,
+ WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 status;
- WebRtc_Word16 numEncodedSamples = 0;
+ WebRtc_Word16 num_encoded_samples = 0;
WebRtc_Word16 n = 0;
- while (numEncodedSamples < _frameLenSmpl) {
- status = WebRtcSpeex_Encode(_encoderInstPtr, &_inAudio[_inAudioIxRead],
- _encodingRate);
+ while (num_encoded_samples < frame_len_smpl_) {
+ status = WebRtcSpeex_Encode(encoder_inst_ptr_,
+ &in_audio_[in_audio_ix_read_], encoding_rate_);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
- _inAudioIxRead += _samplesIn20MsAudio;
- numEncodedSamples += _samplesIn20MsAudio;
+ in_audio_ix_read_ += samples_in_20ms_audio_;
+ num_encoded_samples += samples_in_20ms_audio_;
if (status < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error in Speex encoder");
return status;
}
// Update VAD, if internal DTX is used
- if (_hasInternalDTX && _dtxEnabled) {
- _vadLabel[n++] = status;
- _vadLabel[n++] = status;
+ if (has_internal_dtx_ && dtx_enabled_) {
+ vad_label_[n++] = status;
+ vad_label_[n++] = status;
}
if (status == 0) {
// This frame is detected as inactive. We need send whatever
// encoded so far.
- *bitStreamLenByte = WebRtcSpeex_GetBitstream(_encoderInstPtr,
- (WebRtc_Word16*) bitStream);
-
- return *bitStreamLenByte;
+ *bitstream_len_byte = WebRtcSpeex_GetBitstream(encoder_inst_ptr_,
+ (WebRtc_Word16*)bitstream);
+ return *bitstream_len_byte;
}
}
- *bitStreamLenByte = WebRtcSpeex_GetBitstream(_encoderInstPtr,
- (WebRtc_Word16*) bitStream);
- return *bitStreamLenByte;
+ *bitstream_len_byte = WebRtcSpeex_GetBitstream(encoder_inst_ptr_,
+ (WebRtc_Word16*)bitstream);
+ return *bitstream_len_byte;
}
-WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitStream */,
- WebRtc_Word16 /* bitStreamLenByte */,
+WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitstream */,
+ WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
- WebRtc_Word16* /* audioSamples */,
- WebRtc_Word8* /* speechType */) {
+ WebRtc_Word16* /* audio_samples */,
+ WebRtc_Word8* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMSPEEX::EnableDTX() {
- if (_dtxEnabled) {
+ if (dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// enable DTX
- if (WebRtcSpeex_EncoderInit(_encoderInstPtr, (_vbrEnabled ? 1 : 0),
- _complMode, 1) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, (vbr_enabled_ ? 1 : 0),
+ compl_mode_, 1) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot enable DTX for Speex");
return -1;
}
- _dtxEnabled = true;
+ dtx_enabled_ = true;
return 0;
} else {
return -1;
@@ -234,17 +235,17 @@
}
WebRtc_Word16 ACMSPEEX::DisableDTX() {
- if (!_dtxEnabled) {
+ if (!dtx_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// disable DTX
- if (WebRtcSpeex_EncoderInit(_encoderInstPtr, (_vbrEnabled ? 1 : 0),
- _complMode, 0) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, (vbr_enabled_ ? 1 : 0),
+ compl_mode_, 0) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot disable DTX for Speex");
return -1;
}
- _dtxEnabled = false;
+ dtx_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -254,54 +255,55 @@
return 0;
}
-WebRtc_Word16 ACMSPEEX::InternalInitEncoder(WebRtcACMCodecParams* codecParams) {
+WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
+ WebRtcACMCodecParams* codec_params) {
// sanity check
- if (_encoderInstPtr == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (encoder_inst_ptr_ == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot initialize Speex encoder, instance does not exist");
return -1;
}
- WebRtc_Word16 status = SetBitRateSafe((codecParams->codecInstant).rate);
+ WebRtc_Word16 status = SetBitRateSafe((codec_params->codecInstant).rate);
status +=
- (WebRtcSpeex_EncoderInit(_encoderInstPtr, _vbrEnabled, _complMode,
- ((codecParams->enableDTX) ? 1 : 0)) < 0) ?
- -1 : 0;
+ (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, vbr_enabled_, compl_mode_,
+ ((codec_params->enable_dtx) ? 1 : 0)) < 0) ?
+ -1 : 0;
if (status >= 0) {
return 0;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error in initialization of Speex encoder");
return -1;
}
}
WebRtc_Word16 ACMSPEEX::InternalInitDecoder(
- WebRtcACMCodecParams* /* codecParams */) {
+ WebRtcACMCodecParams* /* codec_params */) {
WebRtc_Word16 status;
// sanity check
- if (_decoderInstPtr == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (decoder_inst_ptr_ == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot initialize Speex decoder, instance does not exist");
return -1;
}
- status = ((WebRtcSpeex_DecoderInit(_decoderInstPtr) < 0) ? -1 : 0);
+ status = ((WebRtcSpeex_DecoderInit(decoder_inst_ptr_) < 0) ? -1 : 0);
if (status >= 0) {
return 0;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error in initialization of Speex decoder");
return -1;
}
}
-WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst) {
- if (!_decoderInitialized) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst) {
+ if (!decoder_initialized_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error, Speex decoder is not initialized");
return -1;
}
@@ -311,26 +313,26 @@
// Then call NetEQ to add the codec to its
// database.
- switch (_samplingFrequency) {
+ switch (sampling_frequency_) {
case 8000: {
- SET_CODEC_PAR((codecDef), kDecoderSPEEX_8, codecInst.pltype,
- _decoderInstPtr, 8000);
+ SET_CODEC_PAR((codec_def), kDecoderSPEEX_8, codec_inst.pltype,
+ decoder_inst_ptr_, 8000);
break;
}
case 16000: {
- SET_CODEC_PAR((codecDef), kDecoderSPEEX_16, codecInst.pltype,
- _decoderInstPtr, 16000);
+ SET_CODEC_PAR((codec_def), kDecoderSPEEX_16, codec_inst.pltype,
+ decoder_inst_ptr_, 16000);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Unsupported sampling frequency for Speex");
return -1;
}
}
- SET_SPEEX_FUNCTIONS((codecDef));
+ SET_SPEEX_FUNCTIONS((codec_def));
return 0;
}
@@ -339,43 +341,43 @@
}
WebRtc_Word16 ACMSPEEX::InternalCreateEncoder() {
- return WebRtcSpeex_CreateEnc(&_encoderInstPtr, _samplingFrequency);
+ return WebRtcSpeex_CreateEnc(&encoder_inst_ptr_, sampling_frequency_);
}
void ACMSPEEX::DestructEncoderSafe() {
- if (_encoderInstPtr != NULL) {
- WebRtcSpeex_FreeEnc(_encoderInstPtr);
- _encoderInstPtr = NULL;
+ if (encoder_inst_ptr_ != NULL) {
+ WebRtcSpeex_FreeEnc(encoder_inst_ptr_);
+ encoder_inst_ptr_ = NULL;
}
// there is no encoder set the following
- _encoderExist = false;
- _encoderInitialized = false;
- _encodingRate = 0;
+ encoder_exist_ = false;
+ encoder_initialized_ = false;
+ encoding_rate_ = 0;
}
WebRtc_Word16 ACMSPEEX::InternalCreateDecoder() {
- return WebRtcSpeex_CreateDec(&_decoderInstPtr, _samplingFrequency, 1);
+ return WebRtcSpeex_CreateDec(&decoder_inst_ptr_, sampling_frequency_, 1);
}
void ACMSPEEX::DestructDecoderSafe() {
- if (_decoderInstPtr != NULL) {
- WebRtcSpeex_FreeDec(_decoderInstPtr);
- _decoderInstPtr = NULL;
+ if (decoder_inst_ptr_ != NULL) {
+ WebRtcSpeex_FreeDec(decoder_inst_ptr_);
+ decoder_inst_ptr_ = NULL;
}
// there is no encoder instance set the followings
- _decoderExist = false;
- _decoderInitialized = false;
+ decoder_exist_ = false;
+ decoder_initialized_ = false;
}
WebRtc_Word16 ACMSPEEX::SetBitRateSafe(const WebRtc_Word32 rate) {
// Check if changed rate
- if (rate == _encodingRate) {
+ if (rate == encoding_rate_) {
return 0;
} else if (rate > 2000) {
- _encodingRate = rate;
- _encoderParams.codecInstant.rate = rate;
+ encoding_rate_ = rate;
+ encoder_params_.codecInstant.rate = rate;
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Unsupported encoding rate for Speex");
return -1;
@@ -384,31 +386,30 @@
return 0;
}
-void ACMSPEEX::InternalDestructEncoderInst(void* ptrInst) {
- if (ptrInst != NULL) {
- WebRtcSpeex_FreeEnc((SPEEX_encinst_t_*) ptrInst);
+void ACMSPEEX::InternalDestructEncoderInst(void* ptr_inst) {
+ if (ptr_inst != NULL) {
+ WebRtcSpeex_FreeEnc((SPEEX_encinst_t_*) ptr_inst);
}
return;
}
#ifdef UNUSEDSPEEX
-// This API is currently not in use. If requested to be able to enable/disable VBR
-// an ACM API need to be added.
+// This API is currently not in use. If requested to be able to enable/disable
+// VBR an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::EnableVBR() {
- if (_vbrEnabled) {
+ if (vbr_enabled_) {
return 0;
- } else if (_encoderExist) // check if encoder exist
- {
+ } else if (encoder_exist_) { // check if encoder exist
// enable Variable Bit Rate (VBR)
- if (WebRtcSpeex_EncoderInit(_encoderInstPtr, 1, _complMode,
- (_dtxEnabled ? 1 : 0)) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, 1, compl_mode_,
+ (dtx_enabled_ ? 1 : 0)) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot enable VBR mode for Speex");
return -1;
}
- _vbrEnabled = true;
+ vbr_enabled_ = true;
return 0;
} else {
return -1;
@@ -418,18 +419,18 @@
// This API is currently not in use. If requested to be able to enable/disable
// VBR an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::DisableVBR() {
- if (!_vbrEnabled) {
+ if (!vbr_enabled_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// disable DTX
- if (WebRtcSpeex_EncoderInit(_encoderInstPtr, 0, _complMode,
- (_dtxEnabled ? 1 : 0)) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, 0, compl_mode_,
+ (dtx_enabled_ ? 1 : 0)) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Cannot disable DTX for Speex");
return -1;
}
- _vbrEnabled = false;
+ vbr_enabled_ = false;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
@@ -441,17 +442,17 @@
// an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::SetComplMode(WebRtc_Word16 mode) {
// Check if new mode
- if (mode == _complMode) {
+ if (mode == compl_mode_) {
return 0;
- } else if (_encoderExist) { // check if encoder exist
+ } else if (encoder_exist_) { // check if encoder exist
// Set new mode
- if (WebRtcSpeex_EncoderInit(_encoderInstPtr, 0, mode, (_dtxEnabled ? 1 : 0))
- < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _uniqueID,
+ if (WebRtcSpeex_EncoderInit(encoder_inst_ptr_, 0, mode,
+ (dtx_enabled_ ? 1 : 0)) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error in complexity mode for Speex");
return -1;
}
- _complMode = mode;
+ compl_mode_ = mode;
return 0;
} else {
// encoder doesn't exists, therefore disabling is harmless
diff --git a/webrtc/modules/audio_coding/main/source/acm_speex.h b/webrtc/modules/audio_coding/main/source/acm_speex.h
index ee31daf..d1cd840 100644
--- a/webrtc/modules/audio_coding/main/source/acm_speex.h
+++ b/webrtc/modules/audio_coding/main/source/acm_speex.h
@@ -11,7 +11,7 @@
#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"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
// forward declaration
struct SPEEX_encinst_t_;
@@ -21,27 +21,28 @@
class ACMSPEEX : public ACMGenericCodec {
public:
- ACMSPEEX(WebRtc_Word16 codecID);
+ explicit ACMSPEEX(WebRtc_Word16 codec_id);
~ACMSPEEX();
+
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
- WebRtc_Word16* bitStreamLenByte);
+ WebRtc_Word16* bitstream_len_byte);
- WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
- WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codecParams);
+ WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
- WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitStream,
- WebRtc_Word16 bitStreamLenByte,
+ WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
+ WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
- WebRtc_Word16* audioSamples,
- WebRtc_Word8* speechType);
+ WebRtc_Word16* audio_samples,
+ WebRtc_Word8* speech_type);
- WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codecDef,
- const CodecInst& codecInst);
+ WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
+ const CodecInst& codec_inst);
void DestructEncoderSafe();
@@ -51,7 +52,7 @@
WebRtc_Word16 InternalCreateDecoder();
- void InternalDestructEncoderInst(void* ptrInst);
+ void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
@@ -67,13 +68,13 @@
WebRtc_Word16 SetComplMode(WebRtc_Word16 mode);
#endif
- SPEEX_encinst_t_* _encoderInstPtr;
- SPEEX_decinst_t_* _decoderInstPtr;
- WebRtc_Word16 _complMode;
- bool _vbrEnabled;
- WebRtc_Word32 _encodingRate;
- WebRtc_Word16 _samplingFrequency;
- WebRtc_UWord16 _samplesIn20MsAudio;
+ SPEEX_encinst_t_* encoder_inst_ptr_;
+ SPEEX_decinst_t_* decoder_inst_ptr_;
+ WebRtc_Word16 compl_mode_;
+ bool vbr_enabled_;
+ WebRtc_Word32 encoding_rate_;
+ WebRtc_Word16 sampling_frequency_;
+ WebRtc_UWord16 samples_in_20ms_audio_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/source/audio_coding_module.cc b/webrtc/modules/audio_coding/main/source/audio_coding_module.cc
index 12ebf00..6891305 100644
--- a/webrtc/modules/audio_coding/main/source/audio_coding_module.cc
+++ b/webrtc/modules/audio_coding/main/source/audio_coding_module.cc
@@ -8,10 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "acm_dtmf_detection.h"
-#include "audio_coding_module.h"
-#include "audio_coding_module_impl.h"
-#include "trace.h"
+#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
+
+#include "webrtc/common_types.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h"
+#include "webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -31,10 +34,10 @@
}
// Get supported codec param with id
-WebRtc_Word32 AudioCodingModule::Codec(const WebRtc_UWord8 listId,
+WebRtc_Word32 AudioCodingModule::Codec(const WebRtc_UWord8 list_id,
CodecInst& codec) {
// Get the codec settings for the codec with the given list ID
- return ACMCodecDB::Codec(listId, &codec);
+ return ACMCodecDB::Codec(list_id, &codec);
}
// Get supported codec Param with name, frequency and number of channels.
@@ -74,13 +77,13 @@
// Checks the validity of the parameters of the given codec
bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
- int mirrorID;
- char errMsg[500];
+ int mirror_id;
+ char err_msg[500];
- int codecNumber = ACMCodecDB::CodecNumber(&codec, &mirrorID, errMsg, 500);
+ int codec_number = ACMCodecDB::CodecNumber(&codec, &mirror_id, err_msg, 500);
- if (codecNumber < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, errMsg);
+ if (codec_number < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, err_msg);
return false;
} else {
return true;
diff --git a/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.cc
index 7b47b12..2ce5abb 100644
--- a/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.cc
+++ b/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.cc
@@ -8,23 +8,20 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "audio_coding_module_impl.h"
+#include "webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h"
#include <assert.h>
#include <stdlib.h>
-#ifdef ACM_QA_TEST
-# include <stdio.h>
-#endif
-#include "acm_codec_database.h"
-#include "acm_common_defs.h"
-#include "acm_dtmf_detection.h"
-#include "acm_generic_codec.h"
-#include "acm_resampler.h"
-#include "critical_section_wrapper.h"
-#include "engine_configurations.h"
-#include "rw_lock_wrapper.h"
-#include "trace.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
+#include "webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h"
+#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
+#include "webrtc/modules/audio_coding/main/source/acm_resampler.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -105,65 +102,66 @@
} // namespace
AudioCodingModuleImpl::AudioCodingModuleImpl(const WebRtc_Word32 id)
- : _packetizationCallback(NULL),
- _id(id),
- _lastTimestamp(0xD87F3F9F),
- _lastInTimestamp(0xD87F3F9F),
- _sendCodecInst(),
- _cng_nb_pltype(255),
- _cng_wb_pltype(255),
- _cng_swb_pltype(255),
- _cng_fb_pltype(255),
- _red_pltype(255),
- _vadEnabled(false),
- _dtxEnabled(false),
- _vadMode(VADNormal),
- _stereoReceiveRegistered(false),
- _stereoSend(false),
- _prev_received_channel(0),
- _expected_channels(1),
- _currentSendCodecIdx(-1),
- _current_receive_codec_idx(-1),
- _sendCodecRegistered(false),
- _acmCritSect(CriticalSectionWrapper::CreateCriticalSection()),
- _vadCallback(NULL),
- _lastRecvAudioCodecPlType(255),
- _isFirstRED(true),
- _fecEnabled(false),
- _lastFECTimestamp(0),
- _receiveREDPayloadType(255),
- _previousPayloadType(255),
- _dummyRTPHeader(NULL),
- _recvPlFrameSizeSmpls(0),
- _receiverInitialized(false),
- _dtmfDetector(NULL),
- _dtmfCallback(NULL),
- _lastDetectedTone(kACMToneEnd),
- _callbackCritSect(CriticalSectionWrapper::CreateCriticalSection()),
- _secondarySendCodecInst(),
- _secondaryEncoder(NULL) {
+ : packetization_callback_(NULL),
+ id_(id),
+ last_timestamp_(0xD87F3F9F),
+ last_in_timestamp_(0xD87F3F9F),
+ send_codec_inst_(),
+ cng_nb_pltype_(255),
+ cng_wb_pltype_(255),
+ cng_swb_pltype_(255),
+ cng_fb_pltype_(255),
+ red_pltype_(255),
+ vad_enabled_(false),
+ dtx_enabled_(false),
+ vad_mode_(VADNormal),
+ stereo_receive_registered_(false),
+ stereo_send_(false),
+ prev_received_channel_(0),
+ expected_channels_(1),
+ current_send_codec_idx_(-1),
+ current_receive_codec_idx_(-1),
+ send_codec_registered_(false),
+ acm_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
+ vad_callback_(NULL),
+ last_recv_audio_codec_pltype_(255),
+ is_first_red_(true),
+ fec_enabled_(false),
+ last_fec_timestamp_(0),
+ receive_red_pltype_(255),
+ previous_pltype_(255),
+ dummy_rtp_header_(NULL),
+ recv_pl_frame_size_smpls_(0),
+ receiver_initialized_(false),
+ dtmf_detector_(NULL),
+ dtmf_callback_(NULL),
+ last_detected_tone_(kACMToneEnd),
+ callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
+ secondary_send_codec_inst_(),
+ secondary_encoder_(NULL) {
// Nullify send codec memory, set payload type and set codec name to
// invalid values.
const char no_name[] = "noCodecRegistered";
- strncpy(_sendCodecInst.plname, no_name, RTP_PAYLOAD_NAME_SIZE - 1);
- _sendCodecInst.pltype = -1;
+ strncpy(send_codec_inst_.plname, no_name, RTP_PAYLOAD_NAME_SIZE - 1);
+ send_codec_inst_.pltype = -1;
- strncpy(_secondarySendCodecInst.plname, no_name, RTP_PAYLOAD_NAME_SIZE - 1);
- _secondarySendCodecInst.pltype = -1;
+ strncpy(secondary_send_codec_inst_.plname, no_name,
+ RTP_PAYLOAD_NAME_SIZE - 1);
+ secondary_send_codec_inst_.pltype = -1;
for (int i = 0; i < ACMCodecDB::kMaxNumCodecs; i++) {
- _codecs[i] = NULL;
- _registeredPlTypes[i] = -1;
- _stereoReceive[i] = false;
- _slaveCodecs[i] = NULL;
- _mirrorCodecIdx[i] = -1;
+ codecs_[i] = NULL;
+ registered_pltypes_[i] = -1;
+ stereo_receive_[i] = false;
+ slave_codecs_[i] = NULL;
+ mirror_codec_idx_[i] = -1;
}
- _netEq.SetUniqueId(_id);
+ neteq_.set_id(id_);
// Allocate memory for RED.
- _redBuffer = new WebRtc_UWord8[MAX_PAYLOAD_SIZE_BYTE];
+ red_buffer_ = new WebRtc_UWord8[MAX_PAYLOAD_SIZE_BYTE];
// TODO(turajs): This might not be exactly how this class is supposed to work.
// The external usage might be that |fragmentationVectorSize| has to match
@@ -175,166 +173,127 @@
// space matches |fragmentationVectorSize|, therefore, this should not cause
// any problem. A better approach is not using RTPFragmentationHeader as
// member variable, instead, use an ACM-specific structure to hold RED-related
- // data.
- _fragmentation.VerifyAndAllocateFragmentationHeader(
+ // data. See module_common_type.h for the definition of
+ // RTPFragmentationHeader.
+ fragmentation_.VerifyAndAllocateFragmentationHeader(
kMaxNumFragmentationVectors);
- // Register the default payload type for RED and for CNG for the three
- // frequencies 8, 16 and 32 kHz.
+ // Register the default payload type for RED and for CNG at sampling rates of
+ // 8, 16, 32 and 48 kHz.
for (int i = (ACMCodecDB::kNumCodecs - 1); i >= 0; i--) {
if (IsCodecRED(i)) {
- _red_pltype = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
+ red_pltype_ = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
} else if (IsCodecCN(i)) {
if (ACMCodecDB::database_[i].plfreq == 8000) {
- _cng_nb_pltype = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
+ cng_nb_pltype_ = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
} else if (ACMCodecDB::database_[i].plfreq == 16000) {
- _cng_wb_pltype = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
+ cng_wb_pltype_ = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
} else if (ACMCodecDB::database_[i].plfreq == 32000) {
- _cng_swb_pltype = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
+ cng_swb_pltype_ = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
} else if (ACMCodecDB::database_[i].plfreq == 48000) {
- _cng_fb_pltype = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
+ cng_fb_pltype_ = static_cast<uint8_t>(ACMCodecDB::database_[i].pltype);
}
}
}
if (InitializeReceiverSafe() < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "Cannot initialize reciever");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "Cannot initialize receiver");
}
-#ifdef ACM_QA_TEST
- char file_name[500];
- sprintf(file_name, "ACM_QA_incomingPL_%03d_%d%d%d%d%d%d.dat", _id,
- rand() % 10, rand() % 10, rand() % 10, rand() % 10, rand() % 10,
- rand() % 10);
- _incomingPL = fopen(file_name, "wb");
- sprintf(file_name, "ACM_QA_outgoingPL_%03d_%d%d%d%d%d%d.dat", _id,
- rand() % 10, rand() % 10, rand() % 10, rand() % 10, rand() % 10,
- rand() % 10);
- _outgoingPL = fopen(file_name, "wb");
-#endif
-
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id, "Created");
}
AudioCodingModuleImpl::~AudioCodingModuleImpl() {
{
- CriticalSectionScoped lock(_acmCritSect);
- _currentSendCodecIdx = -1;
+ CriticalSectionScoped lock(acm_crit_sect_);
+ current_send_codec_idx_ = -1;
for (int i = 0; i < ACMCodecDB::kMaxNumCodecs; i++) {
- if (_codecs[i] != NULL) {
+ if (codecs_[i] != NULL) {
// True stereo codecs share the same memory for master and
// slave, so slave codec need to be nullified here, since the
// memory will be deleted.
- if (_slaveCodecs[i] == _codecs[i]) {
- _slaveCodecs[i] = NULL;
+ if (slave_codecs_[i] == codecs_[i]) {
+ slave_codecs_[i] = NULL;
}
// Mirror index holds the address of the codec memory.
- assert(_mirrorCodecIdx[i] > -1);
- if (_codecs[_mirrorCodecIdx[i]] != NULL) {
- delete _codecs[_mirrorCodecIdx[i]];
- _codecs[_mirrorCodecIdx[i]] = NULL;
+ assert(mirror_codec_idx_[i] > -1);
+ if (codecs_[mirror_codec_idx_[i]] != NULL) {
+ delete codecs_[mirror_codec_idx_[i]];
+ codecs_[mirror_codec_idx_[i]] = NULL;
}
- _codecs[i] = NULL;
+ codecs_[i] = NULL;
}
- if (_slaveCodecs[i] != NULL) {
+ if (slave_codecs_[i] != NULL) {
// Delete memory for stereo usage of mono codecs.
- assert(_mirrorCodecIdx[i] > -1);
- if (_slaveCodecs[_mirrorCodecIdx[i]] != NULL) {
- delete _slaveCodecs[_mirrorCodecIdx[i]];
- _slaveCodecs[_mirrorCodecIdx[i]] = NULL;
+ assert(mirror_codec_idx_[i] > -1);
+ if (slave_codecs_[mirror_codec_idx_[i]] != NULL) {
+ delete slave_codecs_[mirror_codec_idx_[i]];
+ slave_codecs_[mirror_codec_idx_[i]] = NULL;
}
- _slaveCodecs[i] = NULL;
+ slave_codecs_[i] = NULL;
}
}
- if (_dtmfDetector != NULL) {
- delete _dtmfDetector;
- _dtmfDetector = NULL;
+ if (dtmf_detector_ != NULL) {
+ delete dtmf_detector_;
+ dtmf_detector_ = NULL;
}
- if (_dummyRTPHeader != NULL) {
- delete _dummyRTPHeader;
- _dummyRTPHeader = NULL;
+ if (dummy_rtp_header_ != NULL) {
+ delete dummy_rtp_header_;
+ dummy_rtp_header_ = NULL;
}
- if (_redBuffer != NULL) {
- delete[] _redBuffer;
- _redBuffer = NULL;
+ if (red_buffer_ != NULL) {
+ delete[] red_buffer_;
+ red_buffer_ = NULL;
}
}
-#ifdef ACM_QA_TEST
- if (_incomingPL != NULL) {
- fclose(_incomingPL);
- }
+ delete callback_crit_sect_;
+ callback_crit_sect_ = NULL;
- if (_outgoingPL != NULL) {
- fclose(_outgoingPL);
- }
-#endif
-
- delete _callbackCritSect;
- _callbackCritSect = NULL;
-
- delete _acmCritSect;
- _acmCritSect = NULL;
- WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, _id,
+ delete acm_crit_sect_;
+ acm_crit_sect_ = NULL;
+ WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_,
"Destroyed");
}
WebRtc_Word32 AudioCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) {
{
- CriticalSectionScoped lock(_acmCritSect);
- _id = id;
+ CriticalSectionScoped lock(acm_crit_sect_);
+ id_ = id;
-#ifdef ACM_QA_TEST
- if (_incomingPL != NULL) {
- fclose (_incomingPL);
- }
- if (_outgoingPL != NULL) {
- fclose (_outgoingPL);
- }
- char fileName[500];
- sprintf(fileName, "ACM_QA_incomingPL_%03d_%d%d%d%d%d%d.dat", _id,
- rand() % 10, rand() % 10, rand() % 10, rand() % 10, rand() % 10,
- rand() % 10);
- _incomingPL = fopen(fileName, "wb");
- sprintf(fileName, "ACM_QA_outgoingPL_%03d_%d%d%d%d%d%d.dat", _id,
- rand() % 10, rand() % 10, rand() % 10, rand() % 10, rand() % 10,
- rand() % 10);
- _outgoingPL = fopen(fileName, "wb");
-#endif
-
- for (int i = 0; i < ACMCodecDB::kMaxNumCodecs; i++) {
- if (_codecs[i] != NULL) {
- _codecs[i]->SetUniqueID(id);
+ for (int i = 0; i < ACMCodecDB::kMaxNumCodecs; i++) {
+ if (codecs_[i] != NULL) {
+ codecs_[i]->SetUniqueID(id);
}
}
}
- _netEq.SetUniqueId(_id);
+ neteq_.set_id(id_);
return 0;
}
// Returns the number of milliseconds until the module want a
// worker thread to call Process.
WebRtc_Word32 AudioCodingModuleImpl::TimeUntilNextProcess() {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("TimeUntilNextProcess")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->SamplesLeftToEncode() /
- (_sendCodecInst.plfreq / 1000);
+ return codecs_[current_send_codec_idx_]->SamplesLeftToEncode() /
+ (send_codec_inst_.plfreq / 1000);
}
WebRtc_Word32 AudioCodingModuleImpl::Process() {
bool dual_stream;
{
- CriticalSectionScoped lock(_acmCritSect);
- dual_stream = (_secondaryEncoder.get() != NULL);
+ CriticalSectionScoped lock(acm_crit_sect_);
+ dual_stream = (secondary_encoder_.get() != NULL);
}
if (dual_stream) {
return ProcessDualStream();
@@ -356,11 +315,11 @@
assert(encoding_type == kActiveNormalEncoded);
assert(len_bytes > 0);
- _fragmentation.fragmentationLength[fragmentation_index] = len_bytes;
- _fragmentation.fragmentationPlType[fragmentation_index] = payload_type;
- _fragmentation.fragmentationTimeDiff[fragmentation_index] =
+ fragmentation_.fragmentationLength[fragmentation_index] = len_bytes;
+ fragmentation_.fragmentationPlType[fragmentation_index] = payload_type;
+ fragmentation_.fragmentationTimeDiff[fragmentation_index] =
static_cast<WebRtc_UWord16>(current_timestamp - rtp_timestamp);
- _fragmentation.fragmentationVectorSize++;
+ fragmentation_.fragmentationVectorSize++;
return len_bytes;
}
@@ -378,29 +337,29 @@
uint8_t my_red_payload_type;
{
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Check if there is an encoder before.
if (!HaveValidEncoder("ProcessDualStream") ||
- _secondaryEncoder.get() == NULL) {
+ secondary_encoder_.get() == NULL) {
return -1;
}
- ACMGenericCodec* primary_encoder = _codecs[_currentSendCodecIdx];
+ ACMGenericCodec* primary_encoder = codecs_[current_send_codec_idx_];
// If primary encoder has a full frame of audio to generate payload.
bool primary_ready_to_encode = primary_encoder->HasFrameToEncode();
// If the secondary encoder has a frame of audio to generate a payload.
- bool secondary_ready_to_encode = _secondaryEncoder->HasFrameToEncode();
+ bool secondary_ready_to_encode = secondary_encoder_->HasFrameToEncode();
if (!primary_ready_to_encode && !secondary_ready_to_encode) {
// Nothing to send.
return 0;
}
int len_bytes_previous_secondary = static_cast<int>(
- _fragmentation.fragmentationLength[2]);
+ fragmentation_.fragmentationLength[2]);
assert(len_bytes_previous_secondary <= MAX_PAYLOAD_SIZE_BYTE);
bool has_previous_payload = len_bytes_previous_secondary > 0;
uint32_t primary_timestamp = primary_encoder->EarliestTimestamp();
- uint32_t secondary_timestamp = _secondaryEncoder->EarliestTimestamp();
+ uint32_t secondary_timestamp = secondary_encoder_->EarliestTimestamp();
if (!has_previous_payload && !primary_ready_to_encode &&
secondary_ready_to_encode) {
@@ -408,16 +367,17 @@
// encoder, store the payload, and return. No packet is sent.
int16_t len_bytes = MAX_PAYLOAD_SIZE_BYTE;
WebRtcACMEncodingType encoding_type;
- if (_secondaryEncoder->Encode(_redBuffer, &len_bytes, &_lastFECTimestamp,
- &encoding_type) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (secondary_encoder_->Encode(red_buffer_, &len_bytes,
+ &last_fec_timestamp_,
+ &encoding_type) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ProcessDual(): Encoding of secondary encoder Failed");
return -1;
}
assert(len_bytes > 0);
assert(encoding_type == kActiveNormalEncoded);
assert(len_bytes <= MAX_PAYLOAD_SIZE_BYTE);
- _fragmentation.fragmentationLength[2] = len_bytes;
+ fragmentation_.fragmentationLength[2] = len_bytes;
return 0;
}
@@ -431,7 +391,7 @@
index_primary = secondary_ready_to_encode ?
TimestampLessThan(primary_timestamp, secondary_timestamp) : 0;
index_primary += has_previous_payload ?
- TimestampLessThan(primary_timestamp, _lastFECTimestamp) : 0;
+ TimestampLessThan(primary_timestamp, last_fec_timestamp_) : 0;
}
if (secondary_ready_to_encode) {
@@ -443,7 +403,7 @@
if (has_previous_payload) {
index_previous_secondary = primary_ready_to_encode ?
- (1 - TimestampLessThan(primary_timestamp, _lastFECTimestamp)) : 0;
+ (1 - TimestampLessThan(primary_timestamp, last_fec_timestamp_)) : 0;
// If secondary is ready it always have a timestamp larger than previous
// secondary. So the index is either 0 or 1.
index_previous_secondary += secondary_ready_to_encode ? 1 : 0;
@@ -464,32 +424,32 @@
} else if (index_secondary == 0) {
current_timestamp = secondary_timestamp;
} else {
- current_timestamp = _lastFECTimestamp;
+ current_timestamp = last_fec_timestamp_;
}
- _fragmentation.fragmentationVectorSize = 0;
+ fragmentation_.fragmentationVectorSize = 0;
if (has_previous_payload) {
assert(index_previous_secondary >= 0 &&
index_previous_secondary < kMaxNumFragmentationVectors);
assert(len_bytes_previous_secondary <= MAX_PAYLOAD_SIZE_BYTE);
memcpy(&stream[index_previous_secondary * MAX_PAYLOAD_SIZE_BYTE],
- _redBuffer, sizeof(stream[0]) * len_bytes_previous_secondary);
- _fragmentation.fragmentationLength[index_previous_secondary] =
+ red_buffer_, sizeof(stream[0]) * len_bytes_previous_secondary);
+ fragmentation_.fragmentationLength[index_previous_secondary] =
len_bytes_previous_secondary;
- _fragmentation.fragmentationPlType[index_previous_secondary] =
- _secondarySendCodecInst.pltype;
- _fragmentation.fragmentationTimeDiff[index_previous_secondary] =
- static_cast<WebRtc_UWord16>(current_timestamp - _lastFECTimestamp);
- _fragmentation.fragmentationVectorSize++;
+ fragmentation_.fragmentationPlType[index_previous_secondary] =
+ secondary_send_codec_inst_.pltype;
+ fragmentation_.fragmentationTimeDiff[index_previous_secondary] =
+ static_cast<WebRtc_UWord16>(current_timestamp - last_fec_timestamp_);
+ fragmentation_.fragmentationVectorSize++;
}
if (primary_ready_to_encode) {
assert(index_primary >= 0 && index_primary < kMaxNumFragmentationVectors);
int i = index_primary * MAX_PAYLOAD_SIZE_BYTE;
- if (EncodeFragmentation(index_primary, _sendCodecInst.pltype,
+ if (EncodeFragmentation(index_primary, send_codec_inst_.pltype,
current_timestamp, primary_encoder,
&stream[i]) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ProcessDualStream(): Encoding of primary encoder Failed");
return -1;
}
@@ -499,40 +459,41 @@
assert(index_secondary >= 0 &&
index_secondary < kMaxNumFragmentationVectors - 1);
int i = index_secondary * MAX_PAYLOAD_SIZE_BYTE;
- if (EncodeFragmentation(index_secondary, _secondarySendCodecInst.pltype,
- current_timestamp, _secondaryEncoder.get(),
+ if (EncodeFragmentation(index_secondary,
+ secondary_send_codec_inst_.pltype,
+ current_timestamp, secondary_encoder_.get(),
&stream[i]) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ProcessDualStream(): Encoding of secondary encoder "
"Failed");
return -1;
}
}
// Copy to local variable, as it will be used outside the ACM lock.
- my_fragmentation.CopyFrom(_fragmentation);
- my_red_payload_type = _red_pltype;
+ my_fragmentation.CopyFrom(fragmentation_);
+ my_red_payload_type = red_pltype_;
length_bytes = 0;
- for (int n = 0; n < _fragmentation.fragmentationVectorSize; n++) {
- length_bytes += _fragmentation.fragmentationLength[n];
+ for (int n = 0; n < fragmentation_.fragmentationVectorSize; n++) {
+ length_bytes += fragmentation_.fragmentationLength[n];
}
}
{
- CriticalSectionScoped lock(_callbackCritSect);
- if (_packetizationCallback != NULL) {
+ CriticalSectionScoped lock(callback_crit_sect_);
+ if (packetization_callback_ != NULL) {
// Callback with payload data, including redundant data (FEC/RED).
- if (_packetizationCallback->SendData(kAudioFrameSpeech,
- my_red_payload_type,
- current_timestamp, stream,
- length_bytes,
- &my_fragmentation) < 0) {
+ if (packetization_callback_->SendData(kAudioFrameSpeech,
+ my_red_payload_type,
+ current_timestamp, stream,
+ length_bytes,
+ &my_fragmentation) < 0) {
return -1;
}
}
}
{
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Now that data is sent, clean up fragmentation.
ResetFragmentation(0);
}
@@ -556,17 +517,17 @@
// Keep the scope of the ACM critical section limited.
{
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Check if there is an encoder before.
if (!HaveValidEncoder("ProcessSingleStream")) {
return -1;
}
- status = _codecs[_currentSendCodecIdx]->Encode(stream, &length_bytes,
- &rtp_timestamp,
- &encoding_type);
+ status = codecs_[current_send_codec_idx_]->Encode(stream, &length_bytes,
+ &rtp_timestamp,
+ &encoding_type);
if (status < 0) {
// Encode failed.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ProcessSingleStream(): Encoding Failed");
length_bytes = 0;
return -1;
@@ -576,69 +537,69 @@
} else {
switch (encoding_type) {
case kNoEncoding: {
- current_payload_type = _previousPayloadType;
+ current_payload_type = previous_pltype_;
frame_type = kFrameEmpty;
length_bytes = 0;
break;
}
case kActiveNormalEncoded:
case kPassiveNormalEncoded: {
- current_payload_type = (WebRtc_UWord8) _sendCodecInst.pltype;
+ current_payload_type = (WebRtc_UWord8) send_codec_inst_.pltype;
frame_type = kAudioFrameSpeech;
break;
}
case kPassiveDTXNB: {
- current_payload_type = _cng_nb_pltype;
+ current_payload_type = cng_nb_pltype_;
frame_type = kAudioFrameCN;
- _isFirstRED = true;
+ is_first_red_ = true;
break;
}
case kPassiveDTXWB: {
- current_payload_type = _cng_wb_pltype;
+ current_payload_type = cng_wb_pltype_;
frame_type = kAudioFrameCN;
- _isFirstRED = true;
+ is_first_red_ = true;
break;
}
case kPassiveDTXSWB: {
- current_payload_type = _cng_swb_pltype;
+ current_payload_type = cng_swb_pltype_;
frame_type = kAudioFrameCN;
- _isFirstRED = true;
+ is_first_red_ = true;
break;
}
case kPassiveDTXFB: {
- current_payload_type = _cng_fb_pltype;
+ current_payload_type = cng_fb_pltype_;
frame_type = kAudioFrameCN;
- _isFirstRED = true;
+ is_first_red_ = true;
break;
}
}
has_data_to_send = true;
- _previousPayloadType = current_payload_type;
+ previous_pltype_ = current_payload_type;
// Redundancy encode is done here. The two bitstreams packetized into
// one RTP packet and the fragmentation points are set.
// Only apply RED on speech data.
- if ((_fecEnabled) &&
+ if ((fec_enabled_) &&
((encoding_type == kActiveNormalEncoded) ||
(encoding_type == kPassiveNormalEncoded))) {
// FEC is enabled within this scope.
//
// Note that, a special solution exists for iSAC since it is the only
- // codec for which getRedPayload has a non-empty implementation.
+ // codec for which GetRedPayload has a non-empty implementation.
//
// Summary of the FEC scheme below (use iSAC as example):
//
- // 1st (_firstRED is true) encoded iSAC frame (primary #1) =>
- // - call getRedPayload() and store redundancy for packet #1 in
+ // 1st (is_first_red_ is true) encoded iSAC frame (primary #1) =>
+ // - call GetRedPayload() and store redundancy for packet #1 in
// second fragment of RED buffer (old data)
// - drop the primary iSAC frame
// - don't call SendData
- // 2nd (_firstRED is false) encoded iSAC frame (primary #2) =>
+ // 2nd (is_first_red_ is false) encoded iSAC frame (primary #2) =>
// - store primary #2 in 1st fragment of RED buffer and send the
// combined packet
// - the transmitted packet contains primary #2 (new) and
// reduncancy for packet #1 (old)
- // - call getRedPayload() and store redundancy for packet #2 in
+ // - call GetRed_Payload() and store redundancy for packet #2 in
// second fragment of RED buffer
//
// ...
@@ -648,10 +609,10 @@
// combined packet
// - the transmitted packet contains primary #N (new) and
// reduncancy for packet #(N-1) (old)
- // - call getRedPayload() and store redundancy for packet #N in
+ // - call GetRedPayload() and store redundancy for packet #N in
// second fragment of RED buffer
//
- // For all other codecs, getRedPayload does nothing and returns -1 =>
+ // For all other codecs, GetRedPayload does nothing and returns -1 =>
// redundant data is only a copy.
//
// First combined packet contains : #2 (new) and #1 (old)
@@ -664,29 +625,29 @@
has_data_to_send = false;
// Skip the following part for the first packet in a RED session.
- if (!_isFirstRED) {
+ if (!is_first_red_) {
// Rearrange stream such that FEC packets are included.
// Replace stream now that we have stored current stream.
- memcpy(stream + _fragmentation.fragmentationOffset[1], _redBuffer,
- _fragmentation.fragmentationLength[1]);
+ memcpy(stream + fragmentation_.fragmentationOffset[1], red_buffer_,
+ fragmentation_.fragmentationLength[1]);
// Update the fragmentation time difference vector, in number of
// timestamps.
WebRtc_UWord16 time_since_last = WebRtc_UWord16(
- rtp_timestamp - _lastFECTimestamp);
+ rtp_timestamp - last_fec_timestamp_);
// Update fragmentation vectors.
- _fragmentation.fragmentationPlType[1] =
- _fragmentation.fragmentationPlType[0];
- _fragmentation.fragmentationTimeDiff[1] = time_since_last;
+ fragmentation_.fragmentationPlType[1] =
+ fragmentation_.fragmentationPlType[0];
+ fragmentation_.fragmentationTimeDiff[1] = time_since_last;
has_data_to_send = true;
}
// Insert new packet length.
- _fragmentation.fragmentationLength[0] = length_bytes;
+ fragmentation_.fragmentationLength[0] = length_bytes;
// Insert new packet payload type.
- _fragmentation.fragmentationPlType[0] = current_payload_type;
- _lastFECTimestamp = rtp_timestamp;
+ fragmentation_.fragmentationPlType[0] = current_payload_type;
+ last_fec_timestamp_ = rtp_timestamp;
// Can be modified by the GetRedPayload() call if iSAC is utilized.
red_length_bytes = length_bytes;
@@ -696,69 +657,55 @@
// First fragment is the current data (new).
// Second fragment is the previous data (old).
length_bytes = static_cast<WebRtc_Word16>(
- _fragmentation.fragmentationLength[0] +
- _fragmentation.fragmentationLength[1]);
+ fragmentation_.fragmentationLength[0] +
+ fragmentation_.fragmentationLength[1]);
// Get, and store, redundant data from the encoder based on the recently
// encoded frame.
// NOTE - only iSAC contains an implementation; all other codecs does
// nothing and returns -1.
- if (_codecs[_currentSendCodecIdx]->GetRedPayload(
- _redBuffer,
+ if (codecs_[current_send_codec_idx_]->GetRedPayload(
+ red_buffer_,
&red_length_bytes) == -1) {
// The codec was not iSAC => use current encoder output as redundant
// data instead (trivial FEC scheme).
- memcpy(_redBuffer, stream, red_length_bytes);
+ memcpy(red_buffer_, stream, red_length_bytes);
}
- _isFirstRED = false;
+ is_first_red_ = false;
// Update payload type with RED payload type.
- current_payload_type = _red_pltype;
+ current_payload_type = red_pltype_;
// We have packed 2 payloads.
- _fragmentation.fragmentationVectorSize = kNumFecFragmentationVectors;
+ fragmentation_.fragmentationVectorSize = kNumFecFragmentationVectors;
// Copy to local variable, as it will be used outside ACM lock.
- my_fragmentation.CopyFrom(_fragmentation);
+ my_fragmentation.CopyFrom(fragmentation_);
// Store RED length.
- _fragmentation.fragmentationLength[1] = red_length_bytes;
+ fragmentation_.fragmentationLength[1] = red_length_bytes;
}
}
}
if (has_data_to_send) {
- CriticalSectionScoped lock(_callbackCritSect);
-#ifdef ACM_QA_TEST
- if (_outgoingPL != NULL) {
- if (fwrite(&rtp_timestamp, sizeof(WebRtc_UWord32), 1, _outgoingPL) != 1) {
- return -1;
- }
- if (fwrite(¤t_payload_type, sizeof(WebRtc_UWord8),
- 1, _outgoingPL) != 1) {
- return -1;
- }
- if (fwrite(&length_bytes, sizeof(WebRtc_Word16), 1, _outgoingPL) != 1) {
- return -1;
- }
- }
-#endif
+ CriticalSectionScoped lock(callback_crit_sect_);
- if (_packetizationCallback != NULL) {
+ if (packetization_callback_ != NULL) {
if (fec_active) {
// Callback with payload data, including redundant data (FEC/RED).
- _packetizationCallback->SendData(frame_type, current_payload_type,
- rtp_timestamp, stream, length_bytes,
- &my_fragmentation);
+ packetization_callback_->SendData(frame_type, current_payload_type,
+ rtp_timestamp, stream, length_bytes,
+ &my_fragmentation);
} else {
// Callback with payload data.
- _packetizationCallback->SendData(frame_type, current_payload_type,
- rtp_timestamp, stream, length_bytes,
- NULL);
+ packetization_callback_->SendData(frame_type, current_payload_type,
+ rtp_timestamp, stream, length_bytes,
+ NULL);
}
}
- if (_vadCallback != NULL) {
+ if (vad_callback_ != NULL) {
// Callback with VAD decision.
- _vadCallback->InFrameType(((WebRtc_Word16) encoding_type));
+ vad_callback_->InFrameType(((WebRtc_Word16) encoding_type));
}
}
return length_bytes;
@@ -770,27 +717,27 @@
// Initialize send codec.
WebRtc_Word32 AudioCodingModuleImpl::InitializeSender() {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Start with invalid values.
- _sendCodecRegistered = false;
- _currentSendCodecIdx = -1;
- _sendCodecInst.plname[0] = '\0';
+ send_codec_registered_ = false;
+ current_send_codec_idx_ = -1;
+ send_codec_inst_.plname[0] = '\0';
// Delete all encoders to start fresh.
for (int id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
- if (_codecs[id] != NULL) {
- _codecs[id]->DestructEncoder();
+ if (codecs_[id] != NULL) {
+ codecs_[id]->DestructEncoder();
}
}
// Initialize FEC/RED.
- _isFirstRED = true;
- if (_fecEnabled || _secondaryEncoder.get() != NULL) {
- if (_redBuffer != NULL) {
- memset(_redBuffer, 0, MAX_PAYLOAD_SIZE_BYTE);
+ is_first_red_ = true;
+ if (fec_enabled_ || secondary_encoder_.get() != NULL) {
+ if (red_buffer_ != NULL) {
+ memset(red_buffer_, 0, MAX_PAYLOAD_SIZE_BYTE);
}
- if (_fecEnabled) {
+ if (fec_enabled_) {
ResetFragmentation(kNumFecFragmentationVectors);
} else {
ResetFragmentation(0);
@@ -801,20 +748,20 @@
}
WebRtc_Word32 AudioCodingModuleImpl::ResetEncoder() {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("ResetEncoder")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->ResetEncoder();
+ return codecs_[current_send_codec_idx_]->ResetEncoder();
}
void AudioCodingModuleImpl::UnregisterSendCodec() {
- CriticalSectionScoped lock(_acmCritSect);
- _sendCodecRegistered = false;
- _currentSendCodecIdx = -1;
+ CriticalSectionScoped lock(acm_crit_sect_);
+ send_codec_registered_ = false;
+ current_send_codec_idx_ = -1;
// If send Codec is unregistered then remove the secondary codec as well.
- if (_secondaryEncoder.get() != NULL)
- _secondaryEncoder.reset();
+ if (secondary_encoder_.get() != NULL)
+ secondary_encoder_.reset();
return;
}
@@ -824,12 +771,12 @@
my_codec = ACMCodecDB::CreateCodecInstance(&codec);
if (my_codec == NULL) {
// Error, could not create the codec.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ACMCodecDB::CreateCodecInstance() failed in CreateCodec()");
return my_codec;
}
- my_codec->SetUniqueID(_id);
- my_codec->SetNetEqDecodeLock(_netEq.DecodeLock());
+ my_codec->SetUniqueID(id_);
+ my_codec->SetNetEqDecodeLock(neteq_.DecodeLock());
return my_codec;
}
@@ -840,12 +787,12 @@
int acm_id,
int* mirror_id) {
if ((send_codec.channels != 1) && (send_codec.channels != 2)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, acm_id,
- "Wrong number of channels (%d, only mono and stereo are "
- "supported) for %s encoder", send_codec.channels,
- is_primary_encoder ? "primary" : "secondary");
- return -1;
- }
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, acm_id,
+ "Wrong number of channels (%d, only mono and stereo are "
+ "supported) for %s encoder", send_codec.channels,
+ is_primary_encoder ? "primary" : "secondary");
+ return -1;
+ }
char error_message[500];
int codec_id = ACMCodecDB::CodecNumber(&send_codec, mirror_id, error_message,
@@ -853,7 +800,7 @@
if (codec_id < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, acm_id,
error_message);
- return -1;
+ return -1;
}
// TODO(tlegrand): Remove this check. Already taken care of in
@@ -905,16 +852,16 @@
int AudioCodingModuleImpl::RegisterSecondarySendCodec(
const CodecInst& send_codec) {
- CriticalSectionScoped lock(_acmCritSect);
- if (!_sendCodecRegistered) {
+ CriticalSectionScoped lock(acm_crit_sect_);
+ if (!send_codec_registered_) {
return -1;
}
// Primary and Secondary codecs should have the same sampling rates.
- if (send_codec.plfreq != _sendCodecInst.plfreq) {
+ if (send_codec.plfreq != send_codec_inst_.plfreq) {
return -1;
}
int mirror_id;
- int codec_id = IsValidSendCodec(send_codec, false, _id, &mirror_id);
+ int codec_id = IsValidSendCodec(send_codec, false, id_, &mirror_id);
if (codec_id < 0) {
return -1;
}
@@ -922,47 +869,47 @@
WebRtcACMCodecParams codec_params;
// Initialize the codec before registering. For secondary codec VAD & DTX are
// disabled.
- memcpy(&(codec_params.codecInstant), &send_codec, sizeof(CodecInst));
- codec_params.enableVAD = false;
- codec_params.enableDTX = false;
- codec_params.vadMode = VADNormal;
+ memcpy(&(codec_params.codec_inst), &send_codec, sizeof(CodecInst));
+ codec_params.enable_vad = false;
+ codec_params.enable_dtx = false;
+ codec_params.vad_mode = VADNormal;
// Force initialization.
if (encoder->InitEncoder(&codec_params, true) < 0) {
// Could not initialize, therefore cannot be registered.
delete encoder;
return -1;
}
- _secondaryEncoder.reset(encoder);
- memcpy(&_secondarySendCodecInst, &send_codec, sizeof(send_codec));
+ secondary_encoder_.reset(encoder);
+ memcpy(&secondary_send_codec_inst_, &send_codec, sizeof(send_codec));
// Disable VAD & DTX.
SetVADSafe(false, false, VADNormal);
// Cleaning.
- if (_redBuffer) {
- memset(_redBuffer, 0, MAX_PAYLOAD_SIZE_BYTE);
+ if (red_buffer_) {
+ memset(red_buffer_, 0, MAX_PAYLOAD_SIZE_BYTE);
}
ResetFragmentation(0);
return 0;
}
void AudioCodingModuleImpl::UnregisterSecondarySendCodec() {
- CriticalSectionScoped lock(_acmCritSect);
- if (_secondaryEncoder.get() == NULL) {
+ CriticalSectionScoped lock(acm_crit_sect_);
+ if (secondary_encoder_.get() == NULL) {
return;
}
- _secondaryEncoder.reset();
+ secondary_encoder_.reset();
ResetFragmentation(0);
}
int AudioCodingModuleImpl::SecondarySendCodec(
CodecInst* secondary_codec) const {
- CriticalSectionScoped lock(_acmCritSect);
- if (_secondaryEncoder.get() == NULL) {
+ CriticalSectionScoped lock(acm_crit_sect_);
+ if (secondary_encoder_.get() == NULL) {
return -1;
}
- memcpy(secondary_codec, &_secondarySendCodecInst,
- sizeof(_secondarySendCodecInst));
+ memcpy(secondary_codec, &secondary_send_codec_inst_,
+ sizeof(secondary_send_codec_inst_));
return 0;
}
@@ -970,15 +917,15 @@
WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec(
const CodecInst& send_codec) {
int mirror_id;
- int codec_id = IsValidSendCodec(send_codec, true, _id, &mirror_id);
+ int codec_id = IsValidSendCodec(send_codec, true, id_, &mirror_id);
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Check for reported errors from function IsValidSendCodec().
if (codec_id < 0) {
- if (!_sendCodecRegistered) {
+ if (!send_codec_registered_) {
// This values has to be NULL if there is no codec registered.
- _currentSendCodecIdx = -1;
+ current_send_codec_idx_ = -1;
}
return -1;
}
@@ -990,13 +937,13 @@
// ACMCodecDB::CodecNumber().
// Check if the payload-type is valid
if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Invalid payload-type %d for %s.", send_codec.pltype,
send_codec.plname);
return -1;
}
// Set RED payload type.
- _red_pltype = static_cast<uint8_t>(send_codec.pltype);
+ red_pltype_ = static_cast<uint8_t>(send_codec.pltype);
return 0;
}
@@ -1006,51 +953,50 @@
// CNG is registered.
switch (send_codec.plfreq) {
case 8000: {
- _cng_nb_pltype = static_cast<uint8_t>(send_codec.pltype);
+ cng_nb_pltype_ = static_cast<uint8_t>(send_codec.pltype);
break;
}
case 16000: {
- _cng_wb_pltype = static_cast<uint8_t>(send_codec.pltype);
+ cng_wb_pltype_ = static_cast<uint8_t>(send_codec.pltype);
break;
}
case 32000: {
- _cng_swb_pltype = static_cast<uint8_t>(send_codec.pltype);
+ cng_swb_pltype_ = static_cast<uint8_t>(send_codec.pltype);
break;
}
case 48000: {
- _cng_fb_pltype = static_cast<uint8_t>(send_codec.pltype);
+ cng_fb_pltype_ = static_cast<uint8_t>(send_codec.pltype);
break;
}
default: {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RegisterSendCodec() failed, invalid frequency for CNG "
"registration");
return -1;
}
}
-
return 0;
}
// Set Stereo, and make sure VAD and DTX is turned off.
if (send_codec.channels == 2) {
- _stereoSend = true;
- if (_vadEnabled || _dtxEnabled) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _id,
+ stereo_send_ = true;
+ if (vad_enabled_ || dtx_enabled_) {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
"VAD/DTX is turned off, not supported when sending stereo.");
}
- _vadEnabled = false;
- _dtxEnabled = false;
+ vad_enabled_ = false;
+ dtx_enabled_ = false;
} else {
- _stereoSend = false;
+ stereo_send_ = false;
}
// Check if the codec is already registered as send codec.
bool is_send_codec;
- if (_sendCodecRegistered) {
+ if (send_codec_registered_) {
int send_codec_mirror_id;
- int send_codec_id = ACMCodecDB::CodecNumber(&_sendCodecInst,
- &send_codec_mirror_id);
+ int send_codec_id = ACMCodecDB::CodecNumber(&send_codec_inst_,
+ &send_codec_mirror_id);
assert(send_codec_id >= 0);
is_send_codec = (send_codec_id == codec_id) ||
(mirror_id == send_codec_mirror_id);
@@ -1061,55 +1007,54 @@
// If there is secondary codec registered and the new send codec has a
// sampling rate different than that of secondary codec, then unregister the
// secondary codec.
- if (_secondaryEncoder.get() != NULL &&
- _secondarySendCodecInst.plfreq != send_codec.plfreq) {
- _secondaryEncoder.reset();
+ if (secondary_encoder_.get() != NULL &&
+ secondary_send_codec_inst_.plfreq != send_codec.plfreq) {
+ secondary_encoder_.reset();
ResetFragmentation(0);
}
// If new codec, or new settings, register.
if (!is_send_codec) {
- if (_codecs[mirror_id] == NULL) {
-
- _codecs[mirror_id] = CreateCodec(send_codec);
- if (_codecs[mirror_id] == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (codecs_[mirror_id] == NULL) {
+ codecs_[mirror_id] = CreateCodec(send_codec);
+ if (codecs_[mirror_id] == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Create the codec");
return -1;
}
- _mirrorCodecIdx[mirror_id] = mirror_id;
+ mirror_codec_idx_[mirror_id] = mirror_id;
}
if (mirror_id != codec_id) {
- _codecs[codec_id] = _codecs[mirror_id];
- _mirrorCodecIdx[codec_id] = mirror_id;
+ codecs_[codec_id] = codecs_[mirror_id];
+ mirror_codec_idx_[codec_id] = mirror_id;
}
- ACMGenericCodec* codec_ptr = _codecs[codec_id];
+ ACMGenericCodec* codec_ptr = codecs_[codec_id];
WebRtc_Word16 status;
WebRtcACMCodecParams codec_params;
- memcpy(&(codec_params.codecInstant), &send_codec, sizeof(CodecInst));
- codec_params.enableVAD = _vadEnabled;
- codec_params.enableDTX = _dtxEnabled;
- codec_params.vadMode = _vadMode;
+ memcpy(&(codec_params.codec_inst), &send_codec, sizeof(CodecInst));
+ codec_params.enable_vad = vad_enabled_;
+ codec_params.enable_dtx = dtx_enabled_;
+ codec_params.vad_mode = vad_mode_;
// Force initialization.
status = codec_ptr->InitEncoder(&codec_params, true);
// Check if VAD was turned on, or if error is reported.
if (status == 1) {
- _vadEnabled = true;
+ vad_enabled_ = true;
} else if (status < 0) {
// Could not initialize the encoder.
// Check if already have a registered codec.
// Depending on that different messages are logged.
- if (!_sendCodecRegistered) {
- _currentSendCodecIdx = -1;
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (!send_codec_registered_) {
+ current_send_codec_idx_ = -1;
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Initialize the encoder No Encoder is registered");
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Initialize the encoder, continue encoding with "
"the previously registered codec");
}
@@ -1117,22 +1062,22 @@
}
// Everything is fine so we can replace the previous codec with this one.
- if (_sendCodecRegistered) {
+ if (send_codec_registered_) {
// If we change codec we start fresh with FEC.
// This is not strictly required by the standard.
- _isFirstRED = true;
+ is_first_red_ = true;
- if (codec_ptr->SetVAD(_dtxEnabled, _vadEnabled, _vadMode) < 0) {
+ if (codec_ptr->SetVAD(dtx_enabled_, vad_enabled_, vad_mode_) < 0) {
// SetVAD failed.
- _vadEnabled = false;
- _dtxEnabled = false;
+ vad_enabled_ = false;
+ dtx_enabled_ = false;
}
}
- _currentSendCodecIdx = codec_id;
- _sendCodecRegistered = true;
- memcpy(&_sendCodecInst, &send_codec, sizeof(CodecInst));
- _previousPayloadType = _sendCodecInst.pltype;
+ current_send_codec_idx_ = codec_id;
+ send_codec_registered_ = true;
+ memcpy(&send_codec_inst_, &send_codec, sizeof(CodecInst));
+ previous_pltype_ = send_codec_inst_.pltype;
return 0;
} else {
// If codec is the same as already registered check if any parameters
@@ -1141,17 +1086,17 @@
bool force_init = false;
if (mirror_id != codec_id) {
- _codecs[codec_id] = _codecs[mirror_id];
- _mirrorCodecIdx[codec_id] = mirror_id;
+ codecs_[codec_id] = codecs_[mirror_id];
+ mirror_codec_idx_[codec_id] = mirror_id;
}
// Check the payload type.
- if (send_codec.pltype != _sendCodecInst.pltype) {
+ if (send_codec.pltype != send_codec_inst_.pltype) {
// At this point check if the given payload type is valid.
// Record it later when the sampling frequency is changed
// successfully.
if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Out of range payload type");
return -1;
}
@@ -1162,56 +1107,57 @@
// one such a codec is iSAC. Both WB and SWB are encoded and decoded
// with one iSAC instance. Therefore, we need to update the encoder
// frequency if required.
- if (_sendCodecInst.plfreq != send_codec.plfreq) {
+ if (send_codec_inst_.plfreq != send_codec.plfreq) {
force_init = true;
// If sampling frequency is changed we have to start fresh with RED.
- _isFirstRED = true;
+ is_first_red_ = true;
}
// If packet size or number of channels has changed, we need to
// re-initialize the encoder.
- if (_sendCodecInst.pacsize != send_codec.pacsize) {
+ if (send_codec_inst_.pacsize != send_codec.pacsize) {
force_init = true;
}
- if (_sendCodecInst.channels != send_codec.channels) {
+ if (send_codec_inst_.channels != send_codec.channels) {
force_init = true;
}
if (force_init) {
WebRtcACMCodecParams codec_params;
- memcpy(&(codec_params.codecInstant), &send_codec, sizeof(CodecInst));
- codec_params.enableVAD = _vadEnabled;
- codec_params.enableDTX = _dtxEnabled;
- codec_params.vadMode = _vadMode;
+ memcpy(&(codec_params.codec_inst), &send_codec, sizeof(CodecInst));
+ codec_params.enable_vad = vad_enabled_;
+ codec_params.enable_dtx = dtx_enabled_;
+ codec_params.vad_mode = vad_mode_;
// Force initialization.
- if (_codecs[_currentSendCodecIdx]->InitEncoder(&codec_params, true) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (codecs_[current_send_codec_idx_]->InitEncoder(&codec_params,
+ true) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Could not change the codec packet-size.");
return -1;
}
- _sendCodecInst.plfreq = send_codec.plfreq;
- _sendCodecInst.pacsize = send_codec.pacsize;
- _sendCodecInst.channels = send_codec.channels;
+ send_codec_inst_.plfreq = send_codec.plfreq;
+ send_codec_inst_.pacsize = send_codec.pacsize;
+ send_codec_inst_.channels = send_codec.channels;
}
// If the change of sampling frequency has been successful then
// we store the payload-type.
- _sendCodecInst.pltype = send_codec.pltype;
+ send_codec_inst_.pltype = send_codec.pltype;
// Check if a change in Rate is required.
- if (send_codec.rate != _sendCodecInst.rate) {
- if (_codecs[codec_id]->SetBitRate(send_codec.rate) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (send_codec.rate != send_codec_inst_.rate) {
+ if (codecs_[codec_id]->SetBitRate(send_codec.rate) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Could not change the codec rate.");
return -1;
}
- _sendCodecInst.rate = send_codec.rate;
+ send_codec_inst_.rate = send_codec.rate;
}
- _previousPayloadType = _sendCodecInst.pltype;
+ previous_pltype_ = send_codec_inst_.pltype;
return 0;
}
@@ -1220,72 +1166,72 @@
// Get current send codec.
WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
CodecInst& current_codec) const {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendCodec()");
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- if (!_sendCodecRegistered) {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ if (!send_codec_registered_) {
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendCodec Failed, no codec is registered");
return -1;
}
WebRtcACMCodecParams encoder_param;
- _codecs[_currentSendCodecIdx]->EncoderParams(&encoder_param);
- encoder_param.codecInstant.pltype = _sendCodecInst.pltype;
- memcpy(¤t_codec, &(encoder_param.codecInstant), sizeof(CodecInst));
+ codecs_[current_send_codec_idx_]->EncoderParams(&encoder_param);
+ encoder_param.codec_inst.pltype = send_codec_inst_.pltype;
+ memcpy(¤t_codec, &(encoder_param.codec_inst), sizeof(CodecInst));
return 0;
}
// Get current send frequency.
WebRtc_Word32 AudioCodingModuleImpl::SendFrequency() const {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendFrequency()");
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- if (!_sendCodecRegistered) {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ if (!send_codec_registered_) {
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendFrequency Failed, no codec is registered");
return -1;
}
- return _sendCodecInst.plfreq;
+ return send_codec_inst_.plfreq;
}
// Get encode bitrate.
// Adaptive rate codecs return their current encode target rate, while other
// codecs return there longterm avarage or their fixed rate.
WebRtc_Word32 AudioCodingModuleImpl::SendBitrate() const {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- if (!_sendCodecRegistered) {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ if (!send_codec_registered_) {
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendBitrate Failed, no codec is registered");
return -1;
}
WebRtcACMCodecParams encoder_param;
- _codecs[_currentSendCodecIdx]->EncoderParams(&encoder_param);
+ codecs_[current_send_codec_idx_]->EncoderParams(&encoder_param);
- return encoder_param.codecInstant.rate;
+ return encoder_param.codec_inst.rate;
}
// Set available bandwidth, inform the encoder about the estimated bandwidth
// received from the remote party.
WebRtc_Word32 AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(
const WebRtc_Word32 bw) {
- return _codecs[_currentSendCodecIdx]->SetEstimatedBandwidth(bw);
+ return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
}
// Register a transport callback which will be called to deliver
// the encoded buffers.
WebRtc_Word32 AudioCodingModuleImpl::RegisterTransportCallback(
AudioPacketizationCallback* transport) {
- CriticalSectionScoped lock(_callbackCritSect);
- _packetizationCallback = transport;
+ CriticalSectionScoped lock(callback_crit_sect_);
+ packetization_callback_ = transport;
return 0;
}
@@ -1303,35 +1249,35 @@
// Enter the critical section for callback.
{
- CriticalSectionScoped lock(_callbackCritSect);
- _dtmfCallback = incoming_message;
+ CriticalSectionScoped lock(callback_crit_sect_);
+ dtmf_callback_ = incoming_message;
}
// Enter the ACM critical section to set up the DTMF class.
{
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Check if the call is to disable or enable the callback.
if (incoming_message == NULL) {
// Callback is disabled, delete DTMF-detector class.
- if (_dtmfDetector != NULL) {
- delete _dtmfDetector;
- _dtmfDetector = NULL;
+ if (dtmf_detector_ != NULL) {
+ delete dtmf_detector_;
+ dtmf_detector_ = NULL;
}
status = 0;
} else {
status = 0;
- if (_dtmfDetector == NULL) {
- _dtmfDetector = new (ACMDTMFDetection);
- if (_dtmfDetector == NULL) {
+ if (dtmf_detector_ == NULL) {
+ dtmf_detector_ = new ACMDTMFDetection;
+ if (dtmf_detector_ == NULL) {
status = -1;
}
}
if (status >= 0) {
- status = _dtmfDetector->Enable(cpt);
+ status = dtmf_detector_->Enable(cpt);
if (status < 0) {
// Failed to initialize if DTMF-detection was not enabled before,
// delete the class, and set the callback to NULL and return -1.
- delete _dtmfDetector;
- _dtmfDetector = NULL;
+ delete dtmf_detector_;
+ dtmf_detector_ = NULL;
}
}
}
@@ -1339,8 +1285,8 @@
// Check if we failed in setting up the DTMF-detector class.
if ((status < 0)) {
// We failed, we cannot have the callback.
- CriticalSectionScoped lock(_callbackCritSect);
- _dtmfCallback = NULL;
+ CriticalSectionScoped lock(callback_crit_sect_);
+ dtmf_callback_ = NULL;
}
return status;
@@ -1350,11 +1296,11 @@
// Add 10MS of raw (PCM) audio data to the encoder.
WebRtc_Word32 AudioCodingModuleImpl::Add10MsData(
const AudioFrame& audio_frame) {
-
if (audio_frame.samples_per_channel_ <= 0) {
assert(false);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "Cannot Add 10 ms audio, payload length is negative or zero");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "Cannot Add 10 ms audio, payload length is negative or "
+ "zero");
return -1;
}
@@ -1364,7 +1310,7 @@
&& (audio_frame.sample_rate_hz_ != 32000)
&& (audio_frame.sample_rate_hz_ != 48000)) {
assert(false);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Add 10 ms audio, input frequency not valid");
return -1;
}
@@ -1372,37 +1318,38 @@
// If the length and frequency matches. We currently just support raw PCM.
if ((audio_frame.sample_rate_hz_ / 100)
!= audio_frame.samples_per_channel_) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Add 10 ms audio, input frequency and length doesn't"
" match");
return -1;
}
if (audio_frame.num_channels_ != 1 && audio_frame.num_channels_ != 2) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot Add 10 ms audio, invalid number of channels.");
return -1;
}
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
// Do we have a codec registered?
if (!HaveValidEncoder("Add10MsData")) {
return -1;
}
const AudioFrame* ptr_frame;
- // Perform a resampling, also down-mix if it is required and can be performed
- // before resampling (a down mix prior to resampling will take place if both
- // primary and secondary encoders are mono and input is in stereo).
+ // Perform a resampling, also down-mix if it is required and can be
+ // performed before resampling (a down mix prior to resampling will take
+ // place if both primary and secondary encoders are mono and input is in
+ // stereo).
if (PreprocessToAddData(audio_frame, &ptr_frame) < 0) {
return -1;
}
// Check whether we need an up-mix or down-mix?
- bool remix = ptr_frame->num_channels_ != _sendCodecInst.channels;
- if (_secondaryEncoder.get() != NULL) {
+ bool remix = ptr_frame->num_channels_ != send_codec_inst_.channels;
+ if (secondary_encoder_.get() != NULL) {
remix = remix ||
- (ptr_frame->num_channels_ != _secondarySendCodecInst.channels);
+ (ptr_frame->num_channels_ != secondary_send_codec_inst_.channels);
}
// If a re-mix is required (up or down), this buffer will store re-mixed
@@ -1423,23 +1370,23 @@
const int16_t* ptr_audio = ptr_frame->data_;
// For pushing data to primary, point the |ptr_audio| to correct buffer.
- if (_sendCodecInst.channels != ptr_frame->num_channels_)
- ptr_audio = buffer;;
+ if (send_codec_inst_.channels != ptr_frame->num_channels_)
+ ptr_audio = buffer;
- if (_codecs[_currentSendCodecIdx]->Add10MsData(
- ptr_frame->timestamp_, ptr_audio, ptr_frame->samples_per_channel_,
- _sendCodecInst.channels) < 0)
+ if (codecs_[current_send_codec_idx_]->Add10MsData(
+ ptr_frame->timestamp_, ptr_audio, ptr_frame->samples_per_channel_,
+ send_codec_inst_.channels) < 0)
return -1;
- if (_secondaryEncoder.get() != NULL) {
+ if (secondary_encoder_.get() != NULL) {
// For pushing data to secondary, point the |ptr_audio| to correct buffer.
ptr_audio = ptr_frame->data_;
- if (_secondarySendCodecInst.channels != ptr_frame->num_channels_)
+ if (secondary_send_codec_inst_.channels != ptr_frame->num_channels_)
ptr_audio = buffer;
- if (_secondaryEncoder->Add10MsData(ptr_frame->timestamp_, ptr_audio,
- ptr_frame->samples_per_channel_,
- _secondarySendCodecInst.channels) < 0)
+ if (secondary_encoder_->Add10MsData(
+ ptr_frame->timestamp_, ptr_audio, ptr_frame->samples_per_channel_,
+ secondary_send_codec_inst_.channels) < 0)
return -1;
}
@@ -1453,38 +1400,38 @@
// is required, |*ptr_out| points to |in_frame|.
int AudioCodingModuleImpl::PreprocessToAddData(const AudioFrame& in_frame,
const AudioFrame** ptr_out) {
- // Primary and secondary (if exists) should have the same sampling rate.
- assert((_secondaryEncoder.get() != NULL) ?
- _secondarySendCodecInst.plfreq == _sendCodecInst.plfreq :
- true);
+ // Primary and secondary (if exists) should have the same sampling rate.
+ assert((secondary_encoder_.get() != NULL) ?
+ secondary_send_codec_inst_.plfreq == send_codec_inst_.plfreq : true);
bool resample = ((WebRtc_Word32) in_frame.sample_rate_hz_
- != _sendCodecInst.plfreq);
+ != send_codec_inst_.plfreq);
// This variable is true if primary codec and secondary codec (if exists)
// are both mono and input is stereo.
bool down_mix;
- if (_secondaryEncoder.get() != NULL) {
+ if (secondary_encoder_.get() != NULL) {
down_mix = (in_frame.num_channels_ == 2) &&
- (_sendCodecInst.channels == 1) &&
- (_secondarySendCodecInst.channels == 1);
+ (send_codec_inst_.channels == 1) &&
+ (secondary_send_codec_inst_.channels == 1);
} else {
- down_mix = (in_frame.num_channels_ == 2) && (_sendCodecInst.channels == 1);
+ down_mix = (in_frame.num_channels_ == 2) &&
+ (send_codec_inst_.channels == 1);
}
if (!down_mix && !resample) {
// No pre-processing is required.
- _lastInTimestamp = in_frame.timestamp_;
- _lastTimestamp = in_frame.timestamp_;
+ last_in_timestamp_ = in_frame.timestamp_;
+ last_timestamp_ = in_frame.timestamp_;
*ptr_out = &in_frame;
return 0;
}
- *ptr_out = &_preprocess_frame;
- _preprocess_frame.num_channels_ = in_frame.num_channels_;
+ *ptr_out = &preprocess_frame_;
+ preprocess_frame_.num_channels_ = in_frame.num_channels_;
int16_t audio[WEBRTC_10MS_PCM_AUDIO];
const int16_t* src_ptr_audio = in_frame.data_;
- int16_t* dest_ptr_audio = _preprocess_frame.data_;
+ int16_t* dest_ptr_audio = preprocess_frame_.data_;
if (down_mix) {
// If a resampling is required the output of a down-mix is written into a
// local buffer, otherwise, it will be written to the output frame.
@@ -1492,46 +1439,46 @@
dest_ptr_audio = audio;
if (DownMix(in_frame, WEBRTC_10MS_PCM_AUDIO, dest_ptr_audio) < 0)
return -1;
- _preprocess_frame.num_channels_ = 1;
+ preprocess_frame_.num_channels_ = 1;
// Set the input of the resampler is the down-mixed signal.
src_ptr_audio = audio;
}
- _preprocess_frame.timestamp_ = in_frame.timestamp_;
- _preprocess_frame.samples_per_channel_ = in_frame.samples_per_channel_;
- _preprocess_frame.sample_rate_hz_ = in_frame.sample_rate_hz_;
+ preprocess_frame_.timestamp_ = in_frame.timestamp_;
+ preprocess_frame_.samples_per_channel_ = in_frame.samples_per_channel_;
+ preprocess_frame_.sample_rate_hz_ = in_frame.sample_rate_hz_;
// If it is required, we have to do a resampling.
if (resample) {
// The result of the resampler is written to output frame.
- dest_ptr_audio = _preprocess_frame.data_;
+ dest_ptr_audio = preprocess_frame_.data_;
uint32_t timestamp_diff;
// Calculate the timestamp of this frame.
- if (_lastInTimestamp > in_frame.timestamp_) {
+ if (last_in_timestamp_ > in_frame.timestamp_) {
// A wrap around has happened.
- timestamp_diff = ((WebRtc_UWord32) 0xFFFFFFFF - _lastInTimestamp)
- + in_frame.timestamp_;
+ timestamp_diff = ((WebRtc_UWord32) 0xFFFFFFFF - last_in_timestamp_)
+ + in_frame.timestamp_;
} else {
- timestamp_diff = in_frame.timestamp_ - _lastInTimestamp;
+ timestamp_diff = in_frame.timestamp_ - last_in_timestamp_;
}
- _preprocess_frame.timestamp_ = _lastTimestamp +
- (WebRtc_UWord32)(timestamp_diff * ((double) _sendCodecInst.plfreq /
- (double) in_frame.sample_rate_hz_));
+ preprocess_frame_.timestamp_ = last_timestamp_ +
+ (WebRtc_UWord32)(timestamp_diff * ((double) send_codec_inst_.plfreq /
+ static_cast<double>(in_frame.sample_rate_hz_)));
- _preprocess_frame.samples_per_channel_ = _inputResampler.Resample10Msec(
+ preprocess_frame_.samples_per_channel_ = input_resampler_.Resample10Msec(
src_ptr_audio, in_frame.sample_rate_hz_, dest_ptr_audio,
- _sendCodecInst.plfreq, _preprocess_frame.num_channels_);
+ send_codec_inst_.plfreq, preprocess_frame_.num_channels_);
- if (_preprocess_frame.samples_per_channel_ < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (preprocess_frame_.samples_per_channel_ < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot add 10 ms audio, resmapling failed");
return -1;
}
- _preprocess_frame.sample_rate_hz_ = _sendCodecInst.plfreq;
+ preprocess_frame_.sample_rate_hz_ = send_codec_inst_.plfreq;
}
- _lastInTimestamp = in_frame.timestamp_;
- _lastTimestamp = _preprocess_frame.timestamp_;
+ last_in_timestamp_ = in_frame.timestamp_;
+ last_timestamp_ = preprocess_frame_.timestamp_;
return 0;
}
@@ -1541,8 +1488,8 @@
//
bool AudioCodingModuleImpl::FECStatus() const {
- CriticalSectionScoped lock(_acmCritSect);
- return _fecEnabled;
+ CriticalSectionScoped lock(acm_crit_sect_);
+ return fec_enabled_;
}
// Configure FEC status i.e on/off.
@@ -1550,25 +1497,25 @@
AudioCodingModuleImpl::SetFECStatus(
#ifdef WEBRTC_CODEC_RED
const bool enable_fec) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- if (_fecEnabled != enable_fec) {
+ if (fec_enabled_ != enable_fec) {
// Reset the RED buffer.
- memset(_redBuffer, 0, MAX_PAYLOAD_SIZE_BYTE);
+ memset(red_buffer_, 0, MAX_PAYLOAD_SIZE_BYTE);
// Reset fragmentation buffers.
ResetFragmentation(kNumFecFragmentationVectors);
- // Set _fecEnabled.
- _fecEnabled = enable_fec;
+ // Set fec_enabled_.
+ fec_enabled_ = enable_fec;
}
- _isFirstRED = true; // Make sure we restart FEC.
+ is_first_red_ = true; // Make sure we restart FEC.
return 0;
#else
const bool /* enable_fec */) {
- _fecEnabled = false;
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _id,
- " WEBRTC_CODEC_RED is undefined => _fecEnabled = %d",
- _fecEnabled);
+ fec_enabled_ = false;
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
+ " WEBRTC_CODEC_RED is undefined => fec_enabled_ = %d",
+ fec_enabled_);
return -1;
#endif
}
@@ -1579,7 +1526,7 @@
WebRtc_Word32 AudioCodingModuleImpl::SetVAD(const bool enable_dtx,
const bool enable_vad,
const ACMVADMode mode) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
return SetVADSafe(enable_dtx, enable_vad, mode);
}
@@ -1589,7 +1536,7 @@
// Sanity check of the mode.
if ((mode != VADNormal) && (mode != VADLowBitrate)
&& (mode != VADAggr) && (mode != VADVeryAggr)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Invalid VAD Mode %d, no change is made to VAD/DTX status",
(int) mode);
return -1;
@@ -1597,47 +1544,47 @@
// Check that the send codec is mono. We don't support VAD/DTX for stereo
// sending.
- if ((enable_dtx || enable_vad) && _stereoSend) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if ((enable_dtx || enable_vad) && stereo_send_) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"VAD/DTX not supported for stereo sending");
return -1;
}
// We don't support VAD/DTX when dual-streaming is enabled, i.e.
// secondary-encoder is registered.
- if ((enable_dtx || enable_vad) && _secondaryEncoder.get() != NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if ((enable_dtx || enable_vad) && secondary_encoder_.get() != NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"VAD/DTX not supported when dual-streaming is enabled.");
return -1;
}
// If a send codec is registered, set VAD/DTX for the codec.
if (HaveValidEncoder("SetVAD")) {
- WebRtc_Word16 status = _codecs[_currentSendCodecIdx]->SetVAD(enable_dtx,
- enable_vad,
- mode);
+ WebRtc_Word16 status = codecs_[current_send_codec_idx_]->SetVAD(enable_dtx,
+ enable_vad,
+ mode);
if (status == 1) {
// Vad was enabled.
- _vadEnabled = true;
- _dtxEnabled = enable_dtx;
- _vadMode = mode;
+ vad_enabled_ = true;
+ dtx_enabled_ = enable_dtx;
+ vad_mode_ = mode;
return 0;
} else if (status < 0) {
// SetVAD failed.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVAD failed");
- _vadEnabled = false;
- _dtxEnabled = false;
+ vad_enabled_ = false;
+ dtx_enabled_ = false;
return -1;
}
}
- _vadEnabled = enable_vad;
- _dtxEnabled = enable_dtx;
- _vadMode = mode;
+ vad_enabled_ = enable_vad;
+ dtx_enabled_ = enable_dtx;
+ vad_mode_ = mode;
return 0;
}
@@ -1645,11 +1592,11 @@
// Get VAD/DTX settings.
WebRtc_Word32 AudioCodingModuleImpl::VAD(bool& dtx_enabled, bool& vad_enabled,
ACMVADMode& mode) const {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- dtx_enabled = _dtxEnabled;
- vad_enabled = _vadEnabled;
- mode = _vadMode;
+ dtx_enabled = dtx_enabled_;
+ vad_enabled = vad_enabled_;
+ mode = vad_mode_;
return 0;
}
@@ -1659,7 +1606,7 @@
//
WebRtc_Word32 AudioCodingModuleImpl::InitializeReceiver() {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
return InitializeReceiverSafe();
}
@@ -1668,25 +1615,25 @@
// If the receiver is already initialized then we want to destroy any
// existing decoders. After a call to this function, we should have a clean
// start-up.
- if (_receiverInitialized) {
+ if (receiver_initialized_) {
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
if (UnregisterReceiveCodecSafe(i) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"InitializeReceiver() failed, Could not unregister codec");
return -1;
}
}
}
- if (_netEq.Init() != 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (neteq_.Init() != 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"InitializeReceiver() failed, Could not initialize NetEQ");
return -1;
}
- _netEq.SetUniqueId(_id);
- if (_netEq.AllocatePacketBuffer(ACMCodecDB::NetEQDecoders(),
- ACMCodecDB::kNumCodecs) != 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "NetEQ cannot allocatePacket Buffer");
+ neteq_.set_id(id_);
+ if (neteq_.AllocatePacketBuffer(ACMCodecDB::NetEQDecoders(),
+ ACMCodecDB::kNumCodecs) != 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "NetEQ cannot allocate_packet Buffer");
return -1;
}
@@ -1694,70 +1641,70 @@
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
if (IsCodecRED(i) || IsCodecCN(i)) {
if (RegisterRecCodecMSSafe(ACMCodecDB::database_[i], i, i,
- ACMNetEQ::masterJB) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ ACMNetEQ::kMasterJb) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot register master codec.");
return -1;
}
- _registeredPlTypes[i] = ACMCodecDB::database_[i].pltype;
+ registered_pltypes_[i] = ACMCodecDB::database_[i].pltype;
}
}
- _receiverInitialized = true;
+ receiver_initialized_ = true;
return 0;
}
// Reset the decoder state.
WebRtc_Word32 AudioCodingModuleImpl::ResetDecoder() {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
for (int id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
- if ((_codecs[id] != NULL) && (_registeredPlTypes[id] != -1)) {
- if (_codecs[id]->ResetDecoder(_registeredPlTypes[id]) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if ((codecs_[id] != NULL) && (registered_pltypes_[id] != -1)) {
+ if (codecs_[id]->ResetDecoder(registered_pltypes_[id]) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ResetDecoder failed:");
return -1;
}
}
}
- return _netEq.FlushBuffers();
+ return neteq_.FlushBuffers();
}
// Get current receive frequency.
WebRtc_Word32 AudioCodingModuleImpl::ReceiveFrequency() const {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"ReceiveFrequency()");
WebRtcACMCodecParams codec_params;
- CriticalSectionScoped lock(_acmCritSect);
- if (DecoderParamByPlType(_lastRecvAudioCodecPlType, codec_params) < 0) {
- return _netEq.CurrentSampFreqHz();
- } else if (codec_params.codecInstant.plfreq == 48000) {
+ CriticalSectionScoped lock(acm_crit_sect_);
+ if (DecoderParamByPlType(last_recv_audio_codec_pltype_, codec_params) < 0) {
+ return neteq_.CurrentSampFreqHz();
+ } else if (codec_params.codec_inst.plfreq == 48000) {
// TODO(tlegrand): Remove this option when we have full 48 kHz support.
return 32000;
} else {
- return codec_params.codecInstant.plfreq;
+ return codec_params.codec_inst.plfreq;
}
}
// Get current playout frequency.
WebRtc_Word32 AudioCodingModuleImpl::PlayoutFrequency() const {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"PlayoutFrequency()");
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
- return _netEq.CurrentSampFreqHz();
+ return neteq_.CurrentSampFreqHz();
}
// Register possible receive codecs, can be called multiple times,
// for codecs, CNG (NB, WB and SWB), DTMF, RED.
WebRtc_Word32 AudioCodingModuleImpl::RegisterReceiveCodec(
const CodecInst& receive_codec) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (receive_codec.channels > 2) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"More than 2 audio channel is not supported.");
return -1;
}
@@ -1766,21 +1713,21 @@
int codec_id = ACMCodecDB::ReceiverCodecNumber(&receive_codec, &mirror_id);
if (codec_id < 0 || codec_id >= ACMCodecDB::kNumCodecs) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Wrong codec params to be registered as receive codec");
return -1;
}
// Check if the payload-type is valid.
if (!ACMCodecDB::ValidPayloadType(receive_codec.pltype)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Invalid payload-type %d for %s.", receive_codec.pltype,
receive_codec.plname);
return -1;
}
- if (!_receiverInitialized) {
+ if (!receiver_initialized_) {
if (InitializeReceiverSafe() < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot initialize reciver, so failed registering a codec.");
return -1;
}
@@ -1788,61 +1735,61 @@
// If codec already registered, unregister. Except for CN where we only
// unregister if payload type is changing.
- if ((_registeredPlTypes[codec_id] == receive_codec.pltype)
+ if ((registered_pltypes_[codec_id] == receive_codec.pltype)
&& IsCodecCN(&receive_codec)) {
// Codec already registered as receiver with this payload type. Nothing
// to be done.
return 0;
- } else if (_registeredPlTypes[codec_id] != -1) {
+ } else if (registered_pltypes_[codec_id] != -1) {
if (UnregisterReceiveCodecSafe(codec_id) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot register master codec.");
return -1;
}
}
if (RegisterRecCodecMSSafe(receive_codec, codec_id, mirror_id,
- ACMNetEQ::masterJB) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ ACMNetEQ::kMasterJb) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot register master codec.");
return -1;
}
// TODO(andrew): Refactor how the slave is initialized. Can we instead
// always start up a slave and pre-register CN and RED? We should be able
- // to get rid of _stereoReceiveRegistered.
+ // to get rid of stereo_receive_registered_.
// http://code.google.com/p/webrtc/issues/detail?id=453
// Register stereo codecs with the slave, or, if we've had already seen a
// stereo codec, register CN or RED as a special case.
if (receive_codec.channels == 2 ||
- (_stereoReceiveRegistered && (IsCodecCN(&receive_codec) ||
+ (stereo_receive_registered_ && (IsCodecCN(&receive_codec) ||
IsCodecRED(&receive_codec)))) {
// TODO(andrew): refactor this block to combine with InitStereoSlave().
- if (!_stereoReceiveRegistered) {
+ if (!stereo_receive_registered_) {
// This is the first time a stereo codec has been registered. Make
// some stereo preparations.
// Add a stereo slave.
- assert(_netEq.NumSlaves() == 0);
- if (_netEq.AddSlave(ACMCodecDB::NetEQDecoders(),
- ACMCodecDB::kNumCodecs) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ assert(neteq_.num_slaves() == 0);
+ if (neteq_.AddSlave(ACMCodecDB::NetEQDecoders(),
+ ACMCodecDB::kNumCodecs) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot add slave jitter buffer to NetEQ.");
return -1;
}
// Register any existing CN or RED codecs with the slave and as stereo.
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
- if (_registeredPlTypes[i] != -1 && (IsCodecRED(i) || IsCodecCN(i))) {
- _stereoReceive[i] = true;
+ if (registered_pltypes_[i] != -1 && (IsCodecRED(i) || IsCodecCN(i))) {
+ stereo_receive_[i] = true;
CodecInst codec;
memcpy(&codec, &ACMCodecDB::database_[i], sizeof(CodecInst));
- codec.pltype = _registeredPlTypes[i];
- if (RegisterRecCodecMSSafe(codec, i, i, ACMNetEQ::slaveJB) < 0) {
- WEBRTC_TRACE(kTraceError, kTraceAudioCoding, _id,
+ codec.pltype = registered_pltypes_[i];
+ if (RegisterRecCodecMSSafe(codec, i, i, ACMNetEQ::kSlaveJb) < 0) {
+ WEBRTC_TRACE(kTraceError, kTraceAudioCoding, id_,
"Cannot register slave codec.");
return -1;
}
@@ -1851,65 +1798,65 @@
}
if (RegisterRecCodecMSSafe(receive_codec, codec_id, mirror_id,
- ACMNetEQ::slaveJB) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ ACMNetEQ::kSlaveJb) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot register slave codec.");
return -1;
}
- if (!_stereoReceive[codec_id]
- && (_lastRecvAudioCodecPlType == receive_codec.pltype)) {
+ if (!stereo_receive_[codec_id] &&
+ (last_recv_audio_codec_pltype_ == receive_codec.pltype)) {
// The last received payload type is the same as the one we are
// registering. Expected number of channels to receive is one (mono),
// but we are now registering the receiving codec as stereo (number of
// channels is 2).
- // Set |_lastRecvAudioCodedPlType| to invalid value to trigger a flush in
- // NetEq, and a reset of expected number of channels next time a packet is
- // received in AudioCodingModuleImpl::IncomingPacket().
- _lastRecvAudioCodecPlType = -1;
+ // Set |last_recv_audio_coded_pltype_| to invalid value to trigger a
+ // flush in NetEq, and a reset of expected number of channels next time a
+ // packet is received in AudioCodingModuleImpl::IncomingPacket().
+ last_recv_audio_codec_pltype_ = -1;
}
- _stereoReceive[codec_id] = true;
- _stereoReceiveRegistered = true;
+ stereo_receive_[codec_id] = true;
+ stereo_receive_registered_ = true;
} else {
- if (_lastRecvAudioCodecPlType == receive_codec.pltype &&
- _expected_channels == 2) {
+ if (last_recv_audio_codec_pltype_ == receive_codec.pltype &&
+ expected_channels_ == 2) {
// The last received payload type is the same as the one we are
// registering. Expected number of channels to receive is two (stereo),
// but we are now registering the receiving codec as mono (number of
// channels is 1).
- // Set |_lastRecvAudioCodedPlType| to invalid value to trigger a flush in
- // NetEq, and a reset of expected number of channels next time a packet is
- // received in AudioCodingModuleImpl::IncomingPacket().
- _lastRecvAudioCodecPlType = -1;
+ // Set |last_recv_audio_coded_pl_type_| to invalid value to trigger a
+ // flush in NetEq, and a reset of expected number of channels next time a
+ // packet is received in AudioCodingModuleImpl::IncomingPacket().
+ last_recv_audio_codec_pltype_ = -1;
}
- _stereoReceive[codec_id] = false;
+ stereo_receive_[codec_id] = false;
}
- _registeredPlTypes[codec_id] = receive_codec.pltype;
+ registered_pltypes_[codec_id] = receive_codec.pltype;
if (IsCodecRED(&receive_codec)) {
- _receiveREDPayloadType = receive_codec.pltype;
+ receive_red_pltype_ = receive_codec.pltype;
}
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe(
const CodecInst& receive_codec, WebRtc_Word16 codec_id,
- WebRtc_Word16 mirror_id, ACMNetEQ::JB jitter_buffer) {
+ WebRtc_Word16 mirror_id, ACMNetEQ::JitterBuffer jitter_buffer) {
ACMGenericCodec** codecs;
- if (jitter_buffer == ACMNetEQ::masterJB) {
- codecs = &_codecs[0];
- } else if (jitter_buffer == ACMNetEQ::slaveJB) {
- codecs = &_slaveCodecs[0];
- if (_codecs[codec_id]->IsTrueStereoCodec()) {
+ if (jitter_buffer == ACMNetEQ::kMasterJb) {
+ codecs = &codecs_[0];
+ } else if (jitter_buffer == ACMNetEQ::kSlaveJb) {
+ codecs = &slave_codecs_[0];
+ if (codecs_[codec_id]->IsTrueStereoCodec()) {
// True stereo codecs need to use the same codec memory
// for both master and slave.
- _slaveCodecs[mirror_id] = _codecs[mirror_id];
- _mirrorCodecIdx[mirror_id] = mirror_id;
+ slave_codecs_[mirror_id] = codecs_[mirror_id];
+ mirror_codec_idx_[mirror_id] = mirror_id;
}
} else {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"RegisterReceiveCodecMSSafe failed, jitter_buffer is neither "
"master or slave ");
return -1;
@@ -1918,25 +1865,25 @@
if (codecs[mirror_id] == NULL) {
codecs[mirror_id] = CreateCodec(receive_codec);
if (codecs[mirror_id] == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot create codec to register as receive codec");
return -1;
}
- _mirrorCodecIdx[mirror_id] = mirror_id;
+ mirror_codec_idx_[mirror_id] = mirror_id;
}
if (mirror_id != codec_id) {
codecs[codec_id] = codecs[mirror_id];
- _mirrorCodecIdx[codec_id] = mirror_id;
+ mirror_codec_idx_[codec_id] = mirror_id;
}
- codecs[codec_id]->SetIsMaster(jitter_buffer == ACMNetEQ::masterJB);
+ codecs[codec_id]->SetIsMaster(jitter_buffer == ACMNetEQ::kMasterJb);
WebRtc_Word16 status = 0;
WebRtcACMCodecParams codec_params;
- memcpy(&(codec_params.codecInstant), &receive_codec, sizeof(CodecInst));
- codec_params.enableVAD = false;
- codec_params.enableDTX = false;
- codec_params.vadMode = VADNormal;
+ memcpy(&(codec_params.codec_inst), &receive_codec, sizeof(CodecInst));
+ codec_params.enable_vad = false;
+ codec_params.enable_dtx = false;
+ codec_params.vad_mode = VADNormal;
if (!codecs[codec_id]->DecoderInitialized()) {
// Force initialization.
status = codecs[codec_id]->InitDecoder(&codec_params, true);
@@ -1944,7 +1891,7 @@
// Could not initialize the decoder, we don't want to
// continue if we could not initialize properly.
WEBRTC_TRACE(
- webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"could not initialize the receive codec, codec not registered");
return -1;
@@ -1955,10 +1902,10 @@
codecs[codec_id]->SaveDecoderParam(&codec_params);
}
- if (codecs[codec_id]->RegisterInNetEq(&_netEq, receive_codec) != 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (codecs[codec_id]->RegisterInNetEq(&neteq_, receive_codec) != 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Receive codec could not be registered in NetEQ");
- return -1;
+ return -1;
}
// Guarantee that the same payload-type that is
// registered in NetEQ is stored in the codec.
@@ -1970,15 +1917,16 @@
// Get current received codec.
WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
CodecInst& current_codec) const {
- WebRtcACMCodecParams decoderParam;
- CriticalSectionScoped lock(_acmCritSect);
+ WebRtcACMCodecParams decoder_param;
+ CriticalSectionScoped lock(acm_crit_sect_);
for (int id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
- if (_codecs[id] != NULL) {
- if (_codecs[id]->DecoderInitialized()) {
- if (_codecs[id]->DecoderParams(&decoderParam,
- _lastRecvAudioCodecPlType)) {
- memcpy(¤t_codec, &decoderParam.codecInstant, sizeof(CodecInst));
+ if (codecs_[id] != NULL) {
+ if (codecs_[id]->DecoderInitialized()) {
+ if (codecs_[id]->DecoderParams(&decoder_param,
+ last_recv_audio_codec_pltype_)) {
+ memcpy(¤t_codec, &decoder_param.codec_inst,
+ sizeof(CodecInst));
return 0;
}
}
@@ -2001,39 +1949,22 @@
memcpy(&rtp_header, &rtp_info, sizeof(WebRtcRTPHeader));
if (payload_length < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"IncomingPacket() Error, payload-length cannot be negative");
return -1;
}
{
// Store the payload Type. This will be used to retrieve "received codec"
// and "received frequency."
- CriticalSectionScoped lock(_acmCritSect);
-#ifdef ACM_QA_TEST
- if (_incomingPL != NULL) {
- if (fwrite(&rtp_info.header.timestamp, sizeof(WebRtc_UWord32),
- 1, _incomingPL) != 1) {
- return -1;
- }
- if (fwrite(&rtp_info.header.payloadType, sizeof(WebRtc_UWord8),
- 1, _incomingPL) != 1) {
- return -1;
- }
- if (fwrite(&payload_length, sizeof(WebRtc_Word16),
- 1, _incomingPL) != 1) {
- return -1;
- }
- }
-#endif
-
- WebRtc_UWord8 myPayloadType;
+ CriticalSectionScoped lock(acm_crit_sect_);
+ WebRtc_UWord8 my_payload_type;
// Check if this is an RED payload.
- if (rtp_info.header.payloadType == _receiveREDPayloadType) {
+ if (rtp_info.header.payloadType == receive_red_pltype_) {
// Get the primary payload-type.
- myPayloadType = incoming_payload[0] & 0x7F;
+ my_payload_type = incoming_payload[0] & 0x7F;
} else {
- myPayloadType = rtp_info.header.payloadType;
+ my_payload_type = rtp_info.header.payloadType;
}
// If payload is audio, check if received payload is different from
@@ -2041,108 +1972,108 @@
if (!rtp_info.type.Audio.isCNG) {
// This is Audio not CNG.
- if (myPayloadType != _lastRecvAudioCodecPlType) {
+ if (my_payload_type != last_recv_audio_codec_pltype_) {
// We detect a change in payload type. It is necessary for iSAC
// we are going to use ONE iSAC instance for decoding both WB and
// SWB payloads. If payload is changed there might be a need to reset
// sampling rate of decoder. depending what we have received "now".
for (int i = 0; i < ACMCodecDB::kMaxNumCodecs; i++) {
- if (_registeredPlTypes[i] == myPayloadType) {
+ if (registered_pltypes_[i] == my_payload_type) {
if (UpdateUponReceivingCodec(i) != 0)
return -1;
break;
}
}
}
- _lastRecvAudioCodecPlType = myPayloadType;
+ last_recv_audio_codec_pltype_ = my_payload_type;
}
}
// Split the payload for stereo packets, so that first half of payload
// vector holds left channel, and second half holds right channel.
- if (_expected_channels == 2) {
+ if (expected_channels_ == 2) {
if (!rtp_info.type.Audio.isCNG) {
// Create a new vector for the payload, maximum payload size.
WebRtc_Word32 length = payload_length;
WebRtc_UWord8 payload[kMaxPacketSize];
assert(payload_length <= kMaxPacketSize);
memcpy(payload, incoming_payload, payload_length);
- _codecs[_current_receive_codec_idx]->SplitStereoPacket(payload, &length);
+ codecs_[current_receive_codec_idx_]->SplitStereoPacket(payload, &length);
rtp_header.type.Audio.channel = 2;
// Insert packet into NetEQ.
- return _netEq.RecIn(payload, length, rtp_header);
+ return neteq_.RecIn(payload, length, rtp_header);
} else {
// If we receive a CNG packet while expecting stereo, we ignore the packet
// and continue. CNG is not supported for stereo.
return 0;
}
} else {
- return _netEq.RecIn(incoming_payload, payload_length, rtp_header);
+ return neteq_.RecIn(incoming_payload, payload_length, rtp_header);
}
}
int AudioCodingModuleImpl::UpdateUponReceivingCodec(int index) {
- if (_codecs[index] == NULL) {
- WEBRTC_TRACE(kTraceError, kTraceAudioCoding, _id,
- "IncomingPacket() error: payload type found but corresponding codec "
- "is NULL");
+ if (codecs_[index] == NULL) {
+ WEBRTC_TRACE(kTraceError, kTraceAudioCoding, id_,
+ "IncomingPacket() error: payload type found but "
+ "corresponding codec is NULL");
return -1;
}
- _codecs[index]->UpdateDecoderSampFreq(index);
- _netEq.SetReceivedStereo(_stereoReceive[index]);
- _current_receive_codec_idx = index;
+ codecs_[index]->UpdateDecoderSampFreq(index);
+ neteq_.set_received_stereo(stereo_receive_[index]);
+ current_receive_codec_idx_ = index;
// If we have a change in the expected number of channels, flush packet
// buffers in NetEQ.
- if ((_stereoReceive[index] && (_expected_channels == 1)) ||
- (!_stereoReceive[index] && (_expected_channels == 2))) {
- _netEq.FlushBuffers();
- _codecs[index]->ResetDecoder(_registeredPlTypes[index]);
+ if ((stereo_receive_[index] && (expected_channels_ == 1)) ||
+ (!stereo_receive_[index] && (expected_channels_ == 2))) {
+ neteq_.FlushBuffers();
+ codecs_[index]->ResetDecoder(registered_pltypes_[index]);
}
- if (_stereoReceive[index] && (_expected_channels == 1)) {
+ if (stereo_receive_[index] && (expected_channels_ == 1)) {
// When switching from a mono to stereo codec reset the slave.
if (InitStereoSlave() != 0)
return -1;
}
// Store number of channels we expect to receive for the current payload type.
- if (_stereoReceive[index]) {
- _expected_channels = 2;
+ if (stereo_receive_[index]) {
+ expected_channels_ = 2;
} else {
- _expected_channels = 1;
+ expected_channels_ = 1;
}
// Reset previous received channel.
- _prev_received_channel = 0;
+ prev_received_channel_ = 0;
return 0;
}
bool AudioCodingModuleImpl::IsCodecForSlave(int index) const {
- return (_registeredPlTypes[index] != -1 && _stereoReceive[index]);
+ return (registered_pltypes_[index] != -1 && stereo_receive_[index]);
}
int AudioCodingModuleImpl::InitStereoSlave() {
- _netEq.RemoveSlaves();
+ neteq_.RemoveSlaves();
- if (_netEq.AddSlave(ACMCodecDB::NetEQDecoders(),
- ACMCodecDB::kNumCodecs) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (neteq_.AddSlave(ACMCodecDB::NetEQDecoders(),
+ ACMCodecDB::kNumCodecs) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot add slave jitter buffer to NetEQ.");
return -1;
}
// Register all needed codecs with slave.
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
- if (_codecs[i] != NULL && IsCodecForSlave(i)) {
+ if (codecs_[i] != NULL && IsCodecForSlave(i)) {
WebRtcACMCodecParams decoder_params;
- if (_codecs[i]->DecoderParams(&decoder_params, _registeredPlTypes[i])) {
- if (RegisterRecCodecMSSafe(decoder_params.codecInstant,
+ if (codecs_[i]->DecoderParams(&decoder_params, registered_pltypes_[i])) {
+ if (RegisterRecCodecMSSafe(decoder_params.codec_inst,
i, ACMCodecDB::MirrorID(i),
- ACMNetEQ::slaveJB) < 0) {
- WEBRTC_TRACE(kTraceError, kTraceAudioCoding, _id,
- "Cannot register slave codec.");
- return -1;
+ ACMNetEQ::kSlaveJb) < 0) {
+ WEBRTC_TRACE(kTraceError, kTraceAudioCoding, id_,
+ "Cannot register slave codec.");
+ return -1;
}
}
}
@@ -2154,11 +2085,11 @@
WebRtc_Word32 AudioCodingModuleImpl::SetMinimumPlayoutDelay(
const WebRtc_Word32 time_ms) {
if ((time_ms < 0) || (time_ms > 1000)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Delay must be in the range of 0-1000 milliseconds.");
return -1;
}
- return _netEq.SetExtraDelay(time_ms);
+ return neteq_.SetExtraDelay(time_ms);
}
// Get Dtmf playout status.
@@ -2166,7 +2097,7 @@
#ifndef WEBRTC_CODEC_AVT
return false;
#else
- return _netEq.AVTPlayout();
+ return neteq_.avt_playout();
#endif
}
@@ -2175,12 +2106,12 @@
WebRtc_Word32 AudioCodingModuleImpl::SetDtmfPlayoutStatus(
#ifndef WEBRTC_CODEC_AVT
const bool /* enable */) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, _id,
- "SetDtmfPlayoutStatus() failed: AVT is not supported.");
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
+ "SetDtmfPlayoutStatus() failed: AVT is not supported.");
return -1;
#else
const bool enable) {
- return _netEq.SetAVTPlayout(enable);
+ return neteq_.SetAVTPlayout(enable);
#endif
}
@@ -2190,8 +2121,8 @@
WebRtc_Word32 AudioCodingModuleImpl::DecoderEstimatedBandwidth() const {
CodecInst codec;
WebRtc_Word16 codec_id = -1;
- int payloadtype_wb;
- int payloadtype_swb;
+ int pltype_wb;
+ int pltype_swb;
// Get iSAC settings.
for (int id = 0; id < ACMCodecDB::kNumCodecs; id++) {
@@ -2200,24 +2131,24 @@
if (!STR_CASE_CMP(codec.plname, "isac")) {
codec_id = 1;
- payloadtype_wb = codec.pltype;
+ pltype_wb = codec.pltype;
ACMCodecDB::Codec(id + 1, &codec);
- payloadtype_swb = codec.pltype;
+ pltype_swb = codec.pltype;
break;
}
}
if (codec_id < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"DecoderEstimatedBandwidth failed");
return -1;
}
- if ((_lastRecvAudioCodecPlType == payloadtype_wb) ||
- (_lastRecvAudioCodecPlType == payloadtype_swb)) {
- return _codecs[codec_id]->GetEstimatedBandwidth();
+ if ((last_recv_audio_codec_pltype_ == pltype_wb) ||
+ (last_recv_audio_codec_pltype_ == pltype_swb)) {
+ return codecs_[codec_id]->GetEstimatedBandwidth();
} else {
return -1;
}
@@ -2228,16 +2159,16 @@
const AudioPlayoutMode mode) {
if ((mode != voice) && (mode != fax) && (mode != streaming) &&
(mode != off)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Invalid playout mode.");
return -1;
}
- return _netEq.SetPlayoutMode(mode);
+ return neteq_.SetPlayoutMode(mode);
}
// Get playout mode voice, fax.
AudioPlayoutMode AudioCodingModuleImpl::PlayoutMode() const {
- return _netEq.PlayoutMode();
+ return neteq_.playout_mode();
}
// Get 10 milliseconds of raw audio data to play out.
@@ -2247,38 +2178,38 @@
bool stereo_mode;
// RecOut always returns 10 ms.
- if (_netEq.RecOut(_audioFrame) != 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (neteq_.RecOut(audio_frame_) != 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"PlayoutData failed, RecOut Failed");
return -1;
}
- audio_frame.num_channels_ = _audioFrame.num_channels_;
- audio_frame.vad_activity_ = _audioFrame.vad_activity_;
- audio_frame.speech_type_ = _audioFrame.speech_type_;
+ audio_frame.num_channels_ = audio_frame_.num_channels_;
+ audio_frame.vad_activity_ = audio_frame_.vad_activity_;
+ audio_frame.speech_type_ = audio_frame_.speech_type_;
- stereo_mode = (_audioFrame.num_channels_ > 1);
+ stereo_mode = (audio_frame_.num_channels_ > 1);
// For stereo playout:
// Master and Slave samples are interleaved starting with Master.
const WebRtc_UWord16 receive_freq =
- static_cast<WebRtc_UWord16>(_audioFrame.sample_rate_hz_);
+ static_cast<WebRtc_UWord16>(audio_frame_.sample_rate_hz_);
bool tone_detected = false;
WebRtc_Word16 last_detected_tone;
WebRtc_Word16 tone;
// Limit the scope of ACM Critical section.
{
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if ((receive_freq != desired_freq_hz) && (desired_freq_hz != -1)) {
- // Resample payloadData.
- WebRtc_Word16 temp_len = _outputResampler.Resample10Msec(
- _audioFrame.data_, receive_freq, audio_frame.data_,
- desired_freq_hz, _audioFrame.num_channels_);
+ // Resample payload_data.
+ WebRtc_Word16 temp_len = output_resampler_.Resample10Msec(
+ audio_frame_.data_, receive_freq, audio_frame.data_,
+ desired_freq_hz, audio_frame_.num_channels_);
if (temp_len < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"PlayoutData failed, resampler failed");
return -1;
}
@@ -2288,83 +2219,83 @@
// Set the sampling frequency.
audio_frame.sample_rate_hz_ = desired_freq_hz;
} else {
- memcpy(audio_frame.data_, _audioFrame.data_,
- _audioFrame.samples_per_channel_ * audio_frame.num_channels_
+ memcpy(audio_frame.data_, audio_frame_.data_,
+ audio_frame_.samples_per_channel_ * audio_frame.num_channels_
* sizeof(WebRtc_Word16));
// Set the payload length.
audio_frame.samples_per_channel_ =
- _audioFrame.samples_per_channel_;
+ audio_frame_.samples_per_channel_;
// Set the sampling frequency.
audio_frame.sample_rate_hz_ = receive_freq;
}
// Tone detection done for master channel.
- if (_dtmfDetector != NULL) {
+ if (dtmf_detector_ != NULL) {
// Dtmf Detection.
if (audio_frame.sample_rate_hz_ == 8000) {
// Use audio_frame.data_ then Dtmf detector doesn't
// need resampling.
if (!stereo_mode) {
- _dtmfDetector->Detect(audio_frame.data_,
- audio_frame.samples_per_channel_,
- audio_frame.sample_rate_hz_, tone_detected,
- tone);
+ dtmf_detector_->Detect(audio_frame.data_,
+ audio_frame.samples_per_channel_,
+ audio_frame.sample_rate_hz_, tone_detected,
+ tone);
} else {
// We are in 8 kHz so the master channel needs only 80 samples.
WebRtc_Word16 master_channel[80];
for (int n = 0; n < 80; n++) {
master_channel[n] = audio_frame.data_[n << 1];
}
- _dtmfDetector->Detect(master_channel,
- audio_frame.samples_per_channel_,
- audio_frame.sample_rate_hz_, tone_detected,
- tone);
+ dtmf_detector_->Detect(master_channel,
+ audio_frame.samples_per_channel_,
+ audio_frame.sample_rate_hz_, tone_detected,
+ tone);
}
} else {
- // Do the detection on the audio that we got from NetEQ (_audioFrame).
+ // Do the detection on the audio that we got from NetEQ (audio_frame_).
if (!stereo_mode) {
- _dtmfDetector->Detect(_audioFrame.data_,
- _audioFrame.samples_per_channel_,
- receive_freq, tone_detected, tone);
+ dtmf_detector_->Detect(audio_frame_.data_,
+ audio_frame_.samples_per_channel_,
+ receive_freq, tone_detected, tone);
} else {
WebRtc_Word16 master_channel[WEBRTC_10MS_PCM_AUDIO];
- for (int n = 0; n < _audioFrame.samples_per_channel_; n++) {
- master_channel[n] = _audioFrame.data_[n << 1];
+ for (int n = 0; n < audio_frame_.samples_per_channel_; n++) {
+ master_channel[n] = audio_frame_.data_[n << 1];
}
- _dtmfDetector->Detect(master_channel,
- _audioFrame.samples_per_channel_,
- receive_freq, tone_detected, tone);
+ dtmf_detector_->Detect(master_channel,
+ audio_frame_.samples_per_channel_,
+ receive_freq, tone_detected, tone);
}
}
}
- // We want to do this while we are in _acmCritSect.
+ // We want to do this while we are in acm_crit_sect_.
// (Doesn't really need to initialize the following
// variable but Linux complains if we don't.)
last_detected_tone = kACMToneEnd;
if (tone_detected) {
- last_detected_tone = _lastDetectedTone;
- _lastDetectedTone = tone;
+ last_detected_tone = last_detected_tone_;
+ last_detected_tone_ = tone;
}
}
if (tone_detected) {
// We will deal with callback here, so enter callback critical section.
- CriticalSectionScoped lock(_callbackCritSect);
+ CriticalSectionScoped lock(callback_crit_sect_);
- if (_dtmfCallback != NULL) {
+ if (dtmf_callback_ != NULL) {
if (tone != kACMToneEnd) {
// just a tone
- _dtmfCallback->IncomingDtmf((WebRtc_UWord8) tone, false);
+ dtmf_callback_->IncomingDtmf((WebRtc_UWord8) tone, false);
} else if ((tone == kACMToneEnd) && (last_detected_tone != kACMToneEnd)) {
// The tone is "END" and the previously detected tone is
// not "END," so call fir an end.
- _dtmfCallback->IncomingDtmf((WebRtc_UWord8) last_detected_tone, true);
+ dtmf_callback_->IncomingDtmf((WebRtc_UWord8) last_detected_tone, true);
}
}
}
- audio_frame.id_ = _id;
+ audio_frame.id_ = id_;
audio_frame.energy_ = -1;
audio_frame.timestamp_ = 0;
@@ -2378,12 +2309,12 @@
// Get VAD aggressiveness on the incoming stream
ACMVADMode AudioCodingModuleImpl::ReceiveVADMode() const {
- return _netEq.VADMode();
+ return neteq_.vad_mode();
}
// Configure VAD aggressiveness on the incoming stream.
WebRtc_Word16 AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
- return _netEq.SetVADMode(mode);
+ return neteq_.SetVADMode(mode);
}
/////////////////////////////////////////
@@ -2393,57 +2324,56 @@
WebRtc_Word32 AudioCodingModuleImpl::NetworkStatistics(
ACMNetworkStatistics& statistics) const {
WebRtc_Word32 status;
- status = _netEq.NetworkStatistics(&statistics);
+ status = neteq_.NetworkStatistics(&statistics);
return status;
}
-
void AudioCodingModuleImpl::DestructEncoderInst(void* inst) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"DestructEncoderInst()");
if (!HaveValidEncoder("DestructEncoderInst")) {
return;
}
- _codecs[_currentSendCodecIdx]->DestructEncoderInst(inst);
+ codecs_[current_send_codec_idx_]->DestructEncoderInst(inst);
}
WebRtc_Word16 AudioCodingModuleImpl::AudioBuffer(
WebRtcACMAudioBuff& buffer) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"AudioBuffer()");
if (!HaveValidEncoder("AudioBuffer")) {
return -1;
}
- buffer.lastInTimestamp = _lastInTimestamp;
- return _codecs[_currentSendCodecIdx]->AudioBuffer(buffer);
+ buffer.last_in_timestamp = last_in_timestamp_;
+ return codecs_[current_send_codec_idx_]->AudioBuffer(buffer);
}
WebRtc_Word16 AudioCodingModuleImpl::SetAudioBuffer(
WebRtcACMAudioBuff& buffer) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"SetAudioBuffer()");
if (!HaveValidEncoder("SetAudioBuffer")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->SetAudioBuffer(buffer);
+ return codecs_[current_send_codec_idx_]->SetAudioBuffer(buffer);
}
WebRtc_UWord32 AudioCodingModuleImpl::EarliestTimestamp() const {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"EarliestTimestamp()");
if (!HaveValidEncoder("EarliestTimestamp")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->EarliestTimestamp();
+ return codecs_[current_send_codec_idx_]->EarliestTimestamp();
}
WebRtc_Word32 AudioCodingModuleImpl::RegisterVADCallback(
ACMVADCallback* vad_callback) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"RegisterVADCallback()");
- CriticalSectionScoped lock(_callbackCritSect);
- _vadCallback = vad_callback;
+ CriticalSectionScoped lock(callback_crit_sect_);
+ vad_callback_ = vad_callback;
return 0;
}
@@ -2453,43 +2383,44 @@
const WebRtc_UWord8 payload_type, const WebRtc_UWord32 timestamp) {
if (payload_length < 0) {
// Log error in trace file.
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"IncomingPacket() Error, payload-length cannot be negative");
return -1;
}
- if (_dummyRTPHeader == NULL) {
- // This is the first time that we are using _dummyRTPHeader
+ if (dummy_rtp_header_ == NULL) {
+ // This is the first time that we are using |dummy_rtp_header_|
// so we have to create it.
WebRtcACMCodecParams codec_params;
- _dummyRTPHeader = new WebRtcRTPHeader;
- if (_dummyRTPHeader == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
- "IncomingPacket() Error, out of memory");
+ dummy_rtp_header_ = new WebRtcRTPHeader;
+ if (dummy_rtp_header_ == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "IncomingPayload() Error, out of memory");
return -1;
}
- _dummyRTPHeader->header.payloadType = payload_type;
+ dummy_rtp_header_->header.payloadType = payload_type;
// Don't matter in this case.
- _dummyRTPHeader->header.ssrc = 0;
- _dummyRTPHeader->header.markerBit = false;
+ dummy_rtp_header_->header.ssrc = 0;
+ dummy_rtp_header_->header.markerBit = false;
// Start with random numbers.
- _dummyRTPHeader->header.sequenceNumber = rand();
- _dummyRTPHeader->header.timestamp = (((WebRtc_UWord32) rand()) << 16)
- + (WebRtc_UWord32) rand();
- _dummyRTPHeader->type.Audio.channel = 1;
+ dummy_rtp_header_->header.sequenceNumber = rand();
+ dummy_rtp_header_->header.timestamp =
+ (static_cast<WebRtc_UWord32>(rand()) << 16) +
+ static_cast<WebRtc_UWord32>(rand());
+ dummy_rtp_header_->type.Audio.channel = 1;
if (DecoderParamByPlType(payload_type, codec_params) < 0) {
// We didn't find a codec with the given payload.
- // Something is wrong we exit, but we delete _dummyRTPHeader
+ // Something is wrong we exit, but we delete |dummy_rtp_header_|
// and set it to NULL to start clean next time.
- delete _dummyRTPHeader;
- _dummyRTPHeader = NULL;
+ delete dummy_rtp_header_;
+ dummy_rtp_header_ = NULL;
return -1;
}
- _recvPlFrameSizeSmpls = codec_params.codecInstant.pacsize;
+ recv_pl_frame_size_smpls_ = codec_params.codec_inst.pacsize;
}
- if (payload_type != _dummyRTPHeader->header.payloadType) {
+ if (payload_type != dummy_rtp_header_->header.payloadType) {
// Payload type has changed since the last time we might need to
// update the frame-size.
WebRtcACMCodecParams codec_params;
@@ -2497,38 +2428,38 @@
// We didn't find a codec with the given payload.
return -1;
}
- _recvPlFrameSizeSmpls = codec_params.codecInstant.pacsize;
- _dummyRTPHeader->header.payloadType = payload_type;
+ recv_pl_frame_size_smpls_ = codec_params.codec_inst.pacsize;
+ dummy_rtp_header_->header.payloadType = payload_type;
}
if (timestamp > 0) {
- _dummyRTPHeader->header.timestamp = timestamp;
+ dummy_rtp_header_->header.timestamp = timestamp;
}
// Store the payload Type. this will be used to retrieve "received codec"
// and "received frequency."
- _lastRecvAudioCodecPlType = payload_type;
+ last_recv_audio_codec_pltype_ = payload_type;
// Insert in NetEQ.
- if (_netEq.RecIn(incoming_payload, payload_length, (*_dummyRTPHeader)) < 0) {
+ if (neteq_.RecIn(incoming_payload, payload_length, *dummy_rtp_header_) < 0) {
return -1;
}
// Get ready for the next payload.
- _dummyRTPHeader->header.sequenceNumber++;
- _dummyRTPHeader->header.timestamp += _recvPlFrameSizeSmpls;
+ dummy_rtp_header_->header.sequenceNumber++;
+ dummy_rtp_header_->header.timestamp += recv_pl_frame_size_smpls_;
return 0;
}
WebRtc_Word16 AudioCodingModuleImpl::DecoderParamByPlType(
const WebRtc_UWord8 payload_type,
WebRtcACMCodecParams& codec_params) const {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
for (WebRtc_Word16 id = 0; id < ACMCodecDB::kMaxNumCodecs;
id++) {
- if (_codecs[id] != NULL) {
- if (_codecs[id]->DecoderInitialized()) {
- if (_codecs[id]->DecoderParams(&codec_params, payload_type)) {
+ if (codecs_[id] != NULL) {
+ if (codecs_[id]->DecoderInitialized()) {
+ if (codecs_[id]->DecoderParams(&codec_params, payload_type)) {
return 0;
}
}
@@ -2537,25 +2468,25 @@
// If we are here it means that we could not find a
// codec with that payload type. reset the values to
// not acceptable values and return -1.
- codec_params.codecInstant.plname[0] = '\0';
- codec_params.codecInstant.pacsize = 0;
- codec_params.codecInstant.rate = 0;
- codec_params.codecInstant.pltype = -1;
+ codec_params.codec_inst.plname[0] = '\0';
+ codec_params.codec_inst.pacsize = 0;
+ codec_params.codec_inst.rate = 0;
+ codec_params.codec_inst.pltype = -1;
return -1;
}
WebRtc_Word16 AudioCodingModuleImpl::DecoderListIDByPlName(
const char* name, const WebRtc_UWord16 frequency) const {
WebRtcACMCodecParams codec_params;
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
for (WebRtc_Word16 id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
- if ((_codecs[id] != NULL)) {
- if (_codecs[id]->DecoderInitialized()) {
- assert(_registeredPlTypes[id] >= 0);
- assert(_registeredPlTypes[id] <= 255);
- _codecs[id]->DecoderParams(
- &codec_params, (WebRtc_UWord8) _registeredPlTypes[id]);
- if (!STR_CASE_CMP(codec_params.codecInstant.plname, name)) {
+ if ((codecs_[id] != NULL)) {
+ if (codecs_[id]->DecoderInitialized()) {
+ assert(registered_pltypes_[id] >= 0);
+ assert(registered_pltypes_[id] <= 255);
+ codecs_[id]->DecoderParams(
+ &codec_params, (WebRtc_UWord8) registered_pltypes_[id]);
+ if (!STR_CASE_CMP(codec_params.codec_inst.plname, name)) {
// Check if the given sampling frequency matches.
// A zero sampling frequency means we matching the names
// is sufficient and we don't need to check for the
@@ -2563,7 +2494,7 @@
// Currently it is only iSAC which has one name but two
// sampling frequencies.
if ((frequency == 0)||
- (codec_params.codecInstant.plfreq == frequency)) {
+ (codec_params.codec_inst.plfreq == frequency)) {
return id;
}
}
@@ -2577,32 +2508,32 @@
WebRtc_Word32 AudioCodingModuleImpl::LastEncodedTimestamp(
WebRtc_UWord32& timestamp) const {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("LastEncodedTimestamp")) {
return -1;
}
- timestamp = _codecs[_currentSendCodecIdx]->LastEncodedTimestamp();
+ timestamp = codecs_[current_send_codec_idx_]->LastEncodedTimestamp();
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
bool use_webrtc_dtx) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("ReplaceInternalDTXWithWebRtc")) {
WEBRTC_TRACE(
- webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Cannot replace codec internal DTX when no send codec is registered.");
return -1;
}
- WebRtc_Word32 res = _codecs[_currentSendCodecIdx]->ReplaceInternalDTX(
+ WebRtc_Word32 res = codecs_[current_send_codec_idx_]->ReplaceInternalDTX(
use_webrtc_dtx);
// Check if VAD is turned on, or if there is any error.
if (res == 1) {
- _vadEnabled = true;
+ vad_enabled_ = true;
} else if (res < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Failed to set ReplaceInternalDTXWithWebRtc(%d)",
use_webrtc_dtx);
return res;
@@ -2613,12 +2544,12 @@
WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
bool& uses_webrtc_dtx) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("IsInternalDTXReplacedWithWebRtc")) {
return -1;
}
- if (_codecs[_currentSendCodecIdx]->IsInternalDTXReplaced(&uses_webrtc_dtx)
+ if (codecs_[current_send_codec_idx_]->IsInternalDTXReplaced(&uses_webrtc_dtx)
< 0) {
return -1;
}
@@ -2627,24 +2558,24 @@
WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxRate(
const WebRtc_UWord32 max_bit_per_sec) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxRate")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->SetISACMaxRate(max_bit_per_sec);
+ return codecs_[current_send_codec_idx_]->SetISACMaxRate(max_bit_per_sec);
}
WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxPayloadSize(
const WebRtc_UWord16 max_size_bytes) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxPayloadSize")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->SetISACMaxPayloadSize(
+ return codecs_[current_send_codec_idx_]->SetISACMaxPayloadSize(
max_size_bytes);
}
@@ -2652,53 +2583,53 @@
const WebRtc_UWord8 frame_size_ms,
const WebRtc_UWord16 rate_bit_per_sec,
const bool enforce_frame_size) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("ConfigISACBandwidthEstimator")) {
return -1;
}
- return _codecs[_currentSendCodecIdx]->ConfigISACBandwidthEstimator(
+ return codecs_[current_send_codec_idx_]->ConfigISACBandwidthEstimator(
frame_size_ms, rate_bit_per_sec, enforce_frame_size);
}
WebRtc_Word32 AudioCodingModuleImpl::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode) {
if ((mode < On) || (mode > Off)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"The specified background noise is out of range.\n");
return -1;
}
- return _netEq.SetBackgroundNoiseMode(mode);
+ return neteq_.SetBackgroundNoiseMode(mode);
}
WebRtc_Word32 AudioCodingModuleImpl::BackgroundNoiseMode(
ACMBackgroundNoiseMode& mode) {
- return _netEq.BackgroundNoiseMode(mode);
+ return neteq_.BackgroundNoiseMode(mode);
}
WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp(
WebRtc_UWord32& timestamp) {
- WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"PlayoutTimestamp()");
- return _netEq.PlayoutTimestamp(timestamp);
+ return neteq_.PlayoutTimestamp(timestamp);
}
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
- if ((!_sendCodecRegistered) || (_currentSendCodecIdx < 0) ||
- (_currentSendCodecIdx >= ACMCodecDB::kNumCodecs)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if ((!send_codec_registered_) || (current_send_codec_idx_ < 0) ||
+ (current_send_codec_idx_ >= ACMCodecDB::kNumCodecs)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"%s failed: No send codec is registered.", caller_name);
return false;
}
- if ((_currentSendCodecIdx < 0) ||
- (_currentSendCodecIdx >= ACMCodecDB::kNumCodecs)) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if ((current_send_codec_idx_ < 0) ||
+ (current_send_codec_idx_ >= ACMCodecDB::kNumCodecs)) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"%s failed: Send codec index out of range.", caller_name);
return false;
}
- if (_codecs[_currentSendCodecIdx] == NULL) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ if (codecs_[current_send_codec_idx_] == NULL) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"%s failed: Send codec is NULL pointer.", caller_name);
return false;
}
@@ -2707,12 +2638,12 @@
WebRtc_Word32 AudioCodingModuleImpl::UnregisterReceiveCodec(
const WebRtc_Word16 payload_type) {
- CriticalSectionScoped lock(_acmCritSect);
+ CriticalSectionScoped lock(acm_crit_sect_);
int id;
// Search through the list of registered payload types.
for (id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
- if (_registeredPlTypes[id] == payload_type) {
+ if (registered_pltypes_[id] == payload_type) {
// We have found the id registered with the payload type.
break;
}
@@ -2733,17 +2664,17 @@
WebRtc_Word16 mirror_id = ACMCodecDB::MirrorID(codec_id);
bool stereo_receiver = false;
- if (_codecs[codec_id] != NULL) {
- if (_registeredPlTypes[codec_id] != -1) {
+ if (codecs_[codec_id] != NULL) {
+ if (registered_pltypes_[codec_id] != -1) {
// Store stereo information for future use.
- stereo_receiver = _stereoReceive[codec_id];
+ stereo_receiver = stereo_receive_[codec_id];
// Before deleting the decoder instance unregister from NetEQ.
- if (_netEq.RemoveCodec(neteq_decoder[codec_id],
- _stereoReceive[codec_id]) < 0) {
+ if (neteq_.RemoveCodec(neteq_decoder[codec_id],
+ stereo_receive_[codec_id]) < 0) {
CodecInst codec;
ACMCodecDB::Codec(codec_id, &codec);
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Unregistering %s-%d from NetEQ failed.", codec.plname,
codec.plfreq);
return -1;
@@ -2754,17 +2685,16 @@
if (IsCodecCN(codec_id)) {
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
if (IsCodecCN(i)) {
- _stereoReceive[i] = false;
- _registeredPlTypes[i] = -1;
+ stereo_receive_[i] = false;
+ registered_pltypes_[i] = -1;
}
}
} else {
if (codec_id == mirror_id) {
- _codecs[codec_id]->DestructDecoder();
- if (_stereoReceive[codec_id]) {
- _slaveCodecs[codec_id]->DestructDecoder();
- _stereoReceive[codec_id] = false;
-
+ codecs_[codec_id]->DestructDecoder();
+ if (stereo_receive_[codec_id]) {
+ slave_codecs_[codec_id]->DestructDecoder();
+ stereo_receive_[codec_id] = false;
}
}
}
@@ -2774,7 +2704,7 @@
bool no_stereo = true;
for (int i = 0; i < ACMCodecDB::kNumCodecs; i++) {
- if (_stereoReceive[i]) {
+ if (stereo_receive_[i]) {
// We still have stereo codecs registered.
no_stereo = false;
break;
@@ -2783,18 +2713,18 @@
// If we don't have any stereo codecs left, change status.
if (no_stereo) {
- _netEq.RemoveSlaves(); // No longer need the slave.
- _stereoReceiveRegistered = false;
+ neteq_.RemoveSlaves(); // No longer need the slave.
+ stereo_receive_registered_ = false;
}
}
}
}
- if (_registeredPlTypes[codec_id] == _receiveREDPayloadType) {
+ if (registered_pltypes_[codec_id] == receive_red_pltype_) {
// RED is going to be unregistered, set to an invalid value.
- _receiveREDPayloadType = 255;
+ receive_red_pltype_ = 255;
}
- _registeredPlTypes[codec_id] = -1;
+ registered_pltypes_[codec_id] = -1;
return 0;
}
@@ -2806,24 +2736,24 @@
return -1;
}
WebRtc_Word16 status;
- status = _codecs[_currentSendCodecIdx]->REDPayloadISAC(isac_rate,
- isac_bw_estimate,
- payload,
- length_bytes);
+ status = codecs_[current_send_codec_idx_]->REDPayloadISAC(isac_rate,
+ isac_bw_estimate,
+ payload,
+ length_bytes);
return status;
}
void AudioCodingModuleImpl::ResetFragmentation(int vector_size) {
for (int n = 0; n < kMaxNumFragmentationVectors; n++) {
- _fragmentation.fragmentationOffset[n] = n * MAX_PAYLOAD_SIZE_BYTE;
+ fragmentation_.fragmentationOffset[n] = n * MAX_PAYLOAD_SIZE_BYTE;
}
- memset(_fragmentation.fragmentationLength, 0, kMaxNumFragmentationVectors *
- sizeof(_fragmentation.fragmentationLength[0]));
- memset(_fragmentation.fragmentationTimeDiff, 0, kMaxNumFragmentationVectors *
- sizeof(_fragmentation.fragmentationTimeDiff[0]));
- memset(_fragmentation.fragmentationPlType, 0, kMaxNumFragmentationVectors *
- sizeof(_fragmentation.fragmentationPlType[0]));
- _fragmentation.fragmentationVectorSize =
+ memset(fragmentation_.fragmentationLength, 0, kMaxNumFragmentationVectors *
+ sizeof(fragmentation_.fragmentationLength[0]));
+ memset(fragmentation_.fragmentationTimeDiff, 0, kMaxNumFragmentationVectors *
+ sizeof(fragmentation_.fragmentationTimeDiff[0]));
+ memset(fragmentation_.fragmentationPlType, 0, kMaxNumFragmentationVectors *
+ sizeof(fragmentation_.fragmentationPlType[0]));
+ fragmentation_.fragmentationVectorSize =
static_cast<WebRtc_UWord16>(vector_size);
}
diff --git a/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h b/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h
index c631067..a8950a6 100644
--- a/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h
+++ b/webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h
@@ -11,11 +11,11 @@
#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"
-#include "acm_resampler.h"
-#include "common_types.h"
-#include "engine_configurations.h"
+#include "webrtc/common_types.h"
+#include "webrtc/engine_configurations.h"
+#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
+#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
+#include "webrtc/modules/audio_coding/main/source/acm_resampler.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
namespace webrtc {
@@ -25,14 +25,10 @@
class CriticalSectionWrapper;
class RWLockWrapper;
-#ifdef ACM_QA_TEST
-# include <stdio.h>
-#endif
-
class AudioCodingModuleImpl : public AudioCodingModule {
public:
// Constructor
- AudioCodingModuleImpl(const WebRtc_Word32 id);
+ explicit AudioCodingModuleImpl(const WebRtc_Word32 id);
// Destructor
~AudioCodingModuleImpl();
@@ -77,9 +73,9 @@
// Get current send frequency.
WebRtc_Word32 SendFrequency() const;
- // Get encode bitrate.
+ // Get encode bit-rate.
// Adaptive rate codecs return their current encode target rate, while other
- // codecs return there longterm avarage or their fixed rate.
+ // codecs return there long-term average or their fixed rate.
WebRtc_Word32 SendBitrate() const;
// Set available bandwidth, inform the encoder about the
@@ -96,7 +92,7 @@
WebRtc_Word32 RegisterIncomingMessagesCallback(
AudioCodingFeedback* incoming_message, const ACMCountries cpt);
- // Add 10MS of raw (PCM) audio data to the encoder.
+ // Add 10 ms of raw (PCM) audio data to the encoder.
WebRtc_Word32 Add10MsData(const AudioFrame& audio_frame);
// Set background noise mode for NetEQ, on, off or fade.
@@ -128,7 +124,7 @@
WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled,
ACMVADMode& mode) const;
- WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vadCallback);
+ WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vad_callback);
// Get VAD aggressiveness on the incoming stream.
ACMVADMode ReceiveVADMode() const;
@@ -152,7 +148,7 @@
// Get current playout frequency.
WebRtc_Word32 PlayoutFrequency() const;
- // Register possible reveive codecs, can be called multiple times,
+ // Register possible receive codecs, can be called multiple times,
// for codecs, CNG, DTMF, RED.
WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receive_codec);
@@ -171,7 +167,7 @@
const WebRtc_UWord8 payload_type,
const WebRtc_UWord32 timestamp = 0);
- // Minimum playout dealy (used for lip-sync).
+ // Minimum playout delay (used for lip-sync).
WebRtc_Word32 SetMinimumPlayoutDelay(const WebRtc_Word32 time_ms);
// Configure Dtmf playout status i.e on/off playout the incoming outband Dtmf
@@ -258,7 +254,7 @@
WebRtc_Word32 RegisterRecCodecMSSafe(const CodecInst& receive_codec,
WebRtc_Word16 codec_id,
WebRtc_Word16 mirror_id,
- ACMNetEQ::JB jitter_buffer);
+ ACMNetEQ::JitterBuffer jitter_buffer);
// Set VAD/DTX status. This function does not acquire a lock, and it is
// created to be called only from inside a critical section.
@@ -273,19 +269,16 @@
int ProcessDualStream();
// Preprocessing of input audio, including resampling and down-mixing if
- // required, before pushing audio into encoder'r buffer.
+ // required, before pushing audio into encoder's buffer.
//
// in_frame: input audio-frame
- // out_frame: output audio_frame, the output is valid only if a preprocessing
- // is required.
+ // ptr_out: pointer to output audio_frame. If no preprocessing is required
+ // |ptr_out| will be pointing to |in_frame|, otherwise pointing to
+ // |preprocess_frame_|.
//
// Return value:
// -1: if encountering an error.
- // kPreprocessingSuccessful: if a preprocessing successfully performed.
- // kNoPreprocessingRequired: if there was no need for preprocessing. In
- // this case |out_frame| is not updated and
- // |in_frame| has to be used for further
- // operations.
+ // 0: otherwise.
int PreprocessToAddData(const AudioFrame& in_frame,
const AudioFrame** ptr_out);
@@ -304,89 +297,84 @@
int EncodeFragmentation(int fragmentation_index, int payload_type,
uint32_t current_timestamp,
- ACMGenericCodec* _secondary_encoder,
+ ACMGenericCodec* encoder,
uint8_t* stream);
void ResetFragmentation(int vector_size);
- AudioPacketizationCallback* _packetizationCallback;
- WebRtc_Word32 _id;
- WebRtc_UWord32 _lastTimestamp;
- WebRtc_UWord32 _lastInTimestamp;
- CodecInst _sendCodecInst;
- uint8_t _cng_nb_pltype;
- uint8_t _cng_wb_pltype;
- uint8_t _cng_swb_pltype;
- uint8_t _cng_fb_pltype;
- uint8_t _red_pltype;
- bool _vadEnabled;
- bool _dtxEnabled;
- ACMVADMode _vadMode;
- ACMGenericCodec* _codecs[ACMCodecDB::kMaxNumCodecs];
- ACMGenericCodec* _slaveCodecs[ACMCodecDB::kMaxNumCodecs];
- WebRtc_Word16 _mirrorCodecIdx[ACMCodecDB::kMaxNumCodecs];
- bool _stereoReceive[ACMCodecDB::kMaxNumCodecs];
- bool _stereoReceiveRegistered;
- bool _stereoSend;
- int _prev_received_channel;
- int _expected_channels;
- WebRtc_Word32 _currentSendCodecIdx;
- int _current_receive_codec_idx;
- bool _sendCodecRegistered;
- ACMResampler _inputResampler;
- ACMResampler _outputResampler;
- ACMNetEQ _netEq;
- CriticalSectionWrapper* _acmCritSect;
- ACMVADCallback* _vadCallback;
- WebRtc_UWord8 _lastRecvAudioCodecPlType;
+ AudioPacketizationCallback* packetization_callback_;
+ WebRtc_Word32 id_;
+ WebRtc_UWord32 last_timestamp_;
+ WebRtc_UWord32 last_in_timestamp_;
+ CodecInst send_codec_inst_;
+ uint8_t cng_nb_pltype_;
+ uint8_t cng_wb_pltype_;
+ uint8_t cng_swb_pltype_;
+ uint8_t cng_fb_pltype_;
+ uint8_t red_pltype_;
+ bool vad_enabled_;
+ bool dtx_enabled_;
+ ACMVADMode vad_mode_;
+ ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs];
+ ACMGenericCodec* slave_codecs_[ACMCodecDB::kMaxNumCodecs];
+ WebRtc_Word16 mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs];
+ bool stereo_receive_[ACMCodecDB::kMaxNumCodecs];
+ bool stereo_receive_registered_;
+ bool stereo_send_;
+ int prev_received_channel_;
+ int expected_channels_;
+ WebRtc_Word32 current_send_codec_idx_;
+ int current_receive_codec_idx_;
+ bool send_codec_registered_;
+ ACMResampler input_resampler_;
+ ACMResampler output_resampler_;
+ ACMNetEQ neteq_;
+ CriticalSectionWrapper* acm_crit_sect_;
+ ACMVADCallback* vad_callback_;
+ WebRtc_UWord8 last_recv_audio_codec_pltype_;
// RED/FEC.
- bool _isFirstRED;
- bool _fecEnabled;
- // TODO(turajs): |_redBuffer| is allocated in constructor, why having them
+ bool is_first_red_;
+ bool fec_enabled_;
+ // TODO(turajs): |red_buffer_| is allocated in constructor, why having them
// as pointers and not an array. If concerned about the memory, then make a
// set-up function to allocate them only when they are going to be used, i.e.
// FEC or Dual-streaming is enabled.
- WebRtc_UWord8* _redBuffer;
- // TODO(turajs): we actually don't need |_fragmentation| as a member variable.
+ WebRtc_UWord8* red_buffer_;
+ // TODO(turajs): we actually don't need |fragmentation_| as a member variable.
// It is sufficient to keep the length & payload type of previous payload in
// member variables.
- RTPFragmentationHeader _fragmentation;
- WebRtc_UWord32 _lastFECTimestamp;
+ RTPFragmentationHeader fragmentation_;
+ WebRtc_UWord32 last_fec_timestamp_;
// If no RED is registered as receive codec this
// will have an invalid value.
- WebRtc_UWord8 _receiveREDPayloadType;
+ WebRtc_UWord8 receive_red_pltype_;
// This is to keep track of CN instances where we can send DTMFs.
- WebRtc_UWord8 _previousPayloadType;
+ WebRtc_UWord8 previous_pltype_;
- // This keeps track of payload types associated with _codecs[].
+ // This keeps track of payload types associated with codecs_[].
// We define it as signed variable and initialize with -1 to indicate
// unused elements.
- WebRtc_Word16 _registeredPlTypes[ACMCodecDB::kMaxNumCodecs];
+ WebRtc_Word16 registered_pltypes_[ACMCodecDB::kMaxNumCodecs];
// Used when payloads are pushed into ACM without any RTP info
// One example is when pre-encoded bit-stream is pushed from
// a file.
- WebRtcRTPHeader* _dummyRTPHeader;
- WebRtc_UWord16 _recvPlFrameSizeSmpls;
+ WebRtcRTPHeader* dummy_rtp_header_;
+ WebRtc_UWord16 recv_pl_frame_size_smpls_;
- bool _receiverInitialized;
- ACMDTMFDetection* _dtmfDetector;
+ bool receiver_initialized_;
+ ACMDTMFDetection* dtmf_detector_;
- AudioCodingFeedback* _dtmfCallback;
- WebRtc_Word16 _lastDetectedTone;
- CriticalSectionWrapper* _callbackCritSect;
+ AudioCodingFeedback* dtmf_callback_;
+ WebRtc_Word16 last_detected_tone_;
+ CriticalSectionWrapper* callback_crit_sect_;
- AudioFrame _audioFrame;
- AudioFrame _preprocess_frame;
- CodecInst _secondarySendCodecInst;
- scoped_ptr<ACMGenericCodec> _secondaryEncoder;
-#ifdef ACM_QA_TEST
- FILE* _outgoingPL;
- FILE* _incomingPL;
-#endif
-
+ AudioFrame audio_frame_;
+ AudioFrame preprocess_frame_;
+ CodecInst secondary_send_codec_inst_;
+ scoped_ptr<ACMGenericCodec> secondary_encoder_;
};
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/main/test/Channel.h b/webrtc/modules/audio_coding/main/test/Channel.h
index 617027e..7484584 100644
--- a/webrtc/modules/audio_coding/main/test/Channel.h
+++ b/webrtc/modules/audio_coding/main/test/Channel.h
@@ -16,6 +16,7 @@
#include "audio_coding_module.h"
#include "critical_section_wrapper.h"
#include "rw_lock_wrapper.h"
+#include "webrtc/modules/interface/module_common_types.h"
namespace webrtc {