Changing non-const reference arguments to pointers, ACM
Part of refactoring of ACM, and recent lint-warnings. This CL changes non-const references in the ACM API to pointers. BUG=issue1372 Committed: https://code.google.com/p/webrtc/source/detail?r=3543 Review URL: https://webrtc-codereview.appspot.com/1103012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3555 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f61e02c81f
commit
7a7a008031
@ -111,7 +111,7 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if the list number (list_id) is invalid.
|
// -1 if the list number (list_id) is invalid.
|
||||||
// 0 if succeeded.
|
// 0 if succeeded.
|
||||||
//
|
//
|
||||||
static WebRtc_Word32 Codec(const WebRtc_UWord8 list_id, CodecInst& codec);
|
static WebRtc_Word32 Codec(WebRtc_UWord8 list_id, CodecInst* codec);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 Codec()
|
// WebRtc_Word32 Codec()
|
||||||
@ -132,7 +132,7 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if no codec matches the given parameters.
|
// -1 if no codec matches the given parameters.
|
||||||
// 0 if succeeded.
|
// 0 if succeeded.
|
||||||
//
|
//
|
||||||
static WebRtc_Word32 Codec(const char* payload_name, CodecInst& codec,
|
static WebRtc_Word32 Codec(const char* payload_name, CodecInst* codec,
|
||||||
int sampling_freq_hz, int channels);
|
int sampling_freq_hz, int channels);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -264,7 +264,7 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if failed to get send codec,
|
// -1 if failed to get send codec,
|
||||||
// 0 if succeeded.
|
// 0 if succeeded.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 SendCodec(CodecInst& current_send_codec) const = 0;
|
virtual WebRtc_Word32 SendCodec(CodecInst* current_send_codec) const = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// int SecondarySendCodec()
|
// int SecondarySendCodec()
|
||||||
@ -441,8 +441,8 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if fails to retrieve the setting of DTX/VAD,
|
// -1 if fails to retrieve the setting of DTX/VAD,
|
||||||
// 0 if succeeded.
|
// 0 if succeeded.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled,
|
virtual WebRtc_Word32 VAD(bool* dtx_enabled, bool* vad_enabled,
|
||||||
ACMVADMode& vad_mode) const = 0;
|
ACMVADMode* vad_mode) const = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 ReplaceInternalDTXWithWebRtc()
|
// WebRtc_Word32 ReplaceInternalDTXWithWebRtc()
|
||||||
@ -476,7 +476,7 @@ class AudioCodingModule: public Module {
|
|||||||
// 0 if succeeded.
|
// 0 if succeeded.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(
|
virtual WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(
|
||||||
bool& uses_webrtc_dtx) = 0;
|
bool* uses_webrtc_dtx) = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 RegisterVADCallback()
|
// WebRtc_Word32 RegisterVADCallback()
|
||||||
@ -589,7 +589,7 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if failed to retrieve the codec,
|
// -1 if failed to retrieve the codec,
|
||||||
// 0 if the codec is successfully retrieved.
|
// 0 if the codec is successfully retrieved.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 ReceiveCodec(CodecInst& curr_receive_codec) const = 0;
|
virtual WebRtc_Word32 ReceiveCodec(CodecInst* curr_receive_codec) const = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 IncomingPacket()
|
// WebRtc_Word32 IncomingPacket()
|
||||||
@ -729,7 +729,8 @@ class AudioCodingModule: public Module {
|
|||||||
// 0 if the output is a valid mode.
|
// 0 if the output is a valid mode.
|
||||||
// -1 if ACM failed to output a valid mode.
|
// -1 if ACM failed to output a valid mode.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) = 0;
|
// TODO(tlegrand): Change function to return the mode.
|
||||||
|
virtual WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode* mode) = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 PlayoutTimestamp()
|
// WebRtc_Word32 PlayoutTimestamp()
|
||||||
@ -744,8 +745,8 @@ class AudioCodingModule: public Module {
|
|||||||
// 0 if the output is a correct timestamp.
|
// 0 if the output is a correct timestamp.
|
||||||
// -1 if failed to output the correct timestamp.
|
// -1 if failed to output the correct timestamp.
|
||||||
//
|
//
|
||||||
//
|
// TODO(tlegrand): Change function to return the timestamp.
|
||||||
virtual WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp) = 0;
|
virtual WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32* timestamp) = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// WebRtc_Word32 DecoderEstimatedBandwidth()
|
// WebRtc_Word32 DecoderEstimatedBandwidth()
|
||||||
@ -817,9 +818,8 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if the function fails,
|
// -1 if the function fails,
|
||||||
// 0 if the function succeeds.
|
// 0 if the function succeeds.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32
|
virtual WebRtc_Word32 PlayoutData10Ms(WebRtc_Word32 desired_freq_hz,
|
||||||
PlayoutData10Ms(const WebRtc_Word32 desired_freq_hz,
|
AudioFrame* audio_frame) = 0;
|
||||||
AudioFrame &audio_frame) = 0;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// (CNG) Comfort Noise Generation
|
// (CNG) Comfort Noise Generation
|
||||||
@ -939,7 +939,7 @@ class AudioCodingModule: public Module {
|
|||||||
// 0 if statistics are set successfully.
|
// 0 if statistics are set successfully.
|
||||||
//
|
//
|
||||||
virtual WebRtc_Word32 NetworkStatistics(
|
virtual WebRtc_Word32 NetworkStatistics(
|
||||||
ACMNetworkStatistics& network_statistics) const = 0;
|
ACMNetworkStatistics* network_statistics) const = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set an initial delay for playout.
|
// Set an initial delay for playout.
|
||||||
|
@ -34,15 +34,15 @@ WebRtc_UWord8 AudioCodingModule::NumberOfCodecs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get supported codec param with id
|
// Get supported codec param with id
|
||||||
WebRtc_Word32 AudioCodingModule::Codec(const WebRtc_UWord8 list_id,
|
WebRtc_Word32 AudioCodingModule::Codec(WebRtc_UWord8 list_id,
|
||||||
CodecInst& codec) {
|
CodecInst* codec) {
|
||||||
// Get the codec settings for the codec with the given list ID
|
// Get the codec settings for the codec with the given list ID
|
||||||
return ACMCodecDB::Codec(list_id, &codec);
|
return ACMCodecDB::Codec(list_id, codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get supported codec Param with name, frequency and number of channels.
|
// Get supported codec Param with name, frequency and number of channels.
|
||||||
WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
|
WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
|
||||||
CodecInst& codec, int sampling_freq_hz,
|
CodecInst* codec, int sampling_freq_hz,
|
||||||
int channels) {
|
int channels) {
|
||||||
int codec_id;
|
int codec_id;
|
||||||
|
|
||||||
@ -51,20 +51,20 @@ WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
|
|||||||
if (codec_id < 0) {
|
if (codec_id < 0) {
|
||||||
// We couldn't find a matching codec, set the parameterss to unacceptable
|
// We couldn't find a matching codec, set the parameterss to unacceptable
|
||||||
// values and return.
|
// values and return.
|
||||||
codec.plname[0] = '\0';
|
codec->plname[0] = '\0';
|
||||||
codec.pltype = -1;
|
codec->pltype = -1;
|
||||||
codec.pacsize = 0;
|
codec->pacsize = 0;
|
||||||
codec.rate = 0;
|
codec->rate = 0;
|
||||||
codec.plfreq = 0;
|
codec->plfreq = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get default codec settings.
|
// Get default codec settings.
|
||||||
ACMCodecDB::Codec(codec_id, &codec);
|
ACMCodecDB::Codec(codec_id, codec);
|
||||||
|
|
||||||
// Keep the number of channels from the function call. For most codecs it
|
// Keep the number of channels from the function call. For most codecs it
|
||||||
// will be the same value as in defaul codec settings, but not for all.
|
// will be the same value as in defaul codec settings, but not for all.
|
||||||
codec.channels = channels;
|
codec->channels = channels;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1171,11 +1171,12 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec(
|
|||||||
|
|
||||||
// Get current send codec.
|
// Get current send codec.
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
|
WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
|
||||||
CodecInst& current_codec) const {
|
CodecInst* current_codec) const {
|
||||||
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
||||||
"SendCodec()");
|
"SendCodec()");
|
||||||
CriticalSectionScoped lock(acm_crit_sect_);
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
|
|
||||||
|
assert(current_codec);
|
||||||
if (!send_codec_registered_) {
|
if (!send_codec_registered_) {
|
||||||
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
||||||
"SendCodec Failed, no codec is registered");
|
"SendCodec Failed, no codec is registered");
|
||||||
@ -1185,7 +1186,7 @@ WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
|
|||||||
WebRtcACMCodecParams encoder_param;
|
WebRtcACMCodecParams encoder_param;
|
||||||
codecs_[current_send_codec_idx_]->EncoderParams(&encoder_param);
|
codecs_[current_send_codec_idx_]->EncoderParams(&encoder_param);
|
||||||
encoder_param.codec_inst.pltype = send_codec_inst_.pltype;
|
encoder_param.codec_inst.pltype = send_codec_inst_.pltype;
|
||||||
memcpy(¤t_codec, &(encoder_param.codec_inst), sizeof(CodecInst));
|
memcpy(current_codec, &(encoder_param.codec_inst), sizeof(CodecInst));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1597,13 +1598,14 @@ int AudioCodingModuleImpl::SetVADSafe(bool enable_dtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get VAD/DTX settings.
|
// Get VAD/DTX settings.
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::VAD(bool& dtx_enabled, bool& vad_enabled,
|
// TODO(tlegrand): Change this method to void.
|
||||||
ACMVADMode& mode) const {
|
WebRtc_Word32 AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled,
|
||||||
|
ACMVADMode* mode) const {
|
||||||
CriticalSectionScoped lock(acm_crit_sect_);
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
|
|
||||||
dtx_enabled = dtx_enabled_;
|
*dtx_enabled = dtx_enabled_;
|
||||||
vad_enabled = vad_enabled_;
|
*vad_enabled = vad_enabled_;
|
||||||
mode = vad_mode_;
|
*mode = vad_mode_;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1931,7 +1933,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe(
|
|||||||
|
|
||||||
// Get current received codec.
|
// Get current received codec.
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
|
WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
|
||||||
CodecInst& current_codec) const {
|
CodecInst* current_codec) const {
|
||||||
WebRtcACMCodecParams decoder_param;
|
WebRtcACMCodecParams decoder_param;
|
||||||
CriticalSectionScoped lock(acm_crit_sect_);
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
|
|
||||||
@ -1940,7 +1942,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
|
|||||||
if (codecs_[id]->DecoderInitialized()) {
|
if (codecs_[id]->DecoderInitialized()) {
|
||||||
if (codecs_[id]->DecoderParams(&decoder_param,
|
if (codecs_[id]->DecoderParams(&decoder_param,
|
||||||
last_recv_audio_codec_pltype_)) {
|
last_recv_audio_codec_pltype_)) {
|
||||||
memcpy(¤t_codec, &decoder_param.codec_inst,
|
memcpy(current_codec, &decoder_param.codec_inst,
|
||||||
sizeof(CodecInst));
|
sizeof(CodecInst));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1950,7 +1952,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
|
|||||||
|
|
||||||
// If we are here then we haven't found any codec. Set codec pltype to -1 to
|
// If we are here then we haven't found any codec. Set codec pltype to -1 to
|
||||||
// indicate that the structure is invalid and return -1.
|
// indicate that the structure is invalid and return -1.
|
||||||
current_codec.pltype = -1;
|
current_codec->pltype = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2222,10 +2224,10 @@ AudioPlayoutMode AudioCodingModuleImpl::PlayoutMode() const {
|
|||||||
// Get 10 milliseconds of raw audio data to play out.
|
// Get 10 milliseconds of raw audio data to play out.
|
||||||
// Automatic resample to the requested frequency.
|
// Automatic resample to the requested frequency.
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
||||||
const WebRtc_Word32 desired_freq_hz, AudioFrame& audio_frame) {
|
WebRtc_Word32 desired_freq_hz, AudioFrame* audio_frame) {
|
||||||
bool stereo_mode;
|
bool stereo_mode;
|
||||||
|
|
||||||
if (GetSilence(desired_freq_hz, &audio_frame))
|
if (GetSilence(desired_freq_hz, audio_frame))
|
||||||
return 0; // Silence is generated, return.
|
return 0; // Silence is generated, return.
|
||||||
|
|
||||||
// RecOut always returns 10 ms.
|
// RecOut always returns 10 ms.
|
||||||
@ -2235,9 +2237,9 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_frame.num_channels_ = audio_frame_.num_channels_;
|
audio_frame->num_channels_ = audio_frame_.num_channels_;
|
||||||
audio_frame.vad_activity_ = audio_frame_.vad_activity_;
|
audio_frame->vad_activity_ = audio_frame_.vad_activity_;
|
||||||
audio_frame.speech_type_ = audio_frame_.speech_type_;
|
audio_frame->speech_type_ = audio_frame_.speech_type_;
|
||||||
|
|
||||||
stereo_mode = (audio_frame_.num_channels_ > 1);
|
stereo_mode = (audio_frame_.num_channels_ > 1);
|
||||||
// For stereo playout:
|
// For stereo playout:
|
||||||
@ -2256,7 +2258,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
|||||||
if ((receive_freq != desired_freq_hz) && (desired_freq_hz != -1)) {
|
if ((receive_freq != desired_freq_hz) && (desired_freq_hz != -1)) {
|
||||||
// Resample payload_data.
|
// Resample payload_data.
|
||||||
WebRtc_Word16 temp_len = output_resampler_.Resample10Msec(
|
WebRtc_Word16 temp_len = output_resampler_.Resample10Msec(
|
||||||
audio_frame_.data_, receive_freq, audio_frame.data_,
|
audio_frame_.data_, receive_freq, audio_frame->data_,
|
||||||
desired_freq_hz, audio_frame_.num_channels_);
|
desired_freq_hz, audio_frame_.num_channels_);
|
||||||
|
|
||||||
if (temp_len < 0) {
|
if (temp_len < 0) {
|
||||||
@ -2266,40 +2268,40 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the payload data length from the resampler.
|
// Set the payload data length from the resampler.
|
||||||
audio_frame.samples_per_channel_ = (WebRtc_UWord16) temp_len;
|
audio_frame->samples_per_channel_ = (WebRtc_UWord16) temp_len;
|
||||||
// Set the sampling frequency.
|
// Set the sampling frequency.
|
||||||
audio_frame.sample_rate_hz_ = desired_freq_hz;
|
audio_frame->sample_rate_hz_ = desired_freq_hz;
|
||||||
} else {
|
} else {
|
||||||
memcpy(audio_frame.data_, audio_frame_.data_,
|
memcpy(audio_frame->data_, audio_frame_.data_,
|
||||||
audio_frame_.samples_per_channel_ * audio_frame.num_channels_
|
audio_frame_.samples_per_channel_ * audio_frame->num_channels_
|
||||||
* sizeof(WebRtc_Word16));
|
* sizeof(WebRtc_Word16));
|
||||||
// Set the payload length.
|
// Set the payload length.
|
||||||
audio_frame.samples_per_channel_ =
|
audio_frame->samples_per_channel_ =
|
||||||
audio_frame_.samples_per_channel_;
|
audio_frame_.samples_per_channel_;
|
||||||
// Set the sampling frequency.
|
// Set the sampling frequency.
|
||||||
audio_frame.sample_rate_hz_ = receive_freq;
|
audio_frame->sample_rate_hz_ = receive_freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tone detection done for master channel.
|
// Tone detection done for master channel.
|
||||||
if (dtmf_detector_ != NULL) {
|
if (dtmf_detector_ != NULL) {
|
||||||
// Dtmf Detection.
|
// Dtmf Detection.
|
||||||
if (audio_frame.sample_rate_hz_ == 8000) {
|
if (audio_frame->sample_rate_hz_ == 8000) {
|
||||||
// Use audio_frame.data_ then Dtmf detector doesn't
|
// Use audio_frame->data_ then Dtmf detector doesn't
|
||||||
// need resampling.
|
// need resampling.
|
||||||
if (!stereo_mode) {
|
if (!stereo_mode) {
|
||||||
dtmf_detector_->Detect(audio_frame.data_,
|
dtmf_detector_->Detect(audio_frame->data_,
|
||||||
audio_frame.samples_per_channel_,
|
audio_frame->samples_per_channel_,
|
||||||
audio_frame.sample_rate_hz_, tone_detected,
|
audio_frame->sample_rate_hz_, tone_detected,
|
||||||
tone);
|
tone);
|
||||||
} else {
|
} else {
|
||||||
// We are in 8 kHz so the master channel needs only 80 samples.
|
// We are in 8 kHz so the master channel needs only 80 samples.
|
||||||
WebRtc_Word16 master_channel[80];
|
WebRtc_Word16 master_channel[80];
|
||||||
for (int n = 0; n < 80; n++) {
|
for (int n = 0; n < 80; n++) {
|
||||||
master_channel[n] = audio_frame.data_[n << 1];
|
master_channel[n] = audio_frame->data_[n << 1];
|
||||||
}
|
}
|
||||||
dtmf_detector_->Detect(master_channel,
|
dtmf_detector_->Detect(master_channel,
|
||||||
audio_frame.samples_per_channel_,
|
audio_frame->samples_per_channel_,
|
||||||
audio_frame.sample_rate_hz_, tone_detected,
|
audio_frame->sample_rate_hz_, tone_detected,
|
||||||
tone);
|
tone);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2346,9 +2348,9 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_frame.id_ = id_;
|
audio_frame->id_ = id_;
|
||||||
audio_frame.energy_ = -1;
|
audio_frame->energy_ = -1;
|
||||||
audio_frame.timestamp_ = 0;
|
audio_frame->timestamp_ = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2373,9 +2375,9 @@ WebRtc_Word16 AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::NetworkStatistics(
|
WebRtc_Word32 AudioCodingModuleImpl::NetworkStatistics(
|
||||||
ACMNetworkStatistics& statistics) const {
|
ACMNetworkStatistics* statistics) const {
|
||||||
WebRtc_Word32 status;
|
WebRtc_Word32 status;
|
||||||
status = neteq_.NetworkStatistics(&statistics);
|
status = neteq_.NetworkStatistics(statistics);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2594,13 +2596,13 @@ WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
|
WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
|
||||||
bool& uses_webrtc_dtx) {
|
bool* uses_webrtc_dtx) {
|
||||||
CriticalSectionScoped lock(acm_crit_sect_);
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
|
|
||||||
if (!HaveValidEncoder("IsInternalDTXReplacedWithWebRtc")) {
|
if (!HaveValidEncoder("IsInternalDTXReplacedWithWebRtc")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (codecs_[current_send_codec_idx_]->IsInternalDTXReplaced(&uses_webrtc_dtx)
|
if (codecs_[current_send_codec_idx_]->IsInternalDTXReplaced(uses_webrtc_dtx)
|
||||||
< 0) {
|
< 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2655,19 +2657,19 @@ WebRtc_Word32 AudioCodingModuleImpl::SetBackgroundNoiseMode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::BackgroundNoiseMode(
|
WebRtc_Word32 AudioCodingModuleImpl::BackgroundNoiseMode(
|
||||||
ACMBackgroundNoiseMode& mode) {
|
ACMBackgroundNoiseMode* mode) {
|
||||||
return neteq_.BackgroundNoiseMode(mode);
|
return neteq_.BackgroundNoiseMode(*mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp(
|
WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp(
|
||||||
WebRtc_UWord32& timestamp) {
|
WebRtc_UWord32* timestamp) {
|
||||||
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
|
||||||
"PlayoutTimestamp()");
|
"PlayoutTimestamp()");
|
||||||
if (track_neteq_buffer_) {
|
if (track_neteq_buffer_) {
|
||||||
timestamp = playout_ts_;
|
*timestamp = playout_ts_;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return neteq_.PlayoutTimestamp(timestamp);
|
return neteq_.PlayoutTimestamp(*timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
int SecondarySendCodec(CodecInst* secondary_codec) const;
|
int SecondarySendCodec(CodecInst* secondary_codec) const;
|
||||||
|
|
||||||
// Get current send codec.
|
// Get current send codec.
|
||||||
WebRtc_Word32 SendCodec(CodecInst& current_codec) const;
|
WebRtc_Word32 SendCodec(CodecInst* current_codec) const;
|
||||||
|
|
||||||
// Get current send frequency.
|
// Get current send frequency.
|
||||||
WebRtc_Word32 SendFrequency() const;
|
WebRtc_Word32 SendFrequency() const;
|
||||||
@ -99,7 +99,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
WebRtc_Word32 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
|
WebRtc_Word32 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
|
||||||
|
|
||||||
// Get current background noise mode.
|
// Get current background noise mode.
|
||||||
WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode);
|
WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode* mode);
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// (FEC) Forward Error Correction
|
// (FEC) Forward Error Correction
|
||||||
@ -121,8 +121,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
const bool enable_vad = false,
|
const bool enable_vad = false,
|
||||||
const ACMVADMode mode = VADNormal);
|
const ACMVADMode mode = VADNormal);
|
||||||
|
|
||||||
WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled,
|
WebRtc_Word32 VAD(bool* dtx_enabled, bool* vad_enabled,
|
||||||
ACMVADMode& mode) const;
|
ACMVADMode* mode) const;
|
||||||
|
|
||||||
WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vad_callback);
|
WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vad_callback);
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receive_codec);
|
WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receive_codec);
|
||||||
|
|
||||||
// Get current received codec.
|
// Get current received codec.
|
||||||
WebRtc_Word32 ReceiveCodec(CodecInst& current_codec) const;
|
WebRtc_Word32 ReceiveCodec(CodecInst* current_codec) const;
|
||||||
|
|
||||||
// Incoming packet from network parsed and ready for decode.
|
// Incoming packet from network parsed and ready for decode.
|
||||||
WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_payload,
|
WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_payload,
|
||||||
@ -189,18 +189,18 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
AudioPlayoutMode PlayoutMode() const;
|
AudioPlayoutMode PlayoutMode() const;
|
||||||
|
|
||||||
// Get playout timestamp.
|
// Get playout timestamp.
|
||||||
WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp);
|
WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32* timestamp);
|
||||||
|
|
||||||
// Get 10 milliseconds of raw audio data to play out, and
|
// Get 10 milliseconds of raw audio data to play out, and
|
||||||
// automatic resample to the requested frequency if > 0.
|
// automatic resample to the requested frequency if > 0.
|
||||||
WebRtc_Word32 PlayoutData10Ms(const WebRtc_Word32 desired_freq_hz,
|
WebRtc_Word32 PlayoutData10Ms(WebRtc_Word32 desired_freq_hz,
|
||||||
AudioFrame &audio_frame);
|
AudioFrame* audio_frame);
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// Statistics
|
// Statistics
|
||||||
//
|
//
|
||||||
|
|
||||||
WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics& statistics) const;
|
WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics* statistics) const;
|
||||||
|
|
||||||
void DestructEncoderInst(void* inst);
|
void DestructEncoderInst(void* inst);
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
|
|
||||||
WebRtc_Word32 ReplaceInternalDTXWithWebRtc(const bool use_webrtc_dtx);
|
WebRtc_Word32 ReplaceInternalDTXWithWebRtc(const bool use_webrtc_dtx);
|
||||||
|
|
||||||
WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(bool& uses_webrtc_dtx);
|
WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx);
|
||||||
|
|
||||||
WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_bit_per_sec);
|
WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_bit_per_sec);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ APITest::SetUp()
|
|||||||
WebRtc_Word16 numCodecs = _acmA->NumberOfCodecs();
|
WebRtc_Word16 numCodecs = _acmA->NumberOfCodecs();
|
||||||
for(WebRtc_UWord8 n = 0; n < numCodecs; n++)
|
for(WebRtc_UWord8 n = 0; n < numCodecs; n++)
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(n, dummyCodec);
|
AudioCodingModule::Codec(n, &dummyCodec);
|
||||||
if((STR_CASE_CMP(dummyCodec.plname, "CN") == 0) &&
|
if((STR_CASE_CMP(dummyCodec.plname, "CN") == 0) &&
|
||||||
(dummyCodec.plfreq == 32000))
|
(dummyCodec.plfreq == 32000))
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ APITest::SetUp()
|
|||||||
// test if re-registration works;
|
// test if re-registration works;
|
||||||
CodecInst nextCodec;
|
CodecInst nextCodec;
|
||||||
int currentPayloadType = dummyCodec.pltype;
|
int currentPayloadType = dummyCodec.pltype;
|
||||||
AudioCodingModule::Codec(n + 1, nextCodec);
|
AudioCodingModule::Codec(n + 1, &nextCodec);
|
||||||
dummyCodec.pltype = nextCodec.pltype;
|
dummyCodec.pltype = nextCodec.pltype;
|
||||||
if(!FixedPayloadTypeCodec(nextCodec.plname))
|
if(!FixedPayloadTypeCodec(nextCodec.plname))
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ APITest::SetUp()
|
|||||||
{
|
{
|
||||||
// test if un-registration works;
|
// test if un-registration works;
|
||||||
CodecInst nextCodec;
|
CodecInst nextCodec;
|
||||||
AudioCodingModule::Codec(n + 1, nextCodec);
|
AudioCodingModule::Codec(n + 1, &nextCodec);
|
||||||
nextCodec.pltype = dummyCodec.pltype;
|
nextCodec.pltype = dummyCodec.pltype;
|
||||||
if(!FixedPayloadTypeCodec(nextCodec.plname))
|
if(!FixedPayloadTypeCodec(nextCodec.plname))
|
||||||
{
|
{
|
||||||
@ -248,11 +248,11 @@ APITest::SetUp()
|
|||||||
_thereIsDecoderB = true;
|
_thereIsDecoderB = true;
|
||||||
|
|
||||||
// Register Send Codec
|
// Register Send Codec
|
||||||
AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrA, dummyCodec);
|
AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrA, &dummyCodec);
|
||||||
CHECK_ERROR_MT(_acmA->RegisterSendCodec(dummyCodec));
|
CHECK_ERROR_MT(_acmA->RegisterSendCodec(dummyCodec));
|
||||||
_thereIsEncoderA = true;
|
_thereIsEncoderA = true;
|
||||||
//
|
//
|
||||||
AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrB, dummyCodec);
|
AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrB, &dummyCodec);
|
||||||
CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec));
|
CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec));
|
||||||
_thereIsEncoderB = true;
|
_thereIsEncoderB = true;
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ APITest::PullAudioRunA()
|
|||||||
{
|
{
|
||||||
_pullEventA->Wait(100);
|
_pullEventA->Wait(100);
|
||||||
AudioFrame audioFrame;
|
AudioFrame audioFrame;
|
||||||
if(_acmA->PlayoutData10Ms(_outFreqHzA, audioFrame) < 0)
|
if(_acmA->PlayoutData10Ms(_outFreqHzA, &audioFrame) < 0)
|
||||||
{
|
{
|
||||||
bool thereIsDecoder;
|
bool thereIsDecoder;
|
||||||
{
|
{
|
||||||
@ -438,7 +438,7 @@ APITest::PullAudioRunB()
|
|||||||
{
|
{
|
||||||
_pullEventB->Wait(100);
|
_pullEventB->Wait(100);
|
||||||
AudioFrame audioFrame;
|
AudioFrame audioFrame;
|
||||||
if(_acmB->PlayoutData10Ms(_outFreqHzB, audioFrame) < 0)
|
if(_acmB->PlayoutData10Ms(_outFreqHzB, &audioFrame) < 0)
|
||||||
{
|
{
|
||||||
bool thereIsDecoder;
|
bool thereIsDecoder;
|
||||||
{
|
{
|
||||||
@ -794,7 +794,7 @@ APITest::CheckVADStatus(char side)
|
|||||||
|
|
||||||
if(side == 'A')
|
if(side == 'A')
|
||||||
{
|
{
|
||||||
_acmA->VAD(dtxEnabled, vadEnabled, vadMode);
|
_acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode);
|
||||||
_acmA->RegisterVADCallback(NULL);
|
_acmA->RegisterVADCallback(NULL);
|
||||||
_vadCallbackA->Reset();
|
_vadCallbackA->Reset();
|
||||||
_acmA->RegisterVADCallback(_vadCallbackA);
|
_acmA->RegisterVADCallback(_vadCallbackA);
|
||||||
@ -838,7 +838,7 @@ APITest::CheckVADStatus(char side)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_acmB->VAD(dtxEnabled, vadEnabled, vadMode);
|
_acmB->VAD(&dtxEnabled, &vadEnabled, &vadMode);
|
||||||
|
|
||||||
_acmB->RegisterVADCallback(NULL);
|
_acmB->RegisterVADCallback(NULL);
|
||||||
_vadCallbackB->Reset();
|
_vadCallbackB->Reset();
|
||||||
@ -920,7 +920,7 @@ APITest::TestDelay(char side)
|
|||||||
|
|
||||||
|
|
||||||
inTimestamp = myChannel->LastInTimestamp();
|
inTimestamp = myChannel->LastInTimestamp();
|
||||||
CHECK_ERROR_MT(myACM->PlayoutTimestamp(outTimestamp));
|
CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp));
|
||||||
|
|
||||||
if(!_randomTest)
|
if(!_randomTest)
|
||||||
{
|
{
|
||||||
@ -932,7 +932,7 @@ APITest::TestDelay(char side)
|
|||||||
myEvent->Wait(1000);
|
myEvent->Wait(1000);
|
||||||
|
|
||||||
inTimestamp = myChannel->LastInTimestamp();
|
inTimestamp = myChannel->LastInTimestamp();
|
||||||
CHECK_ERROR_MT(myACM->PlayoutTimestamp(outTimestamp));
|
CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp));
|
||||||
|
|
||||||
//std::cout << outTimestamp << std::endl << std::flush;
|
//std::cout << outTimestamp << std::endl << std::flush;
|
||||||
estimDelay = (double)((WebRtc_UWord32)(inTimestamp - outTimestamp)) /
|
estimDelay = (double)((WebRtc_UWord32)(inTimestamp - outTimestamp)) /
|
||||||
@ -968,7 +968,7 @@ APITest::TestDelay(char side)
|
|||||||
*myMinDelay = (rand() % 1000) + 1;
|
*myMinDelay = (rand() % 1000) + 1;
|
||||||
|
|
||||||
ACMNetworkStatistics networkStat;
|
ACMNetworkStatistics networkStat;
|
||||||
CHECK_ERROR_MT(myACM->NetworkStatistics(networkStat));
|
CHECK_ERROR_MT(myACM->NetworkStatistics(&networkStat));
|
||||||
|
|
||||||
if(!_randomTest)
|
if(!_randomTest)
|
||||||
{
|
{
|
||||||
@ -1039,9 +1039,9 @@ APITest::TestRegisteration(char sendSide)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodecInst myCodec;
|
CodecInst myCodec;
|
||||||
if(sendACM->SendCodec(myCodec) < 0)
|
if(sendACM->SendCodec(&myCodec) < 0)
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(_codecCntrA, myCodec);
|
AudioCodingModule::Codec(_codecCntrA, &myCodec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_randomTest)
|
if(!_randomTest)
|
||||||
@ -1332,7 +1332,7 @@ APITest::TestSendVAD(char side)
|
|||||||
|
|
||||||
if(side == 'A')
|
if(side == 'A')
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(_codecCntrA, myCodec);
|
AudioCodingModule::Codec(_codecCntrA, &myCodec);
|
||||||
vad = &_sendVADA;
|
vad = &_sendVADA;
|
||||||
dtx = &_sendDTXA;
|
dtx = &_sendDTXA;
|
||||||
mode = &_sendVADModeA;
|
mode = &_sendVADModeA;
|
||||||
@ -1341,7 +1341,7 @@ APITest::TestSendVAD(char side)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(_codecCntrB, myCodec);
|
AudioCodingModule::Codec(_codecCntrB, &myCodec);
|
||||||
vad = &_sendVADB;
|
vad = &_sendVADB;
|
||||||
dtx = &_sendDTXB;
|
dtx = &_sendDTXB;
|
||||||
mode = &_sendVADModeB;
|
mode = &_sendVADModeB;
|
||||||
@ -1408,11 +1408,11 @@ APITest::CurrentCodec(char side)
|
|||||||
CodecInst myCodec;
|
CodecInst myCodec;
|
||||||
if(side == 'A')
|
if(side == 'A')
|
||||||
{
|
{
|
||||||
_acmA->SendCodec(myCodec);
|
_acmA->SendCodec(&myCodec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_acmB->SendCodec(myCodec);
|
_acmB->SendCodec(&myCodec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_randomTest)
|
if(!_randomTest)
|
||||||
@ -1493,11 +1493,11 @@ APITest::ChangeCodec(char side)
|
|||||||
Wait(1000);
|
Wait(1000);
|
||||||
|
|
||||||
// After Initialization CN is lost, re-register them
|
// After Initialization CN is lost, re-register them
|
||||||
if(AudioCodingModule::Codec("CN", myCodec, 8000, 1) >= 0)
|
if(AudioCodingModule::Codec("CN", &myCodec, 8000, 1) >= 0)
|
||||||
{
|
{
|
||||||
CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec));
|
CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec));
|
||||||
}
|
}
|
||||||
if(AudioCodingModule::Codec("CN", myCodec, 16000, 1) >= 0)
|
if(AudioCodingModule::Codec("CN", &myCodec, 16000, 1) >= 0)
|
||||||
{
|
{
|
||||||
CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec));
|
CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec));
|
||||||
}
|
}
|
||||||
@ -1507,7 +1507,7 @@ APITest::ChangeCodec(char side)
|
|||||||
_writeToFile = false;
|
_writeToFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCodingModule::Codec(*codecCntr, myCodec);
|
AudioCodingModule::Codec(*codecCntr, &myCodec);
|
||||||
} while(!STR_CASE_CMP(myCodec.plname, "CN") ||
|
} while(!STR_CASE_CMP(myCodec.plname, "CN") ||
|
||||||
!STR_CASE_CMP(myCodec.plname, "telephone-event") ||
|
!STR_CASE_CMP(myCodec.plname, "telephone-event") ||
|
||||||
!STR_CASE_CMP(myCodec.plname, "RED"));
|
!STR_CASE_CMP(myCodec.plname, "RED"));
|
||||||
|
@ -73,14 +73,14 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
// Choose codec on command line.
|
// Choose codec on command line.
|
||||||
printf("List of supported codec.\n");
|
printf("List of supported codec.\n");
|
||||||
for (int n = 0; n < noOfCodecs; n++) {
|
for (int n = 0; n < noOfCodecs; n++) {
|
||||||
acm->Codec(n, sendCodec);
|
acm->Codec(n, &sendCodec);
|
||||||
printf("%d %s\n", n, sendCodec.plname);
|
printf("%d %s\n", n, sendCodec.plname);
|
||||||
}
|
}
|
||||||
printf("Choose your codec:");
|
printf("Choose your codec:");
|
||||||
ASSERT_GT(scanf("%d", &codecNo), 0);
|
ASSERT_GT(scanf("%d", &codecNo), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
acm->Codec(codecNo, sendCodec);
|
acm->Codec(codecNo, &sendCodec);
|
||||||
if (!strcmp(sendCodec.plname, "CELT")) {
|
if (!strcmp(sendCodec.plname, "CELT")) {
|
||||||
sendCodec.channels = 1;
|
sendCodec.channels = 1;
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
|||||||
|
|
||||||
noOfCodecs = acm->NumberOfCodecs();
|
noOfCodecs = acm->NumberOfCodecs();
|
||||||
for (int i = 0; i < noOfCodecs; i++) {
|
for (int i = 0; i < noOfCodecs; i++) {
|
||||||
acm->Codec((WebRtc_UWord8) i, recvCodec);
|
acm->Codec((WebRtc_UWord8) i, &recvCodec);
|
||||||
if (acm->RegisterReceiveCodec(recvCodec) != 0) {
|
if (acm->RegisterReceiveCodec(recvCodec) != 0) {
|
||||||
printf("Unable to register codec: for run: codecId: %d\n", codeId);
|
printf("Unable to register codec: for run: codecId: %d\n", codeId);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -224,7 +224,7 @@ bool Receiver::IncomingPacket() {
|
|||||||
bool Receiver::PlayoutData() {
|
bool Receiver::PlayoutData() {
|
||||||
AudioFrame audioFrame;
|
AudioFrame audioFrame;
|
||||||
|
|
||||||
if (_acm->PlayoutData10Ms(_frequency, audioFrame) != 0) {
|
if (_acm->PlayoutData10Ms(_frequency, &audioFrame) != 0) {
|
||||||
printf("Error when calling PlayoutData10Ms, for run: codecId: %d\n",
|
printf("Error when calling PlayoutData10Ms, for run: codecId: %d\n",
|
||||||
codeId);
|
codeId);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -305,7 +305,7 @@ void EncodeDecodeTest::Perform() {
|
|||||||
}
|
}
|
||||||
if (_testMode != 2) {
|
if (_testMode != 2) {
|
||||||
for (int n = 0; n < numCodecs; n++) {
|
for (int n = 0; n < numCodecs; n++) {
|
||||||
acm->Codec(n, sendCodecTmp);
|
acm->Codec(n, &sendCodecTmp);
|
||||||
if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) {
|
if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) {
|
||||||
numPars[n] = 0;
|
numPars[n] = 0;
|
||||||
} else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) {
|
} else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) {
|
||||||
@ -381,7 +381,7 @@ void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
|
|||||||
|
|
||||||
_sender.Setup(acm, &rtpFile);
|
_sender.Setup(acm, &rtpFile);
|
||||||
struct CodecInst sendCodecInst;
|
struct CodecInst sendCodecInst;
|
||||||
if (acm->SendCodec(sendCodecInst) >= 0) {
|
if (acm->SendCodec(&sendCodecInst) >= 0) {
|
||||||
_sender.Run();
|
_sender.Run();
|
||||||
}
|
}
|
||||||
_sender.Teardown();
|
_sender.Teardown();
|
||||||
|
@ -82,7 +82,7 @@ SpatialAudio::Setup()
|
|||||||
WebRtc_UWord8 num_encoders = _acmReceiver->NumberOfCodecs();
|
WebRtc_UWord8 num_encoders = _acmReceiver->NumberOfCodecs();
|
||||||
// Register all available codes as receiving codecs once more.
|
// Register all available codes as receiving codecs once more.
|
||||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
status = _acmReceiver->Codec(n, codecInst);
|
status = _acmReceiver->Codec(n, &codecInst);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
printf("Error in Codec(), no matching codec found");
|
printf("Error in Codec(), no matching codec found");
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ SpatialAudio::Perform()
|
|||||||
Setup();
|
Setup();
|
||||||
|
|
||||||
CodecInst codecInst;
|
CodecInst codecInst;
|
||||||
_acmLeft->Codec((WebRtc_UWord8)1, codecInst);
|
_acmLeft->Codec((WebRtc_UWord8)1, &codecInst);
|
||||||
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
||||||
EncodeDecode();
|
EncodeDecode();
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ SpatialAudio::Perform()
|
|||||||
|
|
||||||
while((pannCntr + 1) < NUM_PANN_COEFFS)
|
while((pannCntr + 1) < NUM_PANN_COEFFS)
|
||||||
{
|
{
|
||||||
_acmLeft->Codec((WebRtc_UWord8)0, codecInst);
|
_acmLeft->Codec((WebRtc_UWord8)0, &codecInst);
|
||||||
codecInst.pacsize = 480;
|
codecInst.pacsize = 480;
|
||||||
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
||||||
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
||||||
@ -131,7 +131,7 @@ SpatialAudio::Perform()
|
|||||||
pannCntr++;
|
pannCntr++;
|
||||||
|
|
||||||
// Change codec
|
// Change codec
|
||||||
_acmLeft->Codec((WebRtc_UWord8)3, codecInst);
|
_acmLeft->Codec((WebRtc_UWord8)3, &codecInst);
|
||||||
codecInst.pacsize = 320;
|
codecInst.pacsize = 320;
|
||||||
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
||||||
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
||||||
@ -144,11 +144,11 @@ SpatialAudio::Perform()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_acmLeft->Codec((WebRtc_UWord8)4, codecInst);
|
_acmLeft->Codec((WebRtc_UWord8)4, &codecInst);
|
||||||
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
||||||
EncodeDecode();
|
EncodeDecode();
|
||||||
|
|
||||||
_acmLeft->Codec((WebRtc_UWord8)0, codecInst);
|
_acmLeft->Codec((WebRtc_UWord8)0, &codecInst);
|
||||||
codecInst.pacsize = 480;
|
codecInst.pacsize = 480;
|
||||||
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst));
|
||||||
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst));
|
||||||
@ -200,7 +200,8 @@ SpatialAudio::EncodeDecode(
|
|||||||
CHECK_ERROR(_acmLeft->Process());
|
CHECK_ERROR(_acmLeft->Process());
|
||||||
CHECK_ERROR(_acmRight->Process());
|
CHECK_ERROR(_acmRight->Process());
|
||||||
|
|
||||||
CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, audioFrame));
|
CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq,
|
||||||
|
&audioFrame));
|
||||||
_outFile.Write10MsData(audioFrame);
|
_outFile.Write10MsData(audioFrame);
|
||||||
}
|
}
|
||||||
_inFile.Rewind();
|
_inFile.Rewind();
|
||||||
@ -221,7 +222,8 @@ SpatialAudio::EncodeDecode()
|
|||||||
|
|
||||||
CHECK_ERROR(_acmLeft->Process());
|
CHECK_ERROR(_acmLeft->Process());
|
||||||
|
|
||||||
CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, audioFrame));
|
CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq,
|
||||||
|
&audioFrame));
|
||||||
_outFile.Write10MsData(audioFrame);
|
_outFile.Write10MsData(audioFrame);
|
||||||
}
|
}
|
||||||
_inFile.Rewind();
|
_inFile.Rewind();
|
||||||
|
@ -145,7 +145,7 @@ void TestAllCodecs::Perform() {
|
|||||||
uint8_t num_encoders = acm_a_->NumberOfCodecs();
|
uint8_t num_encoders = acm_a_->NumberOfCodecs();
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
for (uint8_t n = 0; n < num_encoders; n++) {
|
for (uint8_t n = 0; n < num_encoders; n++) {
|
||||||
acm_b_->Codec(n, my_codec_param);
|
acm_b_->Codec(n, &my_codec_param);
|
||||||
if (!strcmp(my_codec_param.plname, "opus")) {
|
if (!strcmp(my_codec_param.plname, "opus")) {
|
||||||
my_codec_param.channels = 1;
|
my_codec_param.channels = 1;
|
||||||
}
|
}
|
||||||
@ -752,7 +752,7 @@ void TestAllCodecs::RegisterSendCodec(char side, char* codec_name,
|
|||||||
|
|
||||||
// Get all codec parameters before registering
|
// Get all codec parameters before registering
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
CHECK_ERROR(AudioCodingModule::Codec(codec_name, my_codec_param,
|
CHECK_ERROR(AudioCodingModule::Codec(codec_name, &my_codec_param,
|
||||||
sampling_freq_hz, 1));
|
sampling_freq_hz, 1));
|
||||||
my_codec_param.rate = rate;
|
my_codec_param.rate = rate;
|
||||||
my_codec_param.pacsize = packet_size;
|
my_codec_param.pacsize = packet_size;
|
||||||
@ -795,7 +795,7 @@ void TestAllCodecs::Run(TestPack* channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run received side of ACM.
|
// Run received side of ACM.
|
||||||
CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz, audio_frame));
|
CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz, &audio_frame));
|
||||||
|
|
||||||
// Write output speech to file.
|
// Write output speech to file.
|
||||||
outfile_b_.Write10MsData(audio_frame.data_,
|
outfile_b_.Write10MsData(audio_frame.data_,
|
||||||
@ -824,9 +824,9 @@ void TestAllCodecs::OpenOutFile(int test_number) {
|
|||||||
|
|
||||||
void TestAllCodecs::DisplaySendReceiveCodec() {
|
void TestAllCodecs::DisplaySendReceiveCodec() {
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
acm_a_->SendCodec(my_codec_param);
|
acm_a_->SendCodec(&my_codec_param);
|
||||||
printf("%s -> ", my_codec_param.plname);
|
printf("%s -> ", my_codec_param.plname);
|
||||||
acm_b_->ReceiveCodec(my_codec_param);
|
acm_b_->ReceiveCodec(&my_codec_param);
|
||||||
printf("%s\n", my_codec_param.plname);
|
printf("%s\n", my_codec_param.plname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ void TestFEC::Perform()
|
|||||||
}
|
}
|
||||||
for(WebRtc_UWord8 n = 0; n < numEncoders; n++)
|
for(WebRtc_UWord8 n = 0; n < numEncoders; n++)
|
||||||
{
|
{
|
||||||
_acmB->Codec(n, myCodecParam);
|
_acmB->Codec(n, &myCodecParam);
|
||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
printf("%s\n", myCodecParam.plname);
|
printf("%s\n", myCodecParam.plname);
|
||||||
@ -553,7 +553,7 @@ WebRtc_Word16 TestFEC::RegisterSendCodec(char side, char* codecName, WebRtc_Word
|
|||||||
}
|
}
|
||||||
CodecInst myCodecParam;
|
CodecInst myCodecParam;
|
||||||
|
|
||||||
CHECK_ERROR(AudioCodingModule::Codec(codecName, myCodecParam,
|
CHECK_ERROR(AudioCodingModule::Codec(codecName, &myCodecParam,
|
||||||
samplingFreqHz, 1));
|
samplingFreqHz, 1));
|
||||||
|
|
||||||
CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam));
|
CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam));
|
||||||
@ -575,7 +575,7 @@ void TestFEC::Run()
|
|||||||
_inFileA.Read10MsData(audioFrame);
|
_inFileA.Read10MsData(audioFrame);
|
||||||
CHECK_ERROR(_acmA->Add10MsData(audioFrame));
|
CHECK_ERROR(_acmA->Add10MsData(audioFrame));
|
||||||
CHECK_ERROR(_acmA->Process());
|
CHECK_ERROR(_acmA->Process());
|
||||||
CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, audioFrame));
|
CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, &audioFrame));
|
||||||
_outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
|
_outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
|
||||||
msecPassed += 10;
|
msecPassed += 10;
|
||||||
if(msecPassed >= 1000)
|
if(msecPassed >= 1000)
|
||||||
@ -616,9 +616,9 @@ void TestFEC::OpenOutFile(WebRtc_Word16 test_number) {
|
|||||||
void TestFEC::DisplaySendReceiveCodec()
|
void TestFEC::DisplaySendReceiveCodec()
|
||||||
{
|
{
|
||||||
CodecInst myCodecParam;
|
CodecInst myCodecParam;
|
||||||
_acmA->SendCodec(myCodecParam);
|
_acmA->SendCodec(&myCodecParam);
|
||||||
printf("%s -> ", myCodecParam.plname);
|
printf("%s -> ", myCodecParam.plname);
|
||||||
_acmB->ReceiveCodec(myCodecParam);
|
_acmB->ReceiveCodec(&myCodecParam);
|
||||||
printf("%s\n", myCodecParam.plname);
|
printf("%s\n", myCodecParam.plname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,19 +182,19 @@ void TestStereo::Perform() {
|
|||||||
WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs();
|
WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs();
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
EXPECT_EQ(0, acm_b_->Codec(n, my_codec_param));
|
EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param));
|
||||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param));
|
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that unregister all receive codecs works.
|
// Test that unregister all receive codecs works.
|
||||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
EXPECT_EQ(0, acm_b_->Codec(n, my_codec_param));
|
EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param));
|
||||||
EXPECT_EQ(0, acm_b_->UnregisterReceiveCodec(my_codec_param.pltype));
|
EXPECT_EQ(0, acm_b_->UnregisterReceiveCodec(my_codec_param.pltype));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register all available codes as receiving codecs once more.
|
// Register all available codes as receiving codecs once more.
|
||||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
EXPECT_EQ(0, acm_b_->Codec(n, my_codec_param));
|
EXPECT_EQ(0, acm_b_->Codec(n, &my_codec_param));
|
||||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param));
|
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(my_codec_param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,12 +222,12 @@ void TestStereo::Perform() {
|
|||||||
// Continue with setting a stereo codec as send codec and verify that
|
// Continue with setting a stereo codec as send codec and verify that
|
||||||
// VAD/DTX gets turned off.
|
// VAD/DTX gets turned off.
|
||||||
EXPECT_EQ(0, acm_a_->SetVAD(true, true, VADNormal));
|
EXPECT_EQ(0, acm_a_->SetVAD(true, true, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_TRUE(dtx);
|
EXPECT_TRUE(dtx);
|
||||||
EXPECT_TRUE(vad);
|
EXPECT_TRUE(vad);
|
||||||
char codec_pcma_temp[] = "PCMA";
|
char codec_pcma_temp[] = "PCMA";
|
||||||
RegisterSendCodec('A', codec_pcma_temp, 8000, 64000, 80, 2, pcma_pltype_);
|
RegisterSendCodec('A', codec_pcma_temp, 8000, 64000, 80, 2, pcma_pltype_);
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_FALSE(dtx);
|
EXPECT_FALSE(dtx);
|
||||||
EXPECT_FALSE(vad);
|
EXPECT_FALSE(vad);
|
||||||
if (test_mode_ != 0) {
|
if (test_mode_ != 0) {
|
||||||
@ -366,19 +366,19 @@ void TestStereo::Perform() {
|
|||||||
|
|
||||||
// Test that VAD/DTX cannot be turned on while sending stereo.
|
// Test that VAD/DTX cannot be turned on while sending stereo.
|
||||||
EXPECT_EQ(-1, acm_a_->SetVAD(true, true, VADNormal));
|
EXPECT_EQ(-1, acm_a_->SetVAD(true, true, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_FALSE(dtx);
|
EXPECT_FALSE(dtx);
|
||||||
EXPECT_FALSE(vad);
|
EXPECT_FALSE(vad);
|
||||||
EXPECT_EQ(-1, acm_a_->SetVAD(true, false, VADNormal));
|
EXPECT_EQ(-1, acm_a_->SetVAD(true, false, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_FALSE(dtx);
|
EXPECT_FALSE(dtx);
|
||||||
EXPECT_FALSE(vad);
|
EXPECT_FALSE(vad);
|
||||||
EXPECT_EQ(-1, acm_a_->SetVAD(false, true, VADNormal));
|
EXPECT_EQ(-1, acm_a_->SetVAD(false, true, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_FALSE(dtx);
|
EXPECT_FALSE(dtx);
|
||||||
EXPECT_FALSE(vad);
|
EXPECT_FALSE(vad);
|
||||||
EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal));
|
EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_FALSE(dtx);
|
EXPECT_FALSE(dtx);
|
||||||
EXPECT_FALSE(vad);
|
EXPECT_FALSE(vad);
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ void TestStereo::Perform() {
|
|||||||
// Make sure it is possible to set VAD/CNG, now that we are sending mono
|
// Make sure it is possible to set VAD/CNG, now that we are sending mono
|
||||||
// again.
|
// again.
|
||||||
EXPECT_EQ(0, acm_a_->SetVAD(true, true, VADNormal));
|
EXPECT_EQ(0, acm_a_->SetVAD(true, true, VADNormal));
|
||||||
EXPECT_EQ(0, acm_a_->VAD(dtx, vad, vad_mode));
|
EXPECT_EQ(0, acm_a_->VAD(&dtx, &vad, &vad_mode));
|
||||||
EXPECT_TRUE(dtx);
|
EXPECT_TRUE(dtx);
|
||||||
EXPECT_TRUE(vad);
|
EXPECT_TRUE(vad);
|
||||||
EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal));
|
EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal));
|
||||||
@ -687,7 +687,7 @@ void TestStereo::Perform() {
|
|||||||
opus_pltype_);
|
opus_pltype_);
|
||||||
CodecInst opus_codec_param;
|
CodecInst opus_codec_param;
|
||||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||||
EXPECT_EQ(0, acm_b_->Codec(n, opus_codec_param));
|
EXPECT_EQ(0, acm_b_->Codec(n, &opus_codec_param));
|
||||||
if (!strcmp(opus_codec_param.plname, "opus")) {
|
if (!strcmp(opus_codec_param.plname, "opus")) {
|
||||||
opus_codec_param.channels = 1;
|
opus_codec_param.channels = 1;
|
||||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param));
|
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param));
|
||||||
@ -821,7 +821,7 @@ void TestStereo::RegisterSendCodec(char side, char* codec_name,
|
|||||||
|
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
// Get all codec parameters before registering
|
// Get all codec parameters before registering
|
||||||
CHECK_ERROR(AudioCodingModule::Codec(codec_name, my_codec_param,
|
CHECK_ERROR(AudioCodingModule::Codec(codec_name, &my_codec_param,
|
||||||
sampling_freq_hz, channels));
|
sampling_freq_hz, channels));
|
||||||
my_codec_param.rate = rate;
|
my_codec_param.rate = rate;
|
||||||
my_codec_param.pacsize = pack_size;
|
my_codec_param.pacsize = pack_size;
|
||||||
@ -888,7 +888,7 @@ void TestStereo::Run(TestPackStereo* channel, int in_channels, int out_channels,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run received side of ACM
|
// Run received side of ACM
|
||||||
CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz_b, audio_frame));
|
CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz_b, &audio_frame));
|
||||||
|
|
||||||
// Write output speech to file
|
// Write output speech to file
|
||||||
out_file_.Write10MsData(
|
out_file_.Write10MsData(
|
||||||
@ -919,11 +919,11 @@ void TestStereo::OpenOutFile(WebRtc_Word16 test_number) {
|
|||||||
|
|
||||||
void TestStereo::DisplaySendReceiveCodec() {
|
void TestStereo::DisplaySendReceiveCodec() {
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
acm_a_->SendCodec(my_codec_param);
|
acm_a_->SendCodec(&my_codec_param);
|
||||||
if (test_mode_ != 0) {
|
if (test_mode_ != 0) {
|
||||||
printf("%s -> ", my_codec_param.plname);
|
printf("%s -> ", my_codec_param.plname);
|
||||||
}
|
}
|
||||||
acm_b_->ReceiveCodec(my_codec_param);
|
acm_b_->ReceiveCodec(&my_codec_param);
|
||||||
if (test_mode_ != 0) {
|
if (test_mode_ != 0) {
|
||||||
printf("%s\n", my_codec_param.plname);
|
printf("%s\n", my_codec_param.plname);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void TestVADDTX::Perform()
|
|||||||
}
|
}
|
||||||
for(WebRtc_UWord8 n = 0; n < numEncoders; n++)
|
for(WebRtc_UWord8 n = 0; n < numEncoders; n++)
|
||||||
{
|
{
|
||||||
_acmB->Codec(n, myCodecParam);
|
_acmB->Codec(n, &myCodecParam);
|
||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
printf("%s\n", myCodecParam.plname);
|
printf("%s\n", myCodecParam.plname);
|
||||||
@ -174,7 +174,7 @@ void TestVADDTX::runTestCases()
|
|||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
CodecInst myCodecParam;
|
CodecInst myCodecParam;
|
||||||
_acmA->SendCodec(myCodecParam);
|
_acmA->SendCodec(&myCodecParam);
|
||||||
printf("%s\n", myCodecParam.plname);
|
printf("%s\n", myCodecParam.plname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -239,7 +239,7 @@ void TestVADDTX::SetVAD(bool statusDTX, bool statusVAD, WebRtc_Word16 vadMode)
|
|||||||
if (_acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode) < 0) {
|
if (_acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode) < 0) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) {
|
if (_acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet) < 0) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ VADDTXstruct TestVADDTX::GetVAD()
|
|||||||
bool dtxEnabled, vadEnabled;
|
bool dtxEnabled, vadEnabled;
|
||||||
ACMVADMode vadModeSet;
|
ACMVADMode vadModeSet;
|
||||||
|
|
||||||
if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) {
|
if (_acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet) < 0) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side,
|
|||||||
for(WebRtc_Word16 codecCntr = 0; codecCntr < myACM->NumberOfCodecs();
|
for(WebRtc_Word16 codecCntr = 0; codecCntr < myACM->NumberOfCodecs();
|
||||||
codecCntr++)
|
codecCntr++)
|
||||||
{
|
{
|
||||||
CHECK_ERROR(myACM->Codec((WebRtc_UWord8)codecCntr, myCodecParam));
|
CHECK_ERROR(myACM->Codec((WebRtc_UWord8)codecCntr, &myCodecParam));
|
||||||
if(!STR_CASE_CMP(myCodecParam.plname, codecName))
|
if(!STR_CASE_CMP(myCodecParam.plname, codecName))
|
||||||
{
|
{
|
||||||
if((samplingFreqHz == -1) || (myCodecParam.plfreq == samplingFreqHz))
|
if((samplingFreqHz == -1) || (myCodecParam.plfreq == samplingFreqHz))
|
||||||
@ -366,7 +366,7 @@ void TestVADDTX::Run()
|
|||||||
|
|
||||||
CHECK_ERROR(_acmA->Process());
|
CHECK_ERROR(_acmA->Process());
|
||||||
|
|
||||||
CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, audioFrame));
|
CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, &audioFrame));
|
||||||
_outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
|
_outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
|
||||||
}
|
}
|
||||||
#ifdef PRINT_STAT
|
#ifdef PRINT_STAT
|
||||||
@ -399,7 +399,7 @@ WebRtc_Word16 TestVADDTX::VerifyTest()
|
|||||||
WebRtc_UWord8 vadPattern = 0;
|
WebRtc_UWord8 vadPattern = 0;
|
||||||
WebRtc_UWord8 emptyFramePattern[6];
|
WebRtc_UWord8 emptyFramePattern[6];
|
||||||
CodecInst myCodecParam;
|
CodecInst myCodecParam;
|
||||||
_acmA->SendCodec(myCodecParam);
|
_acmA->SendCodec(&myCodecParam);
|
||||||
bool dtxInUse = true;
|
bool dtxInUse = true;
|
||||||
bool isReplaced = false;
|
bool isReplaced = false;
|
||||||
if ((STR_CASE_CMP(myCodecParam.plname,"G729") == 0) ||
|
if ((STR_CASE_CMP(myCodecParam.plname,"G729") == 0) ||
|
||||||
@ -408,7 +408,7 @@ WebRtc_Word16 TestVADDTX::VerifyTest()
|
|||||||
(STR_CASE_CMP(myCodecParam.plname,"AMR-wb") == 0) ||
|
(STR_CASE_CMP(myCodecParam.plname,"AMR-wb") == 0) ||
|
||||||
(STR_CASE_CMP(myCodecParam.plname,"speex") == 0))
|
(STR_CASE_CMP(myCodecParam.plname,"speex") == 0))
|
||||||
{
|
{
|
||||||
_acmA->IsInternalDTXReplacedWithWebRtc(isReplaced);
|
_acmA->IsInternalDTXReplacedWithWebRtc(&isReplaced);
|
||||||
if (!isReplaced)
|
if (!isReplaced)
|
||||||
{
|
{
|
||||||
dtxInUse = false;
|
dtxInUse = false;
|
||||||
|
@ -78,7 +78,7 @@ TwoWayCommunication::ChooseCodec(WebRtc_UWord8* codecID_A,
|
|||||||
printf("========================\n");
|
printf("========================\n");
|
||||||
for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++)
|
for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++)
|
||||||
{
|
{
|
||||||
tmpACM->Codec(codecCntr, codecInst);
|
tmpACM->Codec(codecCntr, &codecInst);
|
||||||
printf("%d- %s\n", codecCntr, codecInst.plname);
|
printf("%d- %s\n", codecCntr, codecInst.plname);
|
||||||
}
|
}
|
||||||
printf("\nChoose a send codec for side A [0]: ");
|
printf("\nChoose a send codec for side A [0]: ");
|
||||||
@ -110,10 +110,10 @@ WebRtc_Word16 TwoWayCommunication::SetUp()
|
|||||||
CodecInst codecInst_A;
|
CodecInst codecInst_A;
|
||||||
CodecInst codecInst_B;
|
CodecInst codecInst_B;
|
||||||
CodecInst dummyCodec;
|
CodecInst dummyCodec;
|
||||||
_acmA->Codec(codecID_A, codecInst_A);
|
_acmA->Codec(codecID_A, &codecInst_A);
|
||||||
_acmB->Codec(codecID_B, codecInst_B);
|
_acmB->Codec(codecID_B, &codecInst_B);
|
||||||
|
|
||||||
_acmA->Codec(6, dummyCodec);
|
_acmA->Codec(6, &dummyCodec);
|
||||||
|
|
||||||
//--- Set A codecs
|
//--- Set A codecs
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A));
|
CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A));
|
||||||
@ -214,9 +214,9 @@ WebRtc_Word16 TwoWayCommunication::SetUpAutotest()
|
|||||||
CodecInst codecInst_B;
|
CodecInst codecInst_B;
|
||||||
CodecInst dummyCodec;
|
CodecInst dummyCodec;
|
||||||
|
|
||||||
_acmA->Codec("ISAC", codecInst_A, 16000, 1);
|
_acmA->Codec("ISAC", &codecInst_A, 16000, 1);
|
||||||
_acmB->Codec("L16", codecInst_B, 8000, 1);
|
_acmB->Codec("L16", &codecInst_B, 8000, 1);
|
||||||
_acmA->Codec(6, dummyCodec);
|
_acmA->Codec(6, &dummyCodec);
|
||||||
|
|
||||||
//--- Set A codecs
|
//--- Set A codecs
|
||||||
CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A));
|
CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A));
|
||||||
@ -320,7 +320,7 @@ TwoWayCommunication::Perform()
|
|||||||
CodecInst codecInst_B;
|
CodecInst codecInst_B;
|
||||||
CodecInst dummy;
|
CodecInst dummy;
|
||||||
|
|
||||||
_acmB->SendCodec(codecInst_B);
|
_acmB->SendCodec(&codecInst_B);
|
||||||
|
|
||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
@ -345,16 +345,16 @@ TwoWayCommunication::Perform()
|
|||||||
_acmRefA->Process();
|
_acmRefA->Process();
|
||||||
_acmRefB->Process();
|
_acmRefB->Process();
|
||||||
|
|
||||||
_acmA->PlayoutData10Ms(outFreqHzA, audioFrame);
|
_acmA->PlayoutData10Ms(outFreqHzA, &audioFrame);
|
||||||
_outFileA.Write10MsData(audioFrame);
|
_outFileA.Write10MsData(audioFrame);
|
||||||
|
|
||||||
_acmRefA->PlayoutData10Ms(outFreqHzA, audioFrame);
|
_acmRefA->PlayoutData10Ms(outFreqHzA, &audioFrame);
|
||||||
_outFileRefA.Write10MsData(audioFrame);
|
_outFileRefA.Write10MsData(audioFrame);
|
||||||
|
|
||||||
_acmB->PlayoutData10Ms(outFreqHzB, audioFrame);
|
_acmB->PlayoutData10Ms(outFreqHzB, &audioFrame);
|
||||||
_outFileB.Write10MsData(audioFrame);
|
_outFileB.Write10MsData(audioFrame);
|
||||||
|
|
||||||
_acmRefB->PlayoutData10Ms(outFreqHzB, audioFrame);
|
_acmRefB->PlayoutData10Ms(outFreqHzB, &audioFrame);
|
||||||
_outFileRefB.Write10MsData(audioFrame);
|
_outFileRefB.Write10MsData(audioFrame);
|
||||||
|
|
||||||
msecPassed += 10;
|
msecPassed += 10;
|
||||||
@ -398,7 +398,7 @@ TwoWayCommunication::Perform()
|
|||||||
printf("Register Send Codec (audio back in side A)\n");
|
printf("Register Send Codec (audio back in side A)\n");
|
||||||
}
|
}
|
||||||
CHECK_ERROR(_acmB->RegisterSendCodec(codecInst_B));
|
CHECK_ERROR(_acmB->RegisterSendCodec(codecInst_B));
|
||||||
CHECK_ERROR(_acmB->SendCodec(dummy));
|
CHECK_ERROR(_acmB->SendCodec(&dummy));
|
||||||
}
|
}
|
||||||
if(((secPassed%7) == 6) && (msecPassed == 0))
|
if(((secPassed%7) == 6) && (msecPassed == 0))
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ class DelayTest {
|
|||||||
WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs();
|
WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs();
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
for(int n = 0; n < num_encoders; n++) {
|
for(int n = 0; n < num_encoders; n++) {
|
||||||
acm_b_->Codec(n, my_codec_param);
|
acm_b_->Codec(n, &my_codec_param);
|
||||||
if (STR_CASE_CMP(my_codec_param.plname, "opus") == 0)
|
if (STR_CASE_CMP(my_codec_param.plname, "opus") == 0)
|
||||||
my_codec_param.channels = 1;
|
my_codec_param.channels = 1;
|
||||||
else if (my_codec_param.channels > 1)
|
else if (my_codec_param.channels > 1)
|
||||||
@ -155,7 +155,7 @@ class DelayTest {
|
|||||||
|
|
||||||
void SendCodec(const CodecConfig& config) {
|
void SendCodec(const CodecConfig& config) {
|
||||||
CodecInst my_codec_param;
|
CodecInst my_codec_param;
|
||||||
ASSERT_EQ(0, AudioCodingModule::Codec(config.name, my_codec_param,
|
ASSERT_EQ(0, AudioCodingModule::Codec(config.name, &my_codec_param,
|
||||||
config.sample_rate_hz,
|
config.sample_rate_hz,
|
||||||
config.num_channels));
|
config.num_channels));
|
||||||
encoding_sample_rate_hz_ = my_codec_param.plfreq;
|
encoding_sample_rate_hz_ = my_codec_param.plfreq;
|
||||||
@ -201,7 +201,7 @@ class DelayTest {
|
|||||||
// Print delay information every 16 frame
|
// Print delay information every 16 frame
|
||||||
if ((num_frames & 0x3F) == 0x3F) {
|
if ((num_frames & 0x3F) == 0x3F) {
|
||||||
ACMNetworkStatistics statistics;
|
ACMNetworkStatistics statistics;
|
||||||
acm_b_->NetworkStatistics(statistics);
|
acm_b_->NetworkStatistics(&statistics);
|
||||||
fprintf(stdout, "delay: min=%3d max=%3d mean=%3d median=%3d"
|
fprintf(stdout, "delay: min=%3d max=%3d mean=%3d median=%3d"
|
||||||
" ts-based average = %6.3f, "
|
" ts-based average = %6.3f, "
|
||||||
"curr buff-lev = %4u opt buff-lev = %4u \n",
|
"curr buff-lev = %4u opt buff-lev = %4u \n",
|
||||||
@ -218,11 +218,11 @@ class DelayTest {
|
|||||||
in_file_a_.Read10MsData(audio_frame);
|
in_file_a_.Read10MsData(audio_frame);
|
||||||
ASSERT_EQ(0, acm_a_->Add10MsData(audio_frame));
|
ASSERT_EQ(0, acm_a_->Add10MsData(audio_frame));
|
||||||
ASSERT_LE(0, acm_a_->Process());
|
ASSERT_LE(0, acm_a_->Process());
|
||||||
ASSERT_EQ(0, acm_b_->PlayoutData10Ms(out_freq_hz_b, audio_frame));
|
ASSERT_EQ(0, acm_b_->PlayoutData10Ms(out_freq_hz_b, &audio_frame));
|
||||||
out_file_b_.Write10MsData(audio_frame.data_,
|
out_file_b_.Write10MsData(audio_frame.data_,
|
||||||
audio_frame.samples_per_channel_ *
|
audio_frame.samples_per_channel_ *
|
||||||
audio_frame.num_channels_);
|
audio_frame.num_channels_);
|
||||||
acm_b_->PlayoutTimestamp(playout_ts);
|
acm_b_->PlayoutTimestamp(&playout_ts);
|
||||||
received_ts = channel_a2b_->LastInTimestamp();
|
received_ts = channel_a2b_->LastInTimestamp();
|
||||||
inst_delay_sec = static_cast<uint32_t>(received_ts - playout_ts) /
|
inst_delay_sec = static_cast<uint32_t>(received_ts - playout_ts) /
|
||||||
static_cast<double>(encoding_sample_rate_hz_);
|
static_cast<double>(encoding_sample_rate_hz_);
|
||||||
|
@ -111,7 +111,7 @@ void DualStreamTest::PopulateCodecInstances(int frame_size_primary_ms,
|
|||||||
red_encoder_.pltype = -1;
|
red_encoder_.pltype = -1;
|
||||||
|
|
||||||
for (int n = 0; n < AudioCodingModule::NumberOfCodecs(); n++) {
|
for (int n = 0; n < AudioCodingModule::NumberOfCodecs(); n++) {
|
||||||
AudioCodingModule::Codec(n, my_codec);
|
AudioCodingModule::Codec(n, &my_codec);
|
||||||
if (strcmp(my_codec.plname, "ISAC") == 0 &&
|
if (strcmp(my_codec.plname, "ISAC") == 0 &&
|
||||||
my_codec.plfreq == sampling_rate) {
|
my_codec.plfreq == sampling_rate) {
|
||||||
my_codec.rate = 32000;
|
my_codec.rate = 32000;
|
||||||
@ -480,7 +480,7 @@ TEST_F(DualStreamTest, Api) {
|
|||||||
bool vad_status;
|
bool vad_status;
|
||||||
bool dtx_status;
|
bool dtx_status;
|
||||||
ACMVADMode vad_mode;
|
ACMVADMode vad_mode;
|
||||||
EXPECT_EQ(0, acm_dual_stream_->VAD(vad_status, dtx_status, vad_mode));
|
EXPECT_EQ(0, acm_dual_stream_->VAD(&vad_status, &dtx_status, &vad_mode));
|
||||||
EXPECT_TRUE(vad_status);
|
EXPECT_TRUE(vad_status);
|
||||||
EXPECT_TRUE(dtx_status);
|
EXPECT_TRUE(dtx_status);
|
||||||
EXPECT_EQ(VADNormal, vad_mode);
|
EXPECT_EQ(VADNormal, vad_mode);
|
||||||
@ -492,7 +492,7 @@ TEST_F(DualStreamTest, Api) {
|
|||||||
ASSERT_EQ(0, memcmp(&my_codec, &secondary_encoder_, sizeof(my_codec)));
|
ASSERT_EQ(0, memcmp(&my_codec, &secondary_encoder_, sizeof(my_codec)));
|
||||||
|
|
||||||
// Test if VAD get disabled after registering secondary codec.
|
// Test if VAD get disabled after registering secondary codec.
|
||||||
EXPECT_EQ(0, acm_dual_stream_->VAD(vad_status, dtx_status, vad_mode));
|
EXPECT_EQ(0, acm_dual_stream_->VAD(&vad_status, &dtx_status, &vad_mode));
|
||||||
EXPECT_FALSE(vad_status);
|
EXPECT_FALSE(vad_status);
|
||||||
EXPECT_FALSE(dtx_status);
|
EXPECT_FALSE(dtx_status);
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ TEST_F(DualStreamTest, Api) {
|
|||||||
|
|
||||||
ASSERT_EQ(0, acm_dual_stream_->SetVAD(true, true, VADVeryAggr));
|
ASSERT_EQ(0, acm_dual_stream_->SetVAD(true, true, VADVeryAggr));
|
||||||
// Make sure VAD is activated.
|
// Make sure VAD is activated.
|
||||||
EXPECT_EQ(0, acm_dual_stream_->VAD(vad_status, dtx_status, vad_mode));
|
EXPECT_EQ(0, acm_dual_stream_->VAD(&vad_status, &dtx_status, &vad_mode));
|
||||||
EXPECT_TRUE(vad_status);
|
EXPECT_TRUE(vad_status);
|
||||||
EXPECT_TRUE(dtx_status);
|
EXPECT_TRUE(dtx_status);
|
||||||
EXPECT_EQ(VADVeryAggr, vad_mode);
|
EXPECT_EQ(VADVeryAggr, vad_mode);
|
||||||
|
@ -55,7 +55,7 @@ WebRtc_Word16 SetISAConfig(
|
|||||||
(isacConfig.currentFrameSizeMsec != 0))
|
(isacConfig.currentFrameSizeMsec != 0))
|
||||||
{
|
{
|
||||||
CodecInst sendCodec;
|
CodecInst sendCodec;
|
||||||
acm->SendCodec(sendCodec);
|
acm->SendCodec(&sendCodec);
|
||||||
if(isacConfig.currentRateBitPerSec < 0)
|
if(isacConfig.currentRateBitPerSec < 0)
|
||||||
{
|
{
|
||||||
sendCodec.rate = -1;
|
sendCodec.rate = -1;
|
||||||
@ -155,7 +155,7 @@ ISACTest::Setup()
|
|||||||
|
|
||||||
for(codecCntr = 0; codecCntr < AudioCodingModule::NumberOfCodecs(); codecCntr++)
|
for(codecCntr = 0; codecCntr < AudioCodingModule::NumberOfCodecs(); codecCntr++)
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(codecCntr, codecParam);
|
AudioCodingModule::Codec(codecCntr, &codecParam);
|
||||||
if(!STR_CASE_CMP(codecParam.plname, "ISAC") && codecParam.plfreq == 16000)
|
if(!STR_CASE_CMP(codecParam.plname, "ISAC") && codecParam.plfreq == 16000)
|
||||||
{
|
{
|
||||||
memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst));
|
memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst));
|
||||||
@ -210,14 +210,14 @@ ISACTest::Setup()
|
|||||||
Run10ms();
|
Run10ms();
|
||||||
}
|
}
|
||||||
CodecInst receiveCodec;
|
CodecInst receiveCodec;
|
||||||
CHECK_ERROR(_acmA->ReceiveCodec(receiveCodec));
|
CHECK_ERROR(_acmA->ReceiveCodec(&receiveCodec));
|
||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
printf("Side A Receive Codec\n");
|
printf("Side A Receive Codec\n");
|
||||||
printf("%s %d\n", receiveCodec.plname, receiveCodec.plfreq);
|
printf("%s %d\n", receiveCodec.plname, receiveCodec.plfreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_ERROR(_acmB->ReceiveCodec(receiveCodec));
|
CHECK_ERROR(_acmB->ReceiveCodec(&receiveCodec));
|
||||||
if(_testMode != 0)
|
if(_testMode != 0)
|
||||||
{
|
{
|
||||||
printf("Side B Receive Codec\n");
|
printf("Side B Receive Codec\n");
|
||||||
@ -357,10 +357,10 @@ ISACTest::Run10ms()
|
|||||||
CHECK_ERROR(_acmA->Process());
|
CHECK_ERROR(_acmA->Process());
|
||||||
CHECK_ERROR(_acmB->Process());
|
CHECK_ERROR(_acmB->Process());
|
||||||
|
|
||||||
CHECK_ERROR(_acmA->PlayoutData10Ms(32000, audioFrame));
|
CHECK_ERROR(_acmA->PlayoutData10Ms(32000, &audioFrame));
|
||||||
_outFileA.Write10MsData(audioFrame);
|
_outFileA.Write10MsData(audioFrame);
|
||||||
|
|
||||||
CHECK_ERROR(_acmB->PlayoutData10Ms(32000, audioFrame));
|
CHECK_ERROR(_acmB->PlayoutData10Ms(32000, &audioFrame));
|
||||||
_outFileB.Write10MsData(audioFrame);
|
_outFileB.Write10MsData(audioFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,9 +444,9 @@ ISACTest::EncodeDecode(
|
|||||||
{
|
{
|
||||||
myEvent->Wait(5000);
|
myEvent->Wait(5000);
|
||||||
|
|
||||||
_acmA->SendCodec(sendCodec);
|
_acmA->SendCodec(&sendCodec);
|
||||||
if(_testMode == 2) printf("[%d] ", sendCodec.rate);
|
if(_testMode == 2) printf("[%d] ", sendCodec.rate);
|
||||||
_acmB->SendCodec(sendCodec);
|
_acmB->SendCodec(&sendCodec);
|
||||||
if(_testMode == 2) printf("[%d] ", sendCodec.rate);
|
if(_testMode == 2) printf("[%d] ", sendCodec.rate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class InitialPlayoutDelayTest : public ::testing::Test {
|
|||||||
const int kChannels[2] = {1, 2};
|
const int kChannels[2] = {1, 2};
|
||||||
for (int n = 0; n < 3; ++n) {
|
for (int n = 0; n < 3; ++n) {
|
||||||
for (int k = 0; k < 2; ++k) {
|
for (int k = 0; k < 2; ++k) {
|
||||||
AudioCodingModule::Codec("L16", codec, kFsHz[n], kChannels[k]);
|
AudioCodingModule::Codec("L16", &codec, kFsHz[n], kChannels[k]);
|
||||||
acm_b_->RegisterReceiveCodec(codec);
|
acm_b_->RegisterReceiveCodec(codec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ class InitialPlayoutDelayTest : public ::testing::Test {
|
|||||||
timestamp += in_audio_frame.samples_per_channel_;
|
timestamp += in_audio_frame.samples_per_channel_;
|
||||||
ASSERT_EQ(0, acm_a_->Add10MsData(in_audio_frame));
|
ASSERT_EQ(0, acm_a_->Add10MsData(in_audio_frame));
|
||||||
ASSERT_LE(0, acm_a_->Process());
|
ASSERT_LE(0, acm_a_->Process());
|
||||||
ASSERT_EQ(0, acm_b_->PlayoutData10Ms(codec.plfreq, out_audio_frame));
|
ASSERT_EQ(0, acm_b_->PlayoutData10Ms(codec.plfreq, &out_audio_frame));
|
||||||
rms = FrameRms(out_audio_frame);
|
rms = FrameRms(out_audio_frame);
|
||||||
++num_frames;
|
++num_frames;
|
||||||
}
|
}
|
||||||
@ -131,38 +131,38 @@ class InitialPlayoutDelayTest : public ::testing::Test {
|
|||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, NbMono) {
|
TEST_F( InitialPlayoutDelayTest, NbMono) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 8000, 1);
|
AudioCodingModule::Codec("L16", &codec, 8000, 1);
|
||||||
Run(codec, 3000);
|
Run(codec, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, WbMono) {
|
TEST_F( InitialPlayoutDelayTest, WbMono) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 16000, 1);
|
AudioCodingModule::Codec("L16", &codec, 16000, 1);
|
||||||
Run(codec, 3000);
|
Run(codec, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, SwbMono) {
|
TEST_F( InitialPlayoutDelayTest, SwbMono) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 32000, 1);
|
AudioCodingModule::Codec("L16", &codec, 32000, 1);
|
||||||
Run(codec, 2000); // NetEq buffer is not sufficiently large for 3 sec of
|
Run(codec, 2000); // NetEq buffer is not sufficiently large for 3 sec of
|
||||||
// PCM16 super-wideband.
|
// PCM16 super-wideband.
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, NbStereo) {
|
TEST_F( InitialPlayoutDelayTest, NbStereo) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 8000, 2);
|
AudioCodingModule::Codec("L16", &codec, 8000, 2);
|
||||||
Run(codec, 3000);
|
Run(codec, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, WbStereo) {
|
TEST_F( InitialPlayoutDelayTest, WbStereo) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 16000, 2);
|
AudioCodingModule::Codec("L16", &codec, 16000, 2);
|
||||||
Run(codec, 3000);
|
Run(codec, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( InitialPlayoutDelayTest, SwbStereo) {
|
TEST_F( InitialPlayoutDelayTest, SwbStereo) {
|
||||||
CodecInst codec;
|
CodecInst codec;
|
||||||
AudioCodingModule::Codec("L16", codec, 32000, 2);
|
AudioCodingModule::Codec("L16", &codec, 32000, 2);
|
||||||
Run(codec, 2000); // NetEq buffer is not sufficiently large for 3 sec of
|
Run(codec, 2000); // NetEq buffer is not sufficiently large for 3 sec of
|
||||||
// PCM16 super-wideband.
|
// PCM16 super-wideband.
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ ChooseCodec(
|
|||||||
}
|
}
|
||||||
} while(outOfRange);
|
} while(outOfRange);
|
||||||
|
|
||||||
CHECK_ERROR(AudioCodingModule::Codec((WebRtc_UWord8)codecID, codecInst));
|
CHECK_ERROR(AudioCodingModule::Codec((WebRtc_UWord8)codecID, &codecInst));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ PrintCodecs()
|
|||||||
printf("No Name [Hz] [bps]\n");
|
printf("No Name [Hz] [bps]\n");
|
||||||
for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++)
|
for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++)
|
||||||
{
|
{
|
||||||
AudioCodingModule::Codec(codecCntr, codecInst);
|
AudioCodingModule::Codec(codecCntr, &codecInst);
|
||||||
printf("%2d- %-18s %5d %6d\n",
|
printf("%2d- %-18s %5d %6d\n",
|
||||||
codecCntr, codecInst.plname, codecInst.plfreq, codecInst.rate);
|
codecCntr, codecInst.plname, codecInst.plfreq, codecInst.rate);
|
||||||
}
|
}
|
||||||
|
@ -76,14 +76,13 @@ WebRtc_Word32 AudioCoder::Decode(AudioFrame& decodedAudio,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _acm->PlayoutData10Ms((WebRtc_UWord16)sampFreqHz,
|
return _acm->PlayoutData10Ms((WebRtc_UWord16)sampFreqHz, &decodedAudio);
|
||||||
(AudioFrame&)decodedAudio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 AudioCoder::PlayoutData(AudioFrame& decodedAudio,
|
WebRtc_Word32 AudioCoder::PlayoutData(AudioFrame& decodedAudio,
|
||||||
WebRtc_UWord16& sampFreqHz)
|
WebRtc_UWord16& sampFreqHz)
|
||||||
{
|
{
|
||||||
return _acm->PlayoutData10Ms(sampFreqHz, (AudioFrame&)decodedAudio);
|
return _acm->PlayoutData10Ms(sampFreqHz, &decodedAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 AudioCoder::Encode(const AudioFrame& audio,
|
WebRtc_Word32 AudioCoder::Encode(const AudioFrame& audio,
|
||||||
|
@ -661,7 +661,7 @@ Channel::OnInitializeDecoder(
|
|||||||
receiveCodec.rate = rate;
|
receiveCodec.rate = rate;
|
||||||
strncpy(receiveCodec.plname, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
|
strncpy(receiveCodec.plname, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
|
||||||
|
|
||||||
_audioCodingModule.Codec(payloadName, dummyCodec, frequency, channels);
|
_audioCodingModule.Codec(payloadName, &dummyCodec, frequency, channels);
|
||||||
receiveCodec.pacsize = dummyCodec.pacsize;
|
receiveCodec.pacsize = dummyCodec.pacsize;
|
||||||
|
|
||||||
// Register the new codec to the ACM
|
// Register the new codec to the ACM
|
||||||
@ -839,7 +839,7 @@ WebRtc_Word32 Channel::GetAudioFrame(const WebRtc_Word32 id,
|
|||||||
|
|
||||||
// Get 10ms raw PCM data from the ACM (mixer limits output frequency)
|
// Get 10ms raw PCM data from the ACM (mixer limits output frequency)
|
||||||
if (_audioCodingModule.PlayoutData10Ms(audioFrame.sample_rate_hz_,
|
if (_audioCodingModule.PlayoutData10Ms(audioFrame.sample_rate_hz_,
|
||||||
audioFrame) == -1)
|
&audioFrame) == -1)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceVoice,
|
WEBRTC_TRACE(kTraceError, kTraceVoice,
|
||||||
VoEId(_instanceId,_channelId),
|
VoEId(_instanceId,_channelId),
|
||||||
@ -1413,7 +1413,7 @@ Channel::Init()
|
|||||||
for (int idx = 0; idx < nSupportedCodecs; idx++)
|
for (int idx = 0; idx < nSupportedCodecs; idx++)
|
||||||
{
|
{
|
||||||
// Open up the RTP/RTCP receiver for all supported codecs
|
// Open up the RTP/RTCP receiver for all supported codecs
|
||||||
if ((_audioCodingModule.Codec(idx, codec) == -1) ||
|
if ((_audioCodingModule.Codec(idx, &codec) == -1) ||
|
||||||
(_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
|
(_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceVoice,
|
WEBRTC_TRACE(kTraceWarning, kTraceVoice,
|
||||||
@ -2254,7 +2254,7 @@ WebRtc_Word32
|
|||||||
Channel::GetNetEQBGNMode(NetEqBgnModes& mode)
|
Channel::GetNetEQBGNMode(NetEqBgnModes& mode)
|
||||||
{
|
{
|
||||||
ACMBackgroundNoiseMode noiseMode(On);
|
ACMBackgroundNoiseMode noiseMode(On);
|
||||||
_audioCodingModule.BackgroundNoiseMode(noiseMode);
|
_audioCodingModule.BackgroundNoiseMode(&noiseMode);
|
||||||
switch (noiseMode)
|
switch (noiseMode)
|
||||||
{
|
{
|
||||||
case On:
|
case On:
|
||||||
@ -2275,13 +2275,13 @@ Channel::GetNetEQBGNMode(NetEqBgnModes& mode)
|
|||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
Channel::GetSendCodec(CodecInst& codec)
|
Channel::GetSendCodec(CodecInst& codec)
|
||||||
{
|
{
|
||||||
return (_audioCodingModule.SendCodec(codec));
|
return (_audioCodingModule.SendCodec(&codec));
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
Channel::GetRecCodec(CodecInst& codec)
|
Channel::GetRecCodec(CodecInst& codec)
|
||||||
{
|
{
|
||||||
return (_audioCodingModule.ReceiveCodec(codec));
|
return (_audioCodingModule.ReceiveCodec(&codec));
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
@ -2342,7 +2342,7 @@ Channel::GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX)
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::GetVADStatus");
|
"Channel::GetVADStatus");
|
||||||
if (_audioCodingModule.VAD(disabledDTX, enabledVAD, mode) != 0)
|
if (_audioCodingModule.VAD(&disabledDTX, &enabledVAD, &mode) != 0)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
|
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
|
||||||
@ -2504,7 +2504,7 @@ Channel::SetSendCNPayloadType(int type, PayloadFrequencies frequency)
|
|||||||
else if (frequency == kFreq16000Hz)
|
else if (frequency == kFreq16000Hz)
|
||||||
samplingFreqHz = 16000;
|
samplingFreqHz = 16000;
|
||||||
|
|
||||||
if (_audioCodingModule.Codec("CN", codec, samplingFreqHz, kMono) == -1)
|
if (_audioCodingModule.Codec("CN", &codec, samplingFreqHz, kMono) == -1)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
|
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
|
||||||
@ -2546,7 +2546,7 @@ Channel::SetISACInitTargetRate(int rateBps, bool useFixedFrameSize)
|
|||||||
"Channel::SetISACInitTargetRate()");
|
"Channel::SetISACInitTargetRate()");
|
||||||
|
|
||||||
CodecInst sendCodec;
|
CodecInst sendCodec;
|
||||||
if (_audioCodingModule.SendCodec(sendCodec) == -1)
|
if (_audioCodingModule.SendCodec(&sendCodec) == -1)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_CODEC_ERROR, kTraceError,
|
VE_CODEC_ERROR, kTraceError,
|
||||||
@ -2614,7 +2614,7 @@ Channel::SetISACMaxRate(int rateBps)
|
|||||||
"Channel::SetISACMaxRate()");
|
"Channel::SetISACMaxRate()");
|
||||||
|
|
||||||
CodecInst sendCodec;
|
CodecInst sendCodec;
|
||||||
if (_audioCodingModule.SendCodec(sendCodec) == -1)
|
if (_audioCodingModule.SendCodec(&sendCodec) == -1)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_CODEC_ERROR, kTraceError,
|
VE_CODEC_ERROR, kTraceError,
|
||||||
@ -2678,7 +2678,7 @@ Channel::SetISACMaxPayloadSize(int sizeBytes)
|
|||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::SetISACMaxPayloadSize()");
|
"Channel::SetISACMaxPayloadSize()");
|
||||||
CodecInst sendCodec;
|
CodecInst sendCodec;
|
||||||
if (_audioCodingModule.SendCodec(sendCodec) == -1)
|
if (_audioCodingModule.SendCodec(&sendCodec) == -1)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_CODEC_ERROR, kTraceError,
|
VE_CODEC_ERROR, kTraceError,
|
||||||
@ -6082,8 +6082,12 @@ Channel::GetNetworkStatistics(NetworkStatistics& stats)
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::GetNetworkStatistics()");
|
"Channel::GetNetworkStatistics()");
|
||||||
return _audioCodingModule.NetworkStatistics(
|
ACMNetworkStatistics acm_stats;
|
||||||
(ACMNetworkStatistics &)stats);
|
int return_value = _audioCodingModule.NetworkStatistics(&acm_stats);
|
||||||
|
if (return_value >= 0) {
|
||||||
|
memcpy(&stats, &acm_stats, sizeof(NetworkStatistics));
|
||||||
|
}
|
||||||
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -6416,7 +6420,7 @@ Channel::GetPlayoutTimeStamp(WebRtc_UWord32& playoutTimestamp)
|
|||||||
WebRtc_UWord32 timestamp(0);
|
WebRtc_UWord32 timestamp(0);
|
||||||
CodecInst currRecCodec;
|
CodecInst currRecCodec;
|
||||||
|
|
||||||
if (_audioCodingModule.PlayoutTimestamp(timestamp) == -1)
|
if (_audioCodingModule.PlayoutTimestamp(×tamp) == -1)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
|
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||||
"Channel::GetPlayoutTimeStamp() failed to read playout"
|
"Channel::GetPlayoutTimeStamp() failed to read playout"
|
||||||
@ -6434,7 +6438,7 @@ Channel::GetPlayoutTimeStamp(WebRtc_UWord32& playoutTimestamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 playoutFrequency = _audioCodingModule.PlayoutFrequency();
|
WebRtc_Word32 playoutFrequency = _audioCodingModule.PlayoutFrequency();
|
||||||
if (_audioCodingModule.ReceiveCodec(currRecCodec) == 0) {
|
if (_audioCodingModule.ReceiveCodec(&currRecCodec) == 0) {
|
||||||
if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) {
|
if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) {
|
||||||
playoutFrequency = 8000;
|
playoutFrequency = 8000;
|
||||||
} else if (STR_CASE_CMP("opus", currRecCodec.plname) == 0) {
|
} else if (STR_CASE_CMP("opus", currRecCodec.plname) == 0) {
|
||||||
@ -6513,7 +6517,7 @@ Channel::UpdatePacketDelay(const WebRtc_UWord32 timestamp,
|
|||||||
rtpReceiveFrequency = _audioCodingModule.ReceiveFrequency();
|
rtpReceiveFrequency = _audioCodingModule.ReceiveFrequency();
|
||||||
|
|
||||||
CodecInst currRecCodec;
|
CodecInst currRecCodec;
|
||||||
if (_audioCodingModule.ReceiveCodec(currRecCodec) == 0) {
|
if (_audioCodingModule.ReceiveCodec(&currRecCodec) == 0) {
|
||||||
if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) {
|
if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) {
|
||||||
// Even though the actual sampling rate for G.722 audio is
|
// Even though the actual sampling rate for G.722 audio is
|
||||||
// 16,000 Hz, the RTP clock rate for the G722 payload format is
|
// 16,000 Hz, the RTP clock rate for the G722 payload format is
|
||||||
@ -6618,7 +6622,7 @@ Channel::RegisterReceiveCodecsToRTPModule()
|
|||||||
for (int idx = 0; idx < nSupportedCodecs; idx++)
|
for (int idx = 0; idx < nSupportedCodecs; idx++)
|
||||||
{
|
{
|
||||||
// Open up the RTP/RTCP receiver for all supported codecs
|
// Open up the RTP/RTCP receiver for all supported codecs
|
||||||
if ((_audioCodingModule.Codec(idx, codec) == -1) ||
|
if ((_audioCodingModule.Codec(idx, &codec) == -1) ||
|
||||||
(_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
|
(_rtpRtcpModule->RegisterReceivePayload(codec) == -1))
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(
|
WEBRTC_TRACE(
|
||||||
@ -6710,7 +6714,7 @@ int Channel::SetRedPayloadType(int red_payload_type) {
|
|||||||
// Get default RED settings from the ACM database
|
// Get default RED settings from the ACM database
|
||||||
const int num_codecs = AudioCodingModule::NumberOfCodecs();
|
const int num_codecs = AudioCodingModule::NumberOfCodecs();
|
||||||
for (int idx = 0; idx < num_codecs; idx++) {
|
for (int idx = 0; idx < num_codecs; idx++) {
|
||||||
_audioCodingModule.Codec(idx, codec);
|
_audioCodingModule.Codec(idx, &codec);
|
||||||
if (!STR_CASE_CMP(codec.plname, "RED")) {
|
if (!STR_CASE_CMP(codec.plname, "RED")) {
|
||||||
found_red = true;
|
found_red = true;
|
||||||
break;
|
break;
|
||||||
|
@ -68,7 +68,7 @@ int VoECodecImpl::GetCodec(int index, CodecInst& codec)
|
|||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
"GetCodec(index=%d, codec=?)", index);
|
"GetCodec(index=%d, codec=?)", index);
|
||||||
CodecInst acmCodec;
|
CodecInst acmCodec;
|
||||||
if (AudioCodingModule::Codec(index, (CodecInst&) acmCodec)
|
if (AudioCodingModule::Codec(index, &acmCodec)
|
||||||
== -1)
|
== -1)
|
||||||
{
|
{
|
||||||
_shared->SetLastError(VE_INVALID_LISTNR, kTraceError,
|
_shared->SetLastError(VE_INVALID_LISTNR, kTraceError,
|
||||||
|
Loading…
Reference in New Issue
Block a user