From 7a7a008031d43013b01176cfe40b0fd68c0d83b5 Mon Sep 17 00:00:00 2001 From: "tina.legrand@webrtc.org" Date: Thu, 21 Feb 2013 10:27:48 +0000 Subject: [PATCH] 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 --- .../main/interface/audio_coding_module.h | 28 +++--- .../main/source/audio_coding_module.cc | 22 ++--- .../main/source/audio_coding_module_impl.cc | 86 ++++++++++--------- .../main/source/audio_coding_module_impl.h | 20 ++--- .../modules/audio_coding/main/test/APITest.cc | 42 ++++----- .../main/test/EncodeDecodeTest.cc | 12 +-- .../audio_coding/main/test/SpatialAudio.cc | 18 ++-- .../audio_coding/main/test/TestAllCodecs.cc | 10 +-- .../modules/audio_coding/main/test/TestFEC.cc | 10 +-- .../audio_coding/main/test/TestStereo.cc | 30 +++---- .../audio_coding/main/test/TestVADDTX.cc | 16 ++-- .../main/test/TwoWayCommunication.cc | 26 +++--- .../audio_coding/main/test/delay_test.cc | 10 +-- .../main/test/dual_stream_unittest.cc | 8 +- .../audio_coding/main/test/iSACTest.cc | 16 ++-- .../main/test/initial_delay_unittest.cc | 16 ++-- .../modules/audio_coding/main/test/utility.cc | 4 +- webrtc/modules/utility/source/coder.cc | 5 +- webrtc/voice_engine/channel.cc | 40 +++++---- webrtc/voice_engine/voe_codec_impl.cc | 2 +- 20 files changed, 214 insertions(+), 207 deletions(-) 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 236c07721..11c255682 100644 --- a/webrtc/modules/audio_coding/main/interface/audio_coding_module.h +++ b/webrtc/modules/audio_coding/main/interface/audio_coding_module.h @@ -111,7 +111,7 @@ class AudioCodingModule: public Module { // -1 if the list number (list_id) is invalid. // 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() @@ -132,7 +132,7 @@ class AudioCodingModule: public Module { // -1 if no codec matches the given parameters. // 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); /////////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ class AudioCodingModule: public Module { // -1 if failed to get send codec, // 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() @@ -441,8 +441,8 @@ class AudioCodingModule: public Module { // -1 if fails to retrieve the setting of DTX/VAD, // 0 if succeeded. // - virtual WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled, - ACMVADMode& vad_mode) const = 0; + virtual WebRtc_Word32 VAD(bool* dtx_enabled, bool* vad_enabled, + ACMVADMode* vad_mode) const = 0; /////////////////////////////////////////////////////////////////////////// // WebRtc_Word32 ReplaceInternalDTXWithWebRtc() @@ -476,7 +476,7 @@ class AudioCodingModule: public Module { // 0 if succeeded. // virtual WebRtc_Word32 IsInternalDTXReplacedWithWebRtc( - bool& uses_webrtc_dtx) = 0; + bool* uses_webrtc_dtx) = 0; /////////////////////////////////////////////////////////////////////////// // WebRtc_Word32 RegisterVADCallback() @@ -589,7 +589,7 @@ class AudioCodingModule: public Module { // -1 if failed to retrieve the codec, // 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() @@ -729,7 +729,8 @@ class AudioCodingModule: public Module { // 0 if the output is 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() @@ -744,8 +745,8 @@ class AudioCodingModule: public Module { // 0 if the output is a correct timestamp. // -1 if failed to output the correct timestamp. // - // - virtual WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp) = 0; + // TODO(tlegrand): Change function to return the timestamp. + virtual WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32* timestamp) = 0; /////////////////////////////////////////////////////////////////////////// // WebRtc_Word32 DecoderEstimatedBandwidth() @@ -817,9 +818,8 @@ class AudioCodingModule: public Module { // -1 if the function fails, // 0 if the function succeeds. // - virtual WebRtc_Word32 - PlayoutData10Ms(const WebRtc_Word32 desired_freq_hz, - AudioFrame &audio_frame) = 0; + virtual WebRtc_Word32 PlayoutData10Ms(WebRtc_Word32 desired_freq_hz, + AudioFrame* audio_frame) = 0; /////////////////////////////////////////////////////////////////////////// // (CNG) Comfort Noise Generation @@ -939,7 +939,7 @@ class AudioCodingModule: public Module { // 0 if statistics are set successfully. // virtual WebRtc_Word32 NetworkStatistics( - ACMNetworkStatistics& network_statistics) const = 0; + ACMNetworkStatistics* network_statistics) const = 0; // // Set an initial delay for playout. 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 dc69762c2..91620b374 100644 --- a/webrtc/modules/audio_coding/main/source/audio_coding_module.cc +++ b/webrtc/modules/audio_coding/main/source/audio_coding_module.cc @@ -34,15 +34,15 @@ WebRtc_UWord8 AudioCodingModule::NumberOfCodecs() { } // Get supported codec param with id -WebRtc_Word32 AudioCodingModule::Codec(const WebRtc_UWord8 list_id, - CodecInst& codec) { +WebRtc_Word32 AudioCodingModule::Codec(WebRtc_UWord8 list_id, + CodecInst* codec) { // 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. WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name, - CodecInst& codec, int sampling_freq_hz, + CodecInst* codec, int sampling_freq_hz, int channels) { int codec_id; @@ -51,20 +51,20 @@ WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name, if (codec_id < 0) { // We couldn't find a matching codec, set the parameterss to unacceptable // values and return. - codec.plname[0] = '\0'; - codec.pltype = -1; - codec.pacsize = 0; - codec.rate = 0; - codec.plfreq = 0; + codec->plname[0] = '\0'; + codec->pltype = -1; + codec->pacsize = 0; + codec->rate = 0; + codec->plfreq = 0; return -1; } // 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 // will be the same value as in defaul codec settings, but not for all. - codec.channels = channels; + codec->channels = channels; return 0; } 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 4211be8b4..ba7bde125 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 @@ -1171,11 +1171,12 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec( // Get current send codec. WebRtc_Word32 AudioCodingModuleImpl::SendCodec( - CodecInst& current_codec) const { + CodecInst* current_codec) const { WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, "SendCodec()"); CriticalSectionScoped lock(acm_crit_sect_); + assert(current_codec); if (!send_codec_registered_) { WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, "SendCodec Failed, no codec is registered"); @@ -1185,7 +1186,7 @@ WebRtc_Word32 AudioCodingModuleImpl::SendCodec( WebRtcACMCodecParams encoder_param; 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)); + memcpy(current_codec, &(encoder_param.codec_inst), sizeof(CodecInst)); return 0; } @@ -1597,13 +1598,14 @@ int AudioCodingModuleImpl::SetVADSafe(bool enable_dtx, } // Get VAD/DTX settings. -WebRtc_Word32 AudioCodingModuleImpl::VAD(bool& dtx_enabled, bool& vad_enabled, - ACMVADMode& mode) const { +// TODO(tlegrand): Change this method to void. +WebRtc_Word32 AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled, + ACMVADMode* mode) const { CriticalSectionScoped lock(acm_crit_sect_); - dtx_enabled = dtx_enabled_; - vad_enabled = vad_enabled_; - mode = vad_mode_; + *dtx_enabled = dtx_enabled_; + *vad_enabled = vad_enabled_; + *mode = vad_mode_; return 0; } @@ -1931,7 +1933,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe( // Get current received codec. WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec( - CodecInst& current_codec) const { + CodecInst* current_codec) const { WebRtcACMCodecParams decoder_param; CriticalSectionScoped lock(acm_crit_sect_); @@ -1940,7 +1942,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec( if (codecs_[id]->DecoderInitialized()) { if (codecs_[id]->DecoderParams(&decoder_param, last_recv_audio_codec_pltype_)) { - memcpy(¤t_codec, &decoder_param.codec_inst, + memcpy(current_codec, &decoder_param.codec_inst, sizeof(CodecInst)); 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 // indicate that the structure is invalid and return -1. - current_codec.pltype = -1; + current_codec->pltype = -1; return -1; } @@ -2222,10 +2224,10 @@ AudioPlayoutMode AudioCodingModuleImpl::PlayoutMode() const { // Get 10 milliseconds of raw audio data to play out. // Automatic resample to the requested frequency. WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms( - const WebRtc_Word32 desired_freq_hz, AudioFrame& audio_frame) { + WebRtc_Word32 desired_freq_hz, AudioFrame* audio_frame) { bool stereo_mode; - if (GetSilence(desired_freq_hz, &audio_frame)) + if (GetSilence(desired_freq_hz, audio_frame)) return 0; // Silence is generated, return. // RecOut always returns 10 ms. @@ -2235,9 +2237,9 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms( return -1; } - audio_frame.num_channels_ = audio_frame_.num_channels_; - audio_frame.vad_activity_ = audio_frame_.vad_activity_; - audio_frame.speech_type_ = audio_frame_.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 = (audio_frame_.num_channels_ > 1); // For stereo playout: @@ -2256,7 +2258,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms( if ((receive_freq != desired_freq_hz) && (desired_freq_hz != -1)) { // Resample payload_data. 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_); if (temp_len < 0) { @@ -2266,40 +2268,40 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms( } // 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. - audio_frame.sample_rate_hz_ = desired_freq_hz; + audio_frame->sample_rate_hz_ = desired_freq_hz; } else { - memcpy(audio_frame.data_, audio_frame_.data_, - audio_frame_.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_ = + audio_frame->samples_per_channel_ = audio_frame_.samples_per_channel_; // Set the sampling frequency. - audio_frame.sample_rate_hz_ = receive_freq; + audio_frame->sample_rate_hz_ = receive_freq; } // Tone detection done for master channel. if (dtmf_detector_ != NULL) { // Dtmf Detection. - if (audio_frame.sample_rate_hz_ == 8000) { - // Use audio_frame.data_ then Dtmf detector doesn't + if (audio_frame->sample_rate_hz_ == 8000) { + // Use audio_frame->data_ then Dtmf detector doesn't // need resampling. if (!stereo_mode) { - dtmf_detector_->Detect(audio_frame.data_, - audio_frame.samples_per_channel_, - audio_frame.sample_rate_hz_, tone_detected, + 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]; + master_channel[n] = audio_frame->data_[n << 1]; } dtmf_detector_->Detect(master_channel, - audio_frame.samples_per_channel_, - audio_frame.sample_rate_hz_, tone_detected, + audio_frame->samples_per_channel_, + audio_frame->sample_rate_hz_, tone_detected, tone); } } else { @@ -2346,9 +2348,9 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms( } } - audio_frame.id_ = id_; - audio_frame.energy_ = -1; - audio_frame.timestamp_ = 0; + audio_frame->id_ = id_; + audio_frame->energy_ = -1; + audio_frame->timestamp_ = 0; return 0; } @@ -2373,9 +2375,9 @@ WebRtc_Word16 AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) { // WebRtc_Word32 AudioCodingModuleImpl::NetworkStatistics( - ACMNetworkStatistics& statistics) const { + ACMNetworkStatistics* statistics) const { WebRtc_Word32 status; - status = neteq_.NetworkStatistics(&statistics); + status = neteq_.NetworkStatistics(statistics); return status; } @@ -2594,13 +2596,13 @@ WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc( } WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc( - bool& uses_webrtc_dtx) { + bool* uses_webrtc_dtx) { CriticalSectionScoped lock(acm_crit_sect_); if (!HaveValidEncoder("IsInternalDTXReplacedWithWebRtc")) { return -1; } - if (codecs_[current_send_codec_idx_]->IsInternalDTXReplaced(&uses_webrtc_dtx) + if (codecs_[current_send_codec_idx_]->IsInternalDTXReplaced(uses_webrtc_dtx) < 0) { return -1; } @@ -2655,19 +2657,19 @@ WebRtc_Word32 AudioCodingModuleImpl::SetBackgroundNoiseMode( } WebRtc_Word32 AudioCodingModuleImpl::BackgroundNoiseMode( - ACMBackgroundNoiseMode& mode) { - return neteq_.BackgroundNoiseMode(mode); + ACMBackgroundNoiseMode* mode) { + return neteq_.BackgroundNoiseMode(*mode); } WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp( - WebRtc_UWord32& timestamp) { + WebRtc_UWord32* timestamp) { WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, "PlayoutTimestamp()"); if (track_neteq_buffer_) { - timestamp = playout_ts_; + *timestamp = playout_ts_; return 0; } else { - return neteq_.PlayoutTimestamp(timestamp); + return neteq_.PlayoutTimestamp(*timestamp); } } 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 53ea4619c..6fb40d5bd 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 @@ -68,7 +68,7 @@ class AudioCodingModuleImpl : public AudioCodingModule { int SecondarySendCodec(CodecInst* secondary_codec) const; // Get current send codec. - WebRtc_Word32 SendCodec(CodecInst& current_codec) const; + WebRtc_Word32 SendCodec(CodecInst* current_codec) const; // Get current send frequency. WebRtc_Word32 SendFrequency() const; @@ -99,7 +99,7 @@ class AudioCodingModuleImpl : public AudioCodingModule { WebRtc_Word32 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode); // Get current background noise mode. - WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode); + WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode* mode); ///////////////////////////////////////// // (FEC) Forward Error Correction @@ -121,8 +121,8 @@ class AudioCodingModuleImpl : public AudioCodingModule { const bool enable_vad = false, const ACMVADMode mode = VADNormal); - WebRtc_Word32 VAD(bool& dtx_enabled, bool& vad_enabled, - ACMVADMode& mode) const; + WebRtc_Word32 VAD(bool* dtx_enabled, bool* vad_enabled, + ACMVADMode* mode) const; WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vad_callback); @@ -153,7 +153,7 @@ class AudioCodingModuleImpl : public AudioCodingModule { WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receive_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. WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_payload, @@ -189,18 +189,18 @@ class AudioCodingModuleImpl : public AudioCodingModule { AudioPlayoutMode PlayoutMode() const; // 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 // automatic resample to the requested frequency if > 0. - WebRtc_Word32 PlayoutData10Ms(const WebRtc_Word32 desired_freq_hz, - AudioFrame &audio_frame); + WebRtc_Word32 PlayoutData10Ms(WebRtc_Word32 desired_freq_hz, + AudioFrame* audio_frame); ///////////////////////////////////////// // Statistics // - WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics& statistics) const; + WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics* statistics) const; void DestructEncoderInst(void* inst); @@ -221,7 +221,7 @@ class AudioCodingModuleImpl : public AudioCodingModule { 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); diff --git a/webrtc/modules/audio_coding/main/test/APITest.cc b/webrtc/modules/audio_coding/main/test/APITest.cc index 3cf9bc1f6..81e266868 100644 --- a/webrtc/modules/audio_coding/main/test/APITest.cc +++ b/webrtc/modules/audio_coding/main/test/APITest.cc @@ -182,7 +182,7 @@ APITest::SetUp() WebRtc_Word16 numCodecs = _acmA->NumberOfCodecs(); for(WebRtc_UWord8 n = 0; n < numCodecs; n++) { - AudioCodingModule::Codec(n, dummyCodec); + AudioCodingModule::Codec(n, &dummyCodec); if((STR_CASE_CMP(dummyCodec.plname, "CN") == 0) && (dummyCodec.plfreq == 32000)) { @@ -205,7 +205,7 @@ APITest::SetUp() // test if re-registration works; CodecInst nextCodec; int currentPayloadType = dummyCodec.pltype; - AudioCodingModule::Codec(n + 1, nextCodec); + AudioCodingModule::Codec(n + 1, &nextCodec); dummyCodec.pltype = nextCodec.pltype; if(!FixedPayloadTypeCodec(nextCodec.plname)) { @@ -218,7 +218,7 @@ APITest::SetUp() { // test if un-registration works; CodecInst nextCodec; - AudioCodingModule::Codec(n + 1, nextCodec); + AudioCodingModule::Codec(n + 1, &nextCodec); nextCodec.pltype = dummyCodec.pltype; if(!FixedPayloadTypeCodec(nextCodec.plname)) { @@ -248,11 +248,11 @@ APITest::SetUp() _thereIsDecoderB = true; // Register Send Codec - AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrA, dummyCodec); + AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrA, &dummyCodec); CHECK_ERROR_MT(_acmA->RegisterSendCodec(dummyCodec)); _thereIsEncoderA = true; // - AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrB, dummyCodec); + AudioCodingModule::Codec((WebRtc_UWord8)_codecCntrB, &dummyCodec); CHECK_ERROR_MT(_acmB->RegisterSendCodec(dummyCodec)); _thereIsEncoderB = true; @@ -410,7 +410,7 @@ APITest::PullAudioRunA() { _pullEventA->Wait(100); AudioFrame audioFrame; - if(_acmA->PlayoutData10Ms(_outFreqHzA, audioFrame) < 0) + if(_acmA->PlayoutData10Ms(_outFreqHzA, &audioFrame) < 0) { bool thereIsDecoder; { @@ -438,7 +438,7 @@ APITest::PullAudioRunB() { _pullEventB->Wait(100); AudioFrame audioFrame; - if(_acmB->PlayoutData10Ms(_outFreqHzB, audioFrame) < 0) + if(_acmB->PlayoutData10Ms(_outFreqHzB, &audioFrame) < 0) { bool thereIsDecoder; { @@ -794,7 +794,7 @@ APITest::CheckVADStatus(char side) if(side == 'A') { - _acmA->VAD(dtxEnabled, vadEnabled, vadMode); + _acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode); _acmA->RegisterVADCallback(NULL); _vadCallbackA->Reset(); _acmA->RegisterVADCallback(_vadCallbackA); @@ -838,7 +838,7 @@ APITest::CheckVADStatus(char side) } else { - _acmB->VAD(dtxEnabled, vadEnabled, vadMode); + _acmB->VAD(&dtxEnabled, &vadEnabled, &vadMode); _acmB->RegisterVADCallback(NULL); _vadCallbackB->Reset(); @@ -920,7 +920,7 @@ APITest::TestDelay(char side) inTimestamp = myChannel->LastInTimestamp(); - CHECK_ERROR_MT(myACM->PlayoutTimestamp(outTimestamp)); + CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp)); if(!_randomTest) { @@ -932,7 +932,7 @@ APITest::TestDelay(char side) myEvent->Wait(1000); inTimestamp = myChannel->LastInTimestamp(); - CHECK_ERROR_MT(myACM->PlayoutTimestamp(outTimestamp)); + CHECK_ERROR_MT(myACM->PlayoutTimestamp(&outTimestamp)); //std::cout << outTimestamp << std::endl << std::flush; estimDelay = (double)((WebRtc_UWord32)(inTimestamp - outTimestamp)) / @@ -968,7 +968,7 @@ APITest::TestDelay(char side) *myMinDelay = (rand() % 1000) + 1; ACMNetworkStatistics networkStat; - CHECK_ERROR_MT(myACM->NetworkStatistics(networkStat)); + CHECK_ERROR_MT(myACM->NetworkStatistics(&networkStat)); if(!_randomTest) { @@ -1039,9 +1039,9 @@ APITest::TestRegisteration(char sendSide) } CodecInst myCodec; - if(sendACM->SendCodec(myCodec) < 0) + if(sendACM->SendCodec(&myCodec) < 0) { - AudioCodingModule::Codec(_codecCntrA, myCodec); + AudioCodingModule::Codec(_codecCntrA, &myCodec); } if(!_randomTest) @@ -1332,7 +1332,7 @@ APITest::TestSendVAD(char side) if(side == 'A') { - AudioCodingModule::Codec(_codecCntrA, myCodec); + AudioCodingModule::Codec(_codecCntrA, &myCodec); vad = &_sendVADA; dtx = &_sendDTXA; mode = &_sendVADModeA; @@ -1341,7 +1341,7 @@ APITest::TestSendVAD(char side) } else { - AudioCodingModule::Codec(_codecCntrB, myCodec); + AudioCodingModule::Codec(_codecCntrB, &myCodec); vad = &_sendVADB; dtx = &_sendDTXB; mode = &_sendVADModeB; @@ -1408,11 +1408,11 @@ APITest::CurrentCodec(char side) CodecInst myCodec; if(side == 'A') { - _acmA->SendCodec(myCodec); + _acmA->SendCodec(&myCodec); } else { - _acmB->SendCodec(myCodec); + _acmB->SendCodec(&myCodec); } if(!_randomTest) @@ -1493,11 +1493,11 @@ APITest::ChangeCodec(char side) Wait(1000); // 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)); } - if(AudioCodingModule::Codec("CN", myCodec, 16000, 1) >= 0) + if(AudioCodingModule::Codec("CN", &myCodec, 16000, 1) >= 0) { CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); } @@ -1507,7 +1507,7 @@ APITest::ChangeCodec(char side) _writeToFile = false; } - AudioCodingModule::Codec(*codecCntr, myCodec); + AudioCodingModule::Codec(*codecCntr, &myCodec); } while(!STR_CASE_CMP(myCodec.plname, "CN") || !STR_CASE_CMP(myCodec.plname, "telephone-event") || !STR_CASE_CMP(myCodec.plname, "RED")); diff --git a/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc b/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc index 09ff58e0d..58ad6c873 100644 --- a/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc +++ b/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc @@ -73,14 +73,14 @@ void Sender::Setup(AudioCodingModule *acm, RTPStream *rtpStream) { // Choose codec on command line. printf("List of supported codec.\n"); for (int n = 0; n < noOfCodecs; n++) { - acm->Codec(n, sendCodec); + acm->Codec(n, &sendCodec); printf("%d %s\n", n, sendCodec.plname); } printf("Choose your codec:"); ASSERT_GT(scanf("%d", &codecNo), 0); } - acm->Codec(codecNo, sendCodec); + acm->Codec(codecNo, &sendCodec); if (!strcmp(sendCodec.plname, "CELT")) { sendCodec.channels = 1; } @@ -144,7 +144,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) { noOfCodecs = acm->NumberOfCodecs(); for (int i = 0; i < noOfCodecs; i++) { - acm->Codec((WebRtc_UWord8) i, recvCodec); + acm->Codec((WebRtc_UWord8) i, &recvCodec); if (acm->RegisterReceiveCodec(recvCodec) != 0) { printf("Unable to register codec: for run: codecId: %d\n", codeId); exit(1); @@ -224,7 +224,7 @@ bool Receiver::IncomingPacket() { bool Receiver::PlayoutData() { AudioFrame audioFrame; - if (_acm->PlayoutData10Ms(_frequency, audioFrame) != 0) { + if (_acm->PlayoutData10Ms(_frequency, &audioFrame) != 0) { printf("Error when calling PlayoutData10Ms, for run: codecId: %d\n", codeId); exit(1); @@ -305,7 +305,7 @@ void EncodeDecodeTest::Perform() { } if (_testMode != 2) { for (int n = 0; n < numCodecs; n++) { - acm->Codec(n, sendCodecTmp); + acm->Codec(n, &sendCodecTmp); if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { numPars[n] = 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); struct CodecInst sendCodecInst; - if (acm->SendCodec(sendCodecInst) >= 0) { + if (acm->SendCodec(&sendCodecInst) >= 0) { _sender.Run(); } _sender.Teardown(); diff --git a/webrtc/modules/audio_coding/main/test/SpatialAudio.cc b/webrtc/modules/audio_coding/main/test/SpatialAudio.cc index 923eefe16..15875eec2 100644 --- a/webrtc/modules/audio_coding/main/test/SpatialAudio.cc +++ b/webrtc/modules/audio_coding/main/test/SpatialAudio.cc @@ -82,7 +82,7 @@ SpatialAudio::Setup() WebRtc_UWord8 num_encoders = _acmReceiver->NumberOfCodecs(); // Register all available codes as receiving codecs once more. for (WebRtc_UWord8 n = 0; n < num_encoders; n++) { - status = _acmReceiver->Codec(n, codecInst); + status = _acmReceiver->Codec(n, &codecInst); if (status < 0) { printf("Error in Codec(), no matching codec found"); } @@ -109,7 +109,7 @@ SpatialAudio::Perform() Setup(); CodecInst codecInst; - _acmLeft->Codec((WebRtc_UWord8)1, codecInst); + _acmLeft->Codec((WebRtc_UWord8)1, &codecInst); CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst)); EncodeDecode(); @@ -122,7 +122,7 @@ SpatialAudio::Perform() while((pannCntr + 1) < NUM_PANN_COEFFS) { - _acmLeft->Codec((WebRtc_UWord8)0, codecInst); + _acmLeft->Codec((WebRtc_UWord8)0, &codecInst); codecInst.pacsize = 480; CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst)); CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst)); @@ -131,7 +131,7 @@ SpatialAudio::Perform() pannCntr++; // Change codec - _acmLeft->Codec((WebRtc_UWord8)3, codecInst); + _acmLeft->Codec((WebRtc_UWord8)3, &codecInst); codecInst.pacsize = 320; CHECK_ERROR(_acmLeft->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)); EncodeDecode(); - _acmLeft->Codec((WebRtc_UWord8)0, codecInst); + _acmLeft->Codec((WebRtc_UWord8)0, &codecInst); codecInst.pacsize = 480; CHECK_ERROR(_acmLeft->RegisterSendCodec(codecInst)); CHECK_ERROR(_acmRight->RegisterSendCodec(codecInst)); @@ -200,7 +200,8 @@ SpatialAudio::EncodeDecode( CHECK_ERROR(_acmLeft->Process()); CHECK_ERROR(_acmRight->Process()); - CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, audioFrame)); + CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, + &audioFrame)); _outFile.Write10MsData(audioFrame); } _inFile.Rewind(); @@ -221,7 +222,8 @@ SpatialAudio::EncodeDecode() CHECK_ERROR(_acmLeft->Process()); - CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, audioFrame)); + CHECK_ERROR(_acmReceiver->PlayoutData10Ms(outFileSampFreq, + &audioFrame)); _outFile.Write10MsData(audioFrame); } _inFile.Rewind(); diff --git a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc index 46a589779..1f68aca41 100644 --- a/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc +++ b/webrtc/modules/audio_coding/main/test/TestAllCodecs.cc @@ -145,7 +145,7 @@ void TestAllCodecs::Perform() { uint8_t num_encoders = acm_a_->NumberOfCodecs(); CodecInst my_codec_param; 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")) { my_codec_param.channels = 1; } @@ -752,7 +752,7 @@ void TestAllCodecs::RegisterSendCodec(char side, char* codec_name, // Get all codec parameters before registering 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)); my_codec_param.rate = rate; my_codec_param.pacsize = packet_size; @@ -795,7 +795,7 @@ void TestAllCodecs::Run(TestPack* channel) { } // 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. outfile_b_.Write10MsData(audio_frame.data_, @@ -824,9 +824,9 @@ void TestAllCodecs::OpenOutFile(int test_number) { void TestAllCodecs::DisplaySendReceiveCodec() { CodecInst my_codec_param; - acm_a_->SendCodec(my_codec_param); + acm_a_->SendCodec(&my_codec_param); 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); } diff --git a/webrtc/modules/audio_coding/main/test/TestFEC.cc b/webrtc/modules/audio_coding/main/test/TestFEC.cc index bdbd97aa9..9f5f0224a 100644 --- a/webrtc/modules/audio_coding/main/test/TestFEC.cc +++ b/webrtc/modules/audio_coding/main/test/TestFEC.cc @@ -79,7 +79,7 @@ void TestFEC::Perform() } for(WebRtc_UWord8 n = 0; n < numEncoders; n++) { - _acmB->Codec(n, myCodecParam); + _acmB->Codec(n, &myCodecParam); if(_testMode != 0) { printf("%s\n", myCodecParam.plname); @@ -553,7 +553,7 @@ WebRtc_Word16 TestFEC::RegisterSendCodec(char side, char* codecName, WebRtc_Word } CodecInst myCodecParam; - CHECK_ERROR(AudioCodingModule::Codec(codecName, myCodecParam, + CHECK_ERROR(AudioCodingModule::Codec(codecName, &myCodecParam, samplingFreqHz, 1)); CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam)); @@ -575,7 +575,7 @@ void TestFEC::Run() _inFileA.Read10MsData(audioFrame); CHECK_ERROR(_acmA->Add10MsData(audioFrame)); CHECK_ERROR(_acmA->Process()); - CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, audioFrame)); + CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, &audioFrame)); _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_); msecPassed += 10; if(msecPassed >= 1000) @@ -616,9 +616,9 @@ void TestFEC::OpenOutFile(WebRtc_Word16 test_number) { void TestFEC::DisplaySendReceiveCodec() { CodecInst myCodecParam; - _acmA->SendCodec(myCodecParam); + _acmA->SendCodec(&myCodecParam); printf("%s -> ", myCodecParam.plname); - _acmB->ReceiveCodec(myCodecParam); + _acmB->ReceiveCodec(&myCodecParam); printf("%s\n", myCodecParam.plname); } diff --git a/webrtc/modules/audio_coding/main/test/TestStereo.cc b/webrtc/modules/audio_coding/main/test/TestStereo.cc index b06f19d7a..e1186ba2b 100644 --- a/webrtc/modules/audio_coding/main/test/TestStereo.cc +++ b/webrtc/modules/audio_coding/main/test/TestStereo.cc @@ -182,19 +182,19 @@ void TestStereo::Perform() { WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs(); CodecInst my_codec_param; 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)); } // Test that unregister all receive codecs works. 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)); } // Register all available codes as receiving codecs once more. 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)); } @@ -222,12 +222,12 @@ void TestStereo::Perform() { // Continue with setting a stereo codec as send codec and verify that // VAD/DTX gets turned off. 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(vad); char codec_pcma_temp[] = "PCMA"; 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(vad); if (test_mode_ != 0) { @@ -366,19 +366,19 @@ void TestStereo::Perform() { // Test that VAD/DTX cannot be turned on while sending stereo. 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(vad); 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(vad); 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(vad); 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(vad); @@ -603,7 +603,7 @@ void TestStereo::Perform() { // Make sure it is possible to set VAD/CNG, now that we are sending mono // again. 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(vad); EXPECT_EQ(0, acm_a_->SetVAD(false, false, VADNormal)); @@ -687,7 +687,7 @@ void TestStereo::Perform() { opus_pltype_); CodecInst opus_codec_param; 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")) { opus_codec_param.channels = 1; 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; // 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)); my_codec_param.rate = rate; 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 - 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 out_file_.Write10MsData( @@ -919,11 +919,11 @@ void TestStereo::OpenOutFile(WebRtc_Word16 test_number) { void TestStereo::DisplaySendReceiveCodec() { CodecInst my_codec_param; - acm_a_->SendCodec(my_codec_param); + acm_a_->SendCodec(&my_codec_param); if (test_mode_ != 0) { printf("%s -> ", my_codec_param.plname); } - acm_b_->ReceiveCodec(my_codec_param); + acm_b_->ReceiveCodec(&my_codec_param); if (test_mode_ != 0) { printf("%s\n", my_codec_param.plname); } diff --git a/webrtc/modules/audio_coding/main/test/TestVADDTX.cc b/webrtc/modules/audio_coding/main/test/TestVADDTX.cc index 567903b26..0d6a6b668 100644 --- a/webrtc/modules/audio_coding/main/test/TestVADDTX.cc +++ b/webrtc/modules/audio_coding/main/test/TestVADDTX.cc @@ -78,7 +78,7 @@ void TestVADDTX::Perform() } for(WebRtc_UWord8 n = 0; n < numEncoders; n++) { - _acmB->Codec(n, myCodecParam); + _acmB->Codec(n, &myCodecParam); if(_testMode != 0) { printf("%s\n", myCodecParam.plname); @@ -174,7 +174,7 @@ void TestVADDTX::runTestCases() if(_testMode != 0) { CodecInst myCodecParam; - _acmA->SendCodec(myCodecParam); + _acmA->SendCodec(&myCodecParam); printf("%s\n", myCodecParam.plname); } else @@ -239,7 +239,7 @@ void TestVADDTX::SetVAD(bool statusDTX, bool statusVAD, WebRtc_Word16 vadMode) if (_acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode) < 0) { assert(false); } - if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) { + if (_acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet) < 0) { assert(false); } @@ -282,7 +282,7 @@ VADDTXstruct TestVADDTX::GetVAD() bool dtxEnabled, vadEnabled; ACMVADMode vadModeSet; - if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) { + if (_acmA->VAD(&dtxEnabled, &vadEnabled, &vadModeSet) < 0) { assert(false); } @@ -328,7 +328,7 @@ WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side, for(WebRtc_Word16 codecCntr = 0; codecCntr < myACM->NumberOfCodecs(); 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((samplingFreqHz == -1) || (myCodecParam.plfreq == samplingFreqHz)) @@ -366,7 +366,7 @@ void TestVADDTX::Run() CHECK_ERROR(_acmA->Process()); - CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, audioFrame)); + CHECK_ERROR(_acmB->PlayoutData10Ms(outFreqHzB, &audioFrame)); _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_); } #ifdef PRINT_STAT @@ -399,7 +399,7 @@ WebRtc_Word16 TestVADDTX::VerifyTest() WebRtc_UWord8 vadPattern = 0; WebRtc_UWord8 emptyFramePattern[6]; CodecInst myCodecParam; - _acmA->SendCodec(myCodecParam); + _acmA->SendCodec(&myCodecParam); bool dtxInUse = true; bool isReplaced = false; 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,"speex") == 0)) { - _acmA->IsInternalDTXReplacedWithWebRtc(isReplaced); + _acmA->IsInternalDTXReplacedWithWebRtc(&isReplaced); if (!isReplaced) { dtxInUse = false; diff --git a/webrtc/modules/audio_coding/main/test/TwoWayCommunication.cc b/webrtc/modules/audio_coding/main/test/TwoWayCommunication.cc index 2e580cb52..6b569fa42 100644 --- a/webrtc/modules/audio_coding/main/test/TwoWayCommunication.cc +++ b/webrtc/modules/audio_coding/main/test/TwoWayCommunication.cc @@ -78,7 +78,7 @@ TwoWayCommunication::ChooseCodec(WebRtc_UWord8* codecID_A, printf("========================\n"); for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++) { - tmpACM->Codec(codecCntr, codecInst); + tmpACM->Codec(codecCntr, &codecInst); printf("%d- %s\n", codecCntr, codecInst.plname); } printf("\nChoose a send codec for side A [0]: "); @@ -110,10 +110,10 @@ WebRtc_Word16 TwoWayCommunication::SetUp() CodecInst codecInst_A; CodecInst codecInst_B; CodecInst dummyCodec; - _acmA->Codec(codecID_A, codecInst_A); - _acmB->Codec(codecID_B, codecInst_B); + _acmA->Codec(codecID_A, &codecInst_A); + _acmB->Codec(codecID_B, &codecInst_B); - _acmA->Codec(6, dummyCodec); + _acmA->Codec(6, &dummyCodec); //--- Set A codecs CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A)); @@ -214,9 +214,9 @@ WebRtc_Word16 TwoWayCommunication::SetUpAutotest() CodecInst codecInst_B; CodecInst dummyCodec; - _acmA->Codec("ISAC", codecInst_A, 16000, 1); - _acmB->Codec("L16", codecInst_B, 8000, 1); - _acmA->Codec(6, dummyCodec); + _acmA->Codec("ISAC", &codecInst_A, 16000, 1); + _acmB->Codec("L16", &codecInst_B, 8000, 1); + _acmA->Codec(6, &dummyCodec); //--- Set A codecs CHECK_ERROR(_acmA->RegisterSendCodec(codecInst_A)); @@ -320,7 +320,7 @@ TwoWayCommunication::Perform() CodecInst codecInst_B; CodecInst dummy; - _acmB->SendCodec(codecInst_B); + _acmB->SendCodec(&codecInst_B); if(_testMode != 0) { @@ -345,16 +345,16 @@ TwoWayCommunication::Perform() _acmRefA->Process(); _acmRefB->Process(); - _acmA->PlayoutData10Ms(outFreqHzA, audioFrame); + _acmA->PlayoutData10Ms(outFreqHzA, &audioFrame); _outFileA.Write10MsData(audioFrame); - _acmRefA->PlayoutData10Ms(outFreqHzA, audioFrame); + _acmRefA->PlayoutData10Ms(outFreqHzA, &audioFrame); _outFileRefA.Write10MsData(audioFrame); - _acmB->PlayoutData10Ms(outFreqHzB, audioFrame); + _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame); _outFileB.Write10MsData(audioFrame); - _acmRefB->PlayoutData10Ms(outFreqHzB, audioFrame); + _acmRefB->PlayoutData10Ms(outFreqHzB, &audioFrame); _outFileRefB.Write10MsData(audioFrame); msecPassed += 10; @@ -398,7 +398,7 @@ TwoWayCommunication::Perform() printf("Register Send Codec (audio back in side A)\n"); } CHECK_ERROR(_acmB->RegisterSendCodec(codecInst_B)); - CHECK_ERROR(_acmB->SendCodec(dummy)); + CHECK_ERROR(_acmB->SendCodec(&dummy)); } if(((secPassed%7) == 6) && (msecPassed == 0)) { diff --git a/webrtc/modules/audio_coding/main/test/delay_test.cc b/webrtc/modules/audio_coding/main/test/delay_test.cc index 2383b3447..c1926e4c1 100644 --- a/webrtc/modules/audio_coding/main/test/delay_test.cc +++ b/webrtc/modules/audio_coding/main/test/delay_test.cc @@ -108,7 +108,7 @@ class DelayTest { WebRtc_UWord8 num_encoders = acm_a_->NumberOfCodecs(); CodecInst my_codec_param; 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) my_codec_param.channels = 1; else if (my_codec_param.channels > 1) @@ -155,7 +155,7 @@ class DelayTest { void SendCodec(const CodecConfig& config) { 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.num_channels)); encoding_sample_rate_hz_ = my_codec_param.plfreq; @@ -201,7 +201,7 @@ class DelayTest { // Print delay information every 16 frame if ((num_frames & 0x3F) == 0x3F) { ACMNetworkStatistics statistics; - acm_b_->NetworkStatistics(statistics); + acm_b_->NetworkStatistics(&statistics); fprintf(stdout, "delay: min=%3d max=%3d mean=%3d median=%3d" " ts-based average = %6.3f, " "curr buff-lev = %4u opt buff-lev = %4u \n", @@ -218,11 +218,11 @@ class DelayTest { in_file_a_.Read10MsData(audio_frame); ASSERT_EQ(0, acm_a_->Add10MsData(audio_frame)); 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_, audio_frame.samples_per_channel_ * audio_frame.num_channels_); - acm_b_->PlayoutTimestamp(playout_ts); + acm_b_->PlayoutTimestamp(&playout_ts); received_ts = channel_a2b_->LastInTimestamp(); inst_delay_sec = static_cast(received_ts - playout_ts) / static_cast(encoding_sample_rate_hz_); diff --git a/webrtc/modules/audio_coding/main/test/dual_stream_unittest.cc b/webrtc/modules/audio_coding/main/test/dual_stream_unittest.cc index d489169a3..1e3d08e33 100644 --- a/webrtc/modules/audio_coding/main/test/dual_stream_unittest.cc +++ b/webrtc/modules/audio_coding/main/test/dual_stream_unittest.cc @@ -111,7 +111,7 @@ void DualStreamTest::PopulateCodecInstances(int frame_size_primary_ms, red_encoder_.pltype = -1; 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 && my_codec.plfreq == sampling_rate) { my_codec.rate = 32000; @@ -480,7 +480,7 @@ TEST_F(DualStreamTest, Api) { bool vad_status; bool dtx_status; 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(dtx_status); EXPECT_EQ(VADNormal, vad_mode); @@ -492,7 +492,7 @@ TEST_F(DualStreamTest, Api) { ASSERT_EQ(0, memcmp(&my_codec, &secondary_encoder_, sizeof(my_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(dtx_status); @@ -506,7 +506,7 @@ TEST_F(DualStreamTest, Api) { ASSERT_EQ(0, acm_dual_stream_->SetVAD(true, true, VADVeryAggr)); // 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(dtx_status); EXPECT_EQ(VADVeryAggr, vad_mode); diff --git a/webrtc/modules/audio_coding/main/test/iSACTest.cc b/webrtc/modules/audio_coding/main/test/iSACTest.cc index 28cc942aa..566fdcc21 100644 --- a/webrtc/modules/audio_coding/main/test/iSACTest.cc +++ b/webrtc/modules/audio_coding/main/test/iSACTest.cc @@ -55,7 +55,7 @@ WebRtc_Word16 SetISAConfig( (isacConfig.currentFrameSizeMsec != 0)) { CodecInst sendCodec; - acm->SendCodec(sendCodec); + acm->SendCodec(&sendCodec); if(isacConfig.currentRateBitPerSec < 0) { sendCodec.rate = -1; @@ -155,7 +155,7 @@ ISACTest::Setup() 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) { memcpy(&_paramISAC16kHz, &codecParam, sizeof(CodecInst)); @@ -210,14 +210,14 @@ ISACTest::Setup() Run10ms(); } CodecInst receiveCodec; - CHECK_ERROR(_acmA->ReceiveCodec(receiveCodec)); + CHECK_ERROR(_acmA->ReceiveCodec(&receiveCodec)); if(_testMode != 0) { printf("Side A Receive Codec\n"); printf("%s %d\n", receiveCodec.plname, receiveCodec.plfreq); } - CHECK_ERROR(_acmB->ReceiveCodec(receiveCodec)); + CHECK_ERROR(_acmB->ReceiveCodec(&receiveCodec)); if(_testMode != 0) { printf("Side B Receive Codec\n"); @@ -357,10 +357,10 @@ ISACTest::Run10ms() CHECK_ERROR(_acmA->Process()); CHECK_ERROR(_acmB->Process()); - CHECK_ERROR(_acmA->PlayoutData10Ms(32000, audioFrame)); + CHECK_ERROR(_acmA->PlayoutData10Ms(32000, &audioFrame)); _outFileA.Write10MsData(audioFrame); - CHECK_ERROR(_acmB->PlayoutData10Ms(32000, audioFrame)); + CHECK_ERROR(_acmB->PlayoutData10Ms(32000, &audioFrame)); _outFileB.Write10MsData(audioFrame); } @@ -444,9 +444,9 @@ ISACTest::EncodeDecode( { myEvent->Wait(5000); - _acmA->SendCodec(sendCodec); + _acmA->SendCodec(&sendCodec); if(_testMode == 2) printf("[%d] ", sendCodec.rate); - _acmB->SendCodec(sendCodec); + _acmB->SendCodec(&sendCodec); if(_testMode == 2) printf("[%d] ", sendCodec.rate); } } diff --git a/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc b/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc index af720c3a0..084c261d3 100644 --- a/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc +++ b/webrtc/modules/audio_coding/main/test/initial_delay_unittest.cc @@ -80,7 +80,7 @@ class InitialPlayoutDelayTest : public ::testing::Test { const int kChannels[2] = {1, 2}; for (int n = 0; n < 3; ++n) { 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); } } @@ -114,7 +114,7 @@ class InitialPlayoutDelayTest : public ::testing::Test { timestamp += in_audio_frame.samples_per_channel_; ASSERT_EQ(0, acm_a_->Add10MsData(in_audio_frame)); 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); ++num_frames; } @@ -131,38 +131,38 @@ class InitialPlayoutDelayTest : public ::testing::Test { TEST_F( InitialPlayoutDelayTest, NbMono) { CodecInst codec; - AudioCodingModule::Codec("L16", codec, 8000, 1); + AudioCodingModule::Codec("L16", &codec, 8000, 1); Run(codec, 3000); } TEST_F( InitialPlayoutDelayTest, WbMono) { CodecInst codec; - AudioCodingModule::Codec("L16", codec, 16000, 1); + AudioCodingModule::Codec("L16", &codec, 16000, 1); Run(codec, 3000); } TEST_F( InitialPlayoutDelayTest, SwbMono) { 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 // PCM16 super-wideband. } TEST_F( InitialPlayoutDelayTest, NbStereo) { CodecInst codec; - AudioCodingModule::Codec("L16", codec, 8000, 2); + AudioCodingModule::Codec("L16", &codec, 8000, 2); Run(codec, 3000); } TEST_F( InitialPlayoutDelayTest, WbStereo) { CodecInst codec; - AudioCodingModule::Codec("L16", codec, 16000, 2); + AudioCodingModule::Codec("L16", &codec, 16000, 2); Run(codec, 3000); } TEST_F( InitialPlayoutDelayTest, SwbStereo) { 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 // PCM16 super-wideband. } diff --git a/webrtc/modules/audio_coding/main/test/utility.cc b/webrtc/modules/audio_coding/main/test/utility.cc index 56acbf7de..0c614819a 100644 --- a/webrtc/modules/audio_coding/main/test/utility.cc +++ b/webrtc/modules/audio_coding/main/test/utility.cc @@ -138,7 +138,7 @@ ChooseCodec( } } while(outOfRange); - CHECK_ERROR(AudioCodingModule::Codec((WebRtc_UWord8)codecID, codecInst)); + CHECK_ERROR(AudioCodingModule::Codec((WebRtc_UWord8)codecID, &codecInst)); return 0; } @@ -151,7 +151,7 @@ PrintCodecs() printf("No Name [Hz] [bps]\n"); for(WebRtc_UWord8 codecCntr = 0; codecCntr < noCodec; codecCntr++) { - AudioCodingModule::Codec(codecCntr, codecInst); + AudioCodingModule::Codec(codecCntr, &codecInst); printf("%2d- %-18s %5d %6d\n", codecCntr, codecInst.plname, codecInst.plfreq, codecInst.rate); } diff --git a/webrtc/modules/utility/source/coder.cc b/webrtc/modules/utility/source/coder.cc index a610daa6b..f023d2264 100644 --- a/webrtc/modules/utility/source/coder.cc +++ b/webrtc/modules/utility/source/coder.cc @@ -76,14 +76,13 @@ WebRtc_Word32 AudioCoder::Decode(AudioFrame& decodedAudio, return -1; } } - return _acm->PlayoutData10Ms((WebRtc_UWord16)sampFreqHz, - (AudioFrame&)decodedAudio); + return _acm->PlayoutData10Ms((WebRtc_UWord16)sampFreqHz, &decodedAudio); } WebRtc_Word32 AudioCoder::PlayoutData(AudioFrame& decodedAudio, WebRtc_UWord16& sampFreqHz) { - return _acm->PlayoutData10Ms(sampFreqHz, (AudioFrame&)decodedAudio); + return _acm->PlayoutData10Ms(sampFreqHz, &decodedAudio); } WebRtc_Word32 AudioCoder::Encode(const AudioFrame& audio, diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 88256dee7..cc1e063c9 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -661,7 +661,7 @@ Channel::OnInitializeDecoder( receiveCodec.rate = rate; 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; // 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) if (_audioCodingModule.PlayoutData10Ms(audioFrame.sample_rate_hz_, - audioFrame) == -1) + &audioFrame) == -1) { WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,_channelId), @@ -1413,7 +1413,7 @@ Channel::Init() for (int idx = 0; idx < nSupportedCodecs; idx++) { // 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)) { WEBRTC_TRACE(kTraceWarning, kTraceVoice, @@ -2254,7 +2254,7 @@ WebRtc_Word32 Channel::GetNetEQBGNMode(NetEqBgnModes& mode) { ACMBackgroundNoiseMode noiseMode(On); - _audioCodingModule.BackgroundNoiseMode(noiseMode); + _audioCodingModule.BackgroundNoiseMode(&noiseMode); switch (noiseMode) { case On: @@ -2275,13 +2275,13 @@ Channel::GetNetEQBGNMode(NetEqBgnModes& mode) WebRtc_Word32 Channel::GetSendCodec(CodecInst& codec) { - return (_audioCodingModule.SendCodec(codec)); + return (_audioCodingModule.SendCodec(&codec)); } WebRtc_Word32 Channel::GetRecCodec(CodecInst& codec) { - return (_audioCodingModule.ReceiveCodec(codec)); + return (_audioCodingModule.ReceiveCodec(&codec)); } WebRtc_Word32 @@ -2342,7 +2342,7 @@ Channel::GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX) { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::GetVADStatus"); - if (_audioCodingModule.VAD(disabledDTX, enabledVAD, mode) != 0) + if (_audioCodingModule.VAD(&disabledDTX, &enabledVAD, &mode) != 0) { _engineStatisticsPtr->SetLastError( VE_AUDIO_CODING_MODULE_ERROR, kTraceError, @@ -2504,7 +2504,7 @@ Channel::SetSendCNPayloadType(int type, PayloadFrequencies frequency) else if (frequency == kFreq16000Hz) samplingFreqHz = 16000; - if (_audioCodingModule.Codec("CN", codec, samplingFreqHz, kMono) == -1) + if (_audioCodingModule.Codec("CN", &codec, samplingFreqHz, kMono) == -1) { _engineStatisticsPtr->SetLastError( VE_AUDIO_CODING_MODULE_ERROR, kTraceError, @@ -2546,7 +2546,7 @@ Channel::SetISACInitTargetRate(int rateBps, bool useFixedFrameSize) "Channel::SetISACInitTargetRate()"); CodecInst sendCodec; - if (_audioCodingModule.SendCodec(sendCodec) == -1) + if (_audioCodingModule.SendCodec(&sendCodec) == -1) { _engineStatisticsPtr->SetLastError( VE_CODEC_ERROR, kTraceError, @@ -2614,7 +2614,7 @@ Channel::SetISACMaxRate(int rateBps) "Channel::SetISACMaxRate()"); CodecInst sendCodec; - if (_audioCodingModule.SendCodec(sendCodec) == -1) + if (_audioCodingModule.SendCodec(&sendCodec) == -1) { _engineStatisticsPtr->SetLastError( VE_CODEC_ERROR, kTraceError, @@ -2678,7 +2678,7 @@ Channel::SetISACMaxPayloadSize(int sizeBytes) WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::SetISACMaxPayloadSize()"); CodecInst sendCodec; - if (_audioCodingModule.SendCodec(sendCodec) == -1) + if (_audioCodingModule.SendCodec(&sendCodec) == -1) { _engineStatisticsPtr->SetLastError( VE_CODEC_ERROR, kTraceError, @@ -6082,8 +6082,12 @@ Channel::GetNetworkStatistics(NetworkStatistics& stats) { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::GetNetworkStatistics()"); - return _audioCodingModule.NetworkStatistics( - (ACMNetworkStatistics &)stats); + ACMNetworkStatistics acm_stats; + int return_value = _audioCodingModule.NetworkStatistics(&acm_stats); + if (return_value >= 0) { + memcpy(&stats, &acm_stats, sizeof(NetworkStatistics)); + } + return return_value; } int @@ -6416,7 +6420,7 @@ Channel::GetPlayoutTimeStamp(WebRtc_UWord32& playoutTimestamp) WebRtc_UWord32 timestamp(0); CodecInst currRecCodec; - if (_audioCodingModule.PlayoutTimestamp(timestamp) == -1) + if (_audioCodingModule.PlayoutTimestamp(×tamp) == -1) { WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::GetPlayoutTimeStamp() failed to read playout" @@ -6434,7 +6438,7 @@ Channel::GetPlayoutTimeStamp(WebRtc_UWord32& playoutTimestamp) } WebRtc_Word32 playoutFrequency = _audioCodingModule.PlayoutFrequency(); - if (_audioCodingModule.ReceiveCodec(currRecCodec) == 0) { + if (_audioCodingModule.ReceiveCodec(&currRecCodec) == 0) { if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) { playoutFrequency = 8000; } else if (STR_CASE_CMP("opus", currRecCodec.plname) == 0) { @@ -6513,7 +6517,7 @@ Channel::UpdatePacketDelay(const WebRtc_UWord32 timestamp, rtpReceiveFrequency = _audioCodingModule.ReceiveFrequency(); CodecInst currRecCodec; - if (_audioCodingModule.ReceiveCodec(currRecCodec) == 0) { + if (_audioCodingModule.ReceiveCodec(&currRecCodec) == 0) { if (STR_CASE_CMP("G722", currRecCodec.plname) == 0) { // Even though the actual sampling rate for G.722 audio 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++) { // 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)) { WEBRTC_TRACE( @@ -6710,7 +6714,7 @@ int Channel::SetRedPayloadType(int red_payload_type) { // Get default RED settings from the ACM database const int num_codecs = AudioCodingModule::NumberOfCodecs(); for (int idx = 0; idx < num_codecs; idx++) { - _audioCodingModule.Codec(idx, codec); + _audioCodingModule.Codec(idx, &codec); if (!STR_CASE_CMP(codec.plname, "RED")) { found_red = true; break; diff --git a/webrtc/voice_engine/voe_codec_impl.cc b/webrtc/voice_engine/voe_codec_impl.cc index 4768004a2..6efa89989 100644 --- a/webrtc/voice_engine/voe_codec_impl.cc +++ b/webrtc/voice_engine/voe_codec_impl.cc @@ -68,7 +68,7 @@ int VoECodecImpl::GetCodec(int index, CodecInst& codec) WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "GetCodec(index=%d, codec=?)", index); CodecInst acmCodec; - if (AudioCodingModule::Codec(index, (CodecInst&) acmCodec) + if (AudioCodingModule::Codec(index, &acmCodec) == -1) { _shared->SetLastError(VE_INVALID_LISTNR, kTraceError,