diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index aabb9eae777326d0cdf587e6fffe63e76520dfdc..f797900a2b013775c7eccc4a47f1477ac7196790 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -47,6 +47,9 @@ IAXVoIPLink::IAXVoIPLink(const std::string& accountID) : , regSession_(NULL) , nextRefreshStamp_(0) , mutexIAX_() + , decData_() + , resampledData_() + , encodedData_() , converter_(44100) , initDone_(false) , accountID_(accountID) @@ -167,7 +170,7 @@ IAXVoIPLink::sendAudioFromMic() continue; // Get bytes from micRingBuffer to data_from_mic - int bytes = Manager::instance().getMainBuffer()->getData(decData, bytesNeeded, currentCall->getCallId()); + int bytes = Manager::instance().getMainBuffer()->getData(decData_, bytesNeeded, currentCall->getCallId()); int samples = bytes / sizeof(SFLDataFormat); int compSize; @@ -176,20 +179,20 @@ IAXVoIPLink::sendAudioFromMic() SFLDataFormat *in; if (audioRate != mainBufferSampleRate) { - converter_.resample(decData, resampledData, audioRate, mainBufferSampleRate, samples); - in = resampledData; + converter_.resample(decData_, resampledData_, audioRate, mainBufferSampleRate, samples); + in = resampledData_; outSamples = 0; } else { outSamples = samples; - in = decData; + in = decData_; } - compSize = audioCodec->encode(encodedData, in, DEC_BUFFER_SIZE); + compSize = audioCodec->encode(encodedData_, in, DEC_BUFFER_SIZE); if (currentCall->session and bytes > 0) { ost::MutexLock m(mutexIAX_); - if (iax_send_voice(currentCall->session, currentCall->format, encodedData, compSize, outSamples) == -1) + if (iax_send_voice(currentCall->session, currentCall->format, encodedData_, compSize, outSamples) == -1) ERROR("IAX: Error sending voice data."); } } @@ -562,15 +565,15 @@ void IAXVoIPLink::iaxHandleVoiceEvent(iax_event* event, IAXCall* call) if (size > max) size = max; - int samples = audioCodec->decode(decData, data , size); + int samples = audioCodec->decode(decData_, data , size); int outSize = samples * sizeof(SFLDataFormat); - SFLDataFormat *out = decData; + SFLDataFormat *out = decData_; unsigned int audioRate = audioCodec->getClockRate(); if (audioRate != mainBufferSampleRate) { outSize = (double)outSize * (mainBufferSampleRate / audioRate); - converter_.resample(decData, resampledData, mainBufferSampleRate, audioRate, samples); - out = resampledData; + converter_.resample(decData_, resampledData_, mainBufferSampleRate, audioRate, samples); + out = resampledData_; } Manager::instance().getMainBuffer()->putData(out, outSize, call->getCallId()); diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h index 9a421d1d2c14cb30b7f8a23e8683a8c34d659b96..07606c730045bb71724c4305b0507265fedbf811 100644 --- a/daemon/src/iax/iaxvoiplink.h +++ b/daemon/src/iax/iaxvoiplink.h @@ -250,9 +250,9 @@ class IAXVoIPLink : public VoIPLink { ost::Mutex mutexIAX_; /** encoder/decoder/resampler buffers */ - SFLDataFormat decData[DEC_BUFFER_SIZE]; - SFLDataFormat resampledData[DEC_BUFFER_SIZE]; - unsigned char encodedData[DEC_BUFFER_SIZE]; + SFLDataFormat decData_[DEC_BUFFER_SIZE]; + SFLDataFormat resampledData_[DEC_BUFFER_SIZE]; + unsigned char encodedData_[DEC_BUFFER_SIZE]; /** Sample rate converter object */ SamplerateConverter converter_;