Commit be6905d9 authored by Tristan Matthews's avatar Tristan Matthews

* #7131: cleanup, remove underscore prefix vars

parent d2f15f8d
......@@ -42,17 +42,17 @@
namespace sfl {
AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : _rtpSession(NULL), remoteContext(NULL), localContext(NULL), ca_(ca)
AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL), remoteContext_(NULL), localContext_(NULL), ca_(ca)
{}
AudioRtpFactory::~AudioRtpFactory()
{
delete _rtpSession;
delete rtpSession_;
}
void AudioRtpFactory::initAudioRtpConfig()
{
if (_rtpSession != NULL)
if (rtpSession_ != NULL)
stop();
std::string accountId(Manager::instance().getAccountFromCall(ca_->getCallId()));
......@@ -60,150 +60,136 @@ void AudioRtpFactory::initAudioRtpConfig()
SIPAccount *account = dynamic_cast<SIPAccount *>(Manager::instance().getAccount(accountId));
if (account) {
_srtpEnabled = account->getSrtpEnabled();
srtpEnabled_ = account->getSrtpEnabled();
std::string key(account->getSrtpKeyExchange());
if (key == "sdes")
_keyExchangeProtocol = Sdes;
keyExchangeProtocol_ = Sdes;
else if (key == "zrtp")
_keyExchangeProtocol = Zrtp;
keyExchangeProtocol_ = Zrtp;
else
_keyExchangeProtocol = Symmetric;
keyExchangeProtocol_ = Symmetric;
_helloHashEnabled = account->getZrtpHelloHash();
helloHashEnabled_ = account->getZrtpHelloHash();
} else {
_srtpEnabled = false;
_keyExchangeProtocol = Symmetric;
_helloHashEnabled = false;
srtpEnabled_ = false;
keyExchangeProtocol_ = Symmetric;
helloHashEnabled_ = false;
}
}
void AudioRtpFactory::initAudioSymmetricRtpSession()
{
ost::MutexLock m(_audioRtpThreadMutex);
ost::MutexLock m(audioRtpThreadMutex_);
if (_srtpEnabled) {
if (srtpEnabled_) {
std::string zidFilename(Manager::instance().voipPreferences.getZidFile());
switch (_keyExchangeProtocol) {
switch (keyExchangeProtocol_) {
case Zrtp:
_rtpSession = new AudioZrtpSession(ca_, zidFilename);
if (_helloHashEnabled) {
// TODO: be careful with that. The hello hash is computed asynchronously. Maybe it's
// not even available at that point.
ca_->getLocalSDP()->setZrtpHash(static_cast<AudioZrtpSession *>(_rtpSession)->getHelloHash());
}
rtpSession_ = new AudioZrtpSession(ca_, zidFilename);
// TODO: be careful with that. The hello hash is computed asynchronously. Maybe it's
// not even available at that point.
if (helloHashEnabled_)
ca_->getLocalSDP()->setZrtpHash(static_cast<AudioZrtpSession *>(rtpSession_)->getHelloHash());
break;
case Sdes:
_rtpSession = new AudioSrtpSession(ca_);
rtpSession_ = new AudioSrtpSession(ca_);
break;
default:
throw UnsupportedRtpSessionType("Unsupported Rtp Session Exception Type!");
}
} else {
_rtpSession = new AudioSymmetricRtpSession(ca_);
}
} else
rtpSession_ = new AudioSymmetricRtpSession(ca_);
}
void AudioRtpFactory::start(AudioCodec* audiocodec)
{
if (_rtpSession == NULL) {
if (rtpSession_ == NULL)
throw AudioRtpFactoryException("AudioRtpFactory: Error: RTP session was null when trying to start audio thread");
}
if (_rtpSession->getAudioRtpType() == Sdes) {
if (localContext && remoteContext) {
static_cast<AudioSrtpSession *>(_rtpSession)->restoreCryptoContext(localContext, remoteContext);
}
}
if (rtpSession_->getAudioRtpType() == Sdes)
if (localContext_ and remoteContext_)
static_cast<AudioSrtpSession *>(rtpSession_)->restoreCryptoContext(localContext_, remoteContext_);
if (_rtpSession->startRtpThread(audiocodec) != 0) {
if (rtpSession_->startRtpThread(audiocodec) != 0)
throw AudioRtpFactoryException("AudioRtpFactory: Error: Failed to start AudioZrtpSession thread");
}
}
void AudioRtpFactory::stop(void)
void AudioRtpFactory::stop()
{
ost::MutexLock mutex(_audioRtpThreadMutex);
ost::MutexLock mutex(audioRtpThreadMutex_);
if (_rtpSession == NULL)
if (rtpSession_ == NULL)
return;
if (_rtpSession->getAudioRtpType() == Sdes) {
localContext = static_cast<AudioSrtpSession *>(_rtpSession)->_localCryptoCtx;
remoteContext = static_cast<AudioSrtpSession *>(_rtpSession)->_remoteCryptoCtx;
if (rtpSession_->getAudioRtpType() == Sdes) {
localContext_ = static_cast<AudioSrtpSession*>(rtpSession_)->localCryptoCtx_;
remoteContext_ = static_cast<AudioSrtpSession*>(rtpSession_)->remoteCryptoCtx_;
}
delete _rtpSession;
_rtpSession = NULL;
delete rtpSession_;
rtpSession_ = NULL;
}
int AudioRtpFactory::getSessionMedia()
{
if (_rtpSession == NULL) {
if (rtpSession_ == NULL)
throw AudioRtpFactoryException("AudioRtpFactory: Error: RTP session was null when trying to get session media type");
}
return _rtpSession->getCodecPayloadType();
return rtpSession_->getCodecPayloadType();
}
void AudioRtpFactory::updateSessionMedia(AudioCodec *audiocodec)
{
if (_rtpSession == NULL) {
throw AudioRtpFactoryException("AudioRtpFactory: Error: _rtpSession was null when trying to update IP address");
}
if (rtpSession_ == NULL)
throw AudioRtpFactoryException("AudioRtpFactory: Error: rtpSession_ was null when trying to update IP address");
_rtpSession->updateSessionMedia(audiocodec);
rtpSession_->updateSessionMedia(audiocodec);
}
void AudioRtpFactory::updateDestinationIpAddress(void)
void AudioRtpFactory::updateDestinationIpAddress()
{
if (_rtpSession)
_rtpSession->updateDestinationIpAddress();
if (rtpSession_)
rtpSession_->updateDestinationIpAddress();
}
sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
{
if (_rtpSession->getAudioRtpType() == Zrtp) {
return static_cast<AudioZrtpSession *>(_rtpSession);
} else {
throw AudioRtpFactoryException("RTP: Error: _rtpSession is NULL in getAudioZrtpSession");
}
if (rtpSession_->getAudioRtpType() == Zrtp)
return static_cast<AudioZrtpSession *>(rtpSession_);
else
throw AudioRtpFactoryException("RTP: Error: rtpSession_ is NULL in getAudioZrtpSession");
}
void sfl::AudioRtpFactory::initLocalCryptoInfo()
{
if (_rtpSession && _rtpSession->getAudioRtpType() == Sdes) {
static_cast<AudioSrtpSession *>(_rtpSession)->initLocalCryptoInfo();
ca_->getLocalSDP()->setLocalSdpCrypto(static_cast<AudioSrtpSession *>(_rtpSession)->getLocalCryptoInfo());
if (rtpSession_ && rtpSession_->getAudioRtpType() == Sdes) {
static_cast<AudioSrtpSession *>(rtpSession_)->initLocalCryptoInfo();
ca_->getLocalSDP()->setLocalSdpCrypto(static_cast<AudioSrtpSession *>(rtpSession_)->getLocalCryptoInfo());
}
}
void AudioRtpFactory::setRemoteCryptoInfo(sfl::SdesNegotiator& nego)
{
if (_rtpSession && _rtpSession->getAudioRtpType() == Sdes) {
static_cast<AudioSrtpSession *>(_rtpSession)->setRemoteCryptoInfo(nego);
} else {
throw AudioRtpFactoryException("RTP: Error: _rtpSession is NULL in setRemoteCryptoInfo");
}
if (rtpSession_ && rtpSession_->getAudioRtpType() == Sdes)
static_cast<AudioSrtpSession *>(rtpSession_)->setRemoteCryptoInfo(nego);
else
throw AudioRtpFactoryException("RTP: Error: rtpSession_ is NULL in setRemoteCryptoInfo");
}
void AudioRtpFactory::setDtmfPayloadType(unsigned int payloadType)
{
if (_rtpSession)
_rtpSession->setDtmfPayloadType(payloadType);
if (rtpSession_)
rtpSession_->setDtmfPayloadType(payloadType);
}
void AudioRtpFactory::sendDtmfDigit(int digit)
{
_rtpSession->putDtmfEvent(digit);
rtpSession_->putDtmfEvent(digit);
}
}
......@@ -99,17 +99,17 @@ class AudioRtpFactory {
* Update current RTP destination address with one stored in call
* @param None
*/
void updateDestinationIpAddress(void);
void updateDestinationIpAddress();
bool isSdesEnabled(void) const {
return _srtpEnabled && _keyExchangeProtocol == sfl::Sdes;
bool isSdesEnabled() const {
return srtpEnabled_ and keyExchangeProtocol_ == sfl::Sdes;
}
/**
* Manually set the srtpEnable option (usefull for RTP fallback)
*/
void setSrtpEnabled(bool enable) {
_srtpEnabled = enable;
srtpEnabled_ = enable;
}
/**
......@@ -138,26 +138,26 @@ class AudioRtpFactory {
void sendDtmfDigit(int digit);
private:
AudioRtpSession *_rtpSession;
ost::Mutex _audioRtpThreadMutex;
AudioRtpSession *rtpSession_;
ost::Mutex audioRtpThreadMutex_;
// Field used when initializinga udio rtp session
// May be set manually or from config using initAudioRtpConfig
bool _srtpEnabled;
bool srtpEnabled_;
// Field used when initializinga udio rtp session
// May be set manually or from config using initAudioRtpConfig
RtpMethod _keyExchangeProtocol;
RtpMethod keyExchangeProtocol_;
// Field used when initializinga udio rtp session
// May be set manually or from config using initAudioRtpConfig
bool _helloHashEnabled;
bool helloHashEnabled_;
/** Remote srtp crypto context to be set into incoming data queue. */
ost::CryptoContext *remoteContext;
ost::CryptoContext *remoteContext_;
/** Local srtp crypto context to be set into outgoing data queue. */
ost::CryptoContext *localContext;
ost::CryptoContext *localContext_;
SIPCall *ca_;
};
......
......@@ -38,76 +38,66 @@ namespace sfl {
static const SFLDataFormat initFadeinFactor = 32000;
AudioRtpRecord::AudioRtpRecord() : _audioCodec(NULL)
, _hasDynamicPayloadType(false)
, _converter(NULL)
, _codecSampleRate(0)
, _codecFrameSize(0)
, _micAmplFactor(initFadeinFactor)
, _noiseSuppress(NULL)
, _callId("")
, _dtmfPayloadType(101) // same as Asterisk
{
}
AudioRtpRecord::AudioRtpRecord() : audioCodec_(NULL)
, hasDynamicPayloadType_(false)
, converter_(NULL)
, codecSampleRate_(0)
, codecFrameSize_(0)
, micAmplFactor_(initFadeinFactor)
, noiseSuppress_(NULL)
, callId_("")
, dtmfPayloadType_(101) // same as Asterisk
{}
AudioRtpRecord::~AudioRtpRecord()
{
delete _converter;
delete _audioCodec;
delete _noiseSuppress;
delete converter_;
delete audioCodec_;
delete noiseSuppress_;
}
AudioRtpRecordHandler::AudioRtpRecordHandler(SIPCall *ca) : _audioRtpRecord(), id_(ca->getCallId()), echoCanceller(ca->getMemoryPool()), gainController(8000, -10.0)
{
}
AudioRtpRecordHandler::AudioRtpRecordHandler(SIPCall *ca) : audioRtpRecord_(), id_(ca->getCallId()), echoCanceller(ca->getMemoryPool()), gainController(8000, -10.0)
{}
AudioRtpRecordHandler::~AudioRtpRecordHandler() {}
void AudioRtpRecordHandler::setRtpMedia(AudioCodec* audioCodec)
{
_audioRtpRecord.audioCodecMutex.enter();
ost::MutexLock lock(audioRtpRecord_.audioCodecMutex_);
delete _audioRtpRecord._audioCodec;
delete audioRtpRecord_.audioCodec_;
// Set varios codec info to reduce indirection
_audioRtpRecord._audioCodec = audioCodec;
_audioRtpRecord._codecPayloadType = audioCodec->getPayloadType();
_audioRtpRecord._codecSampleRate = audioCodec->getClockRate();
_audioRtpRecord._codecFrameSize = audioCodec->getFrameSize();
_audioRtpRecord._hasDynamicPayloadType = audioCodec->hasDynamicPayload();
_audioRtpRecord.audioCodecMutex.leave();
audioRtpRecord_.audioCodec_ = audioCodec;
audioRtpRecord_.codecPayloadType_ = audioCodec->getPayloadType();
audioRtpRecord_.codecSampleRate_ = audioCodec->getClockRate();
audioRtpRecord_.codecFrameSize_ = audioCodec->getFrameSize();
audioRtpRecord_.hasDynamicPayloadType_ = audioCodec->hasDynamicPayload();
}
void AudioRtpRecordHandler::initBuffers()
{
// Set sampling rate, main buffer choose the highest one
Manager::instance().audioSamplingRateChanged(_audioRtpRecord._codecSampleRate);
Manager::instance().audioSamplingRateChanged(audioRtpRecord_.codecSampleRate_);
// initialize SampleRate converter using AudioLayer's sampling rate
// (internal buffers initialized with maximal sampling rate and frame size)
delete _audioRtpRecord._converter;
_audioRtpRecord._converter = new SamplerateConverter(getCodecSampleRate());
delete audioRtpRecord_.converter_;
audioRtpRecord_.converter_ = new SamplerateConverter(getCodecSampleRate());
}
void AudioRtpRecordHandler::initNoiseSuppress()
{
_audioRtpRecord.audioProcessMutex.enter();
delete _audioRtpRecord._noiseSuppress;
_audioRtpRecord._noiseSuppress = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate());
_audioRtpRecord.audioProcessMutex.leave();
ost::MutexLock lock(audioRtpRecord_.audioProcessMutex_);
delete audioRtpRecord_.noiseSuppress_;
audioRtpRecord_.noiseSuppress_ = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate());
}
void AudioRtpRecordHandler::putDtmfEvent(int digit)
{
_audioRtpRecord._dtmfQueue.push_back(digit);
audioRtpRecord_.dtmfQueue_.push_back(digit);
}
#ifdef DUMP_PROCESS_DATA_ENCODE
......@@ -116,9 +106,9 @@ std::ofstream teststream("test_process_data_encode.raw");
int AudioRtpRecordHandler::processDataEncode(void)
{
SFLDataFormat *micData = _audioRtpRecord.decData;
unsigned char *micDataEncoded = _audioRtpRecord.encodedData;
SFLDataFormat *micDataConverted = _audioRtpRecord.resampledData;
SFLDataFormat *micData = audioRtpRecord_.decData_;
unsigned char *micDataEncoded = audioRtpRecord_.encodedData_;
SFLDataFormat *micDataConverted = audioRtpRecord_.resampledData_;
int codecSampleRate = getCodecSampleRate();
int mainBufferSampleRate = Manager::instance().getMainBuffer()->getInternalSamplingRate();
......@@ -129,9 +119,8 @@ int AudioRtpRecordHandler::processDataEncode(void)
int samplesToGet = resampleFactor * getCodecFrameSize();
int bytesToGet = samplesToGet * sizeof(SFLDataFormat);
if (Manager::instance().getMainBuffer()->availForGet(id_) < bytesToGet) {
if (Manager::instance().getMainBuffer()->availForGet(id_) < bytesToGet)
return 0;
}
int bytes = Manager::instance().getMainBuffer()->getData(micData, bytesToGet, id_);
......@@ -142,7 +131,7 @@ int AudioRtpRecordHandler::processDataEncode(void)
int samples = bytesToGet / sizeof(SFLDataFormat);
fadeIn(micData, samples, &_audioRtpRecord._micAmplFactor);
fadeIn(micData, samples, &audioRtpRecord_.micAmplFactor_);
if (Manager::instance().getEchoCancelState())
echoCanceller.getData(micData);
......@@ -155,18 +144,19 @@ int AudioRtpRecordHandler::processDataEncode(void)
if (codecSampleRate != mainBufferSampleRate) {
out = micDataConverted;
_audioRtpRecord._converter->resample(micData, micDataConverted, codecSampleRate, mainBufferSampleRate, samplesToGet);
audioRtpRecord_.converter_->resample(micData, micDataConverted, codecSampleRate, mainBufferSampleRate, samplesToGet);
}
if (Manager::instance().audioPreference.getNoiseReduce()) {
_audioRtpRecord.audioProcessMutex.enter();
_audioRtpRecord._noiseSuppress->process(micData, getCodecFrameSize());
_audioRtpRecord.audioProcessMutex.leave();
ost::MutexLock lock(audioRtpRecord_.audioProcessMutex_);
audioRtpRecord_.noiseSuppress_->process(micData, getCodecFrameSize());
}
_audioRtpRecord.audioCodecMutex.enter();
int compSize = _audioRtpRecord._audioCodec->encode(micDataEncoded, out, getCodecFrameSize());
_audioRtpRecord.audioCodecMutex.leave();
int compSize;
{
ost::MutexLock lock(audioRtpRecord_.audioCodecMutex_);
compSize = audioRtpRecord_.audioCodec_->encode(micDataEncoded, out, getCodecFrameSize());
}
return compSize;
}
......@@ -178,19 +168,19 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, unsigned
int codecSampleRate = getCodecSampleRate();
SFLDataFormat *spkrDataDecoded = _audioRtpRecord.decData;
SFLDataFormat *spkrDataConverted = _audioRtpRecord.resampledData;
SFLDataFormat *spkrDataDecoded = audioRtpRecord_.decData_;
SFLDataFormat *spkrDataConverted = audioRtpRecord_.resampledData_;
int mainBufferSampleRate = Manager::instance().getMainBuffer()->getInternalSamplingRate();
_audioRtpRecord.audioCodecMutex.enter();
// Return the size of data in samples
int inSamples = _audioRtpRecord._audioCodec->decode(spkrDataDecoded , spkrData , size);
_audioRtpRecord.audioCodecMutex.leave();
int inSamples;
{
ost::MutexLock lock(audioRtpRecord_.audioCodecMutex_);
// Return the size of data in samples
inSamples = audioRtpRecord_.audioCodec_->decode(spkrDataDecoded , spkrData , size);
}
fadeIn(spkrDataDecoded, inSamples, &_audioRtpRecord._micAmplFactor);
fadeIn(spkrDataDecoded, inSamples, &audioRtpRecord_.micAmplFactor_);
// Normalize incomming signal
gainController.process(spkrDataDecoded, inSamples);
......@@ -202,7 +192,7 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, unsigned
if (codecSampleRate != mainBufferSampleRate) {
// Do sample rate conversion
outSamples = ((float) inSamples * ((float) mainBufferSampleRate / (float) codecSampleRate));
_audioRtpRecord._converter->resample(spkrDataDecoded, spkrDataConverted, codecSampleRate, mainBufferSampleRate, inSamples);
audioRtpRecord_.converter_->resample(spkrDataDecoded, spkrDataConverted, codecSampleRate, mainBufferSampleRate, inSamples);
out = spkrDataConverted;
}
......@@ -223,5 +213,4 @@ void AudioRtpRecordHandler::fadeIn(SFLDataFormat *audio, int size, SFLDataFormat
*factor /= FADEIN_STEP_SIZE;
}
}
......@@ -78,24 +78,23 @@ class AudioRtpRecord {
AudioRtpRecord();
~AudioRtpRecord();
AudioCodec *_audioCodec;
ost::Mutex audioCodecMutex;
int _codecPayloadType;
bool _hasDynamicPayloadType;
SFLDataFormat decData[DEC_BUFFER_SIZE];
SFLDataFormat resampledData[DEC_BUFFER_SIZE];
unsigned char encodedData[DEC_BUFFER_SIZE];
SamplerateConverter *_converter;
int _codecSampleRate;
int _codecFrameSize;
int _converterSamplingRate;
std::list<int> _dtmfQueue;
SFLDataFormat _micAmplFactor;
NoiseSuppress *_noiseSuppress;
ost::Mutex audioProcessMutex;
std::string _callId;
unsigned int _dtmfPayloadType;
AudioCodec *audioCodec_;
ost::Mutex audioCodecMutex_;
int codecPayloadType_;
bool hasDynamicPayloadType_;
SFLDataFormat decData_[DEC_BUFFER_SIZE];
SFLDataFormat resampledData_[DEC_BUFFER_SIZE];
unsigned char encodedData_[DEC_BUFFER_SIZE];
SamplerateConverter *converter_;
int codecSampleRate_;
int codecFrameSize_;
int converterSamplingRate_;
std::list<int> dtmfQueue_;
SFLDataFormat micAmplFactor_;
NoiseSuppress *noiseSuppress_;
ost::Mutex audioProcessMutex_;
std::string callId_;
unsigned int dtmfPayloadType_;
};
......@@ -107,45 +106,44 @@ class AudioRtpRecordHandler {
/**
* Set rtp media for this session
*/
void setRtpMedia(AudioCodec* audioCodec);
AudioCodec *getAudioCodec(void) const {
return _audioRtpRecord._audioCodec;
AudioCodec *getAudioCodec() const {
return audioRtpRecord_.audioCodec_;
}
int getCodecPayloadType(void) const {
return _audioRtpRecord._codecPayloadType;
int getCodecPayloadType() const {
return audioRtpRecord_.codecPayloadType_;
}
int getCodecSampleRate(void) const {
return _audioRtpRecord._codecSampleRate;
int getCodecSampleRate() const {
return audioRtpRecord_.codecSampleRate_;
}
int getCodecFrameSize(void) const {
return _audioRtpRecord._codecFrameSize;
int getCodecFrameSize() const {
return audioRtpRecord_.codecFrameSize_;
}
bool getHasDynamicPayload(void) const {
return _audioRtpRecord._hasDynamicPayloadType;
bool getHasDynamicPayload() const {
return audioRtpRecord_.hasDynamicPayloadType_;
}
int DtmfPending(void) const {
return _audioRtpRecord._dtmfQueue.size() > 0;
int DtmfPending() const {
return audioRtpRecord_.dtmfQueue_.size() > 0;
}
const unsigned char *getMicDataEncoded(void) const {
return _audioRtpRecord.encodedData;
const unsigned char *getMicDataEncoded() const {
return audioRtpRecord_.encodedData_;
}
void initBuffers(void);
void initBuffers();
void initNoiseSuppress(void);
void initNoiseSuppress();
/**
* Encode audio data from mainbuffer
*/
int processDataEncode(void);
int processDataEncode();
/**
* Decode audio data received from peer
......@@ -158,18 +156,18 @@ class AudioRtpRecordHandler {
void fadeIn(SFLDataFormat *audio, int size, SFLDataFormat *factor);
void setDtmfPayloadType(unsigned int payloadType) {
_audioRtpRecord._dtmfPayloadType = payloadType;
audioRtpRecord_.dtmfPayloadType_ = payloadType;
}
unsigned int getDtmfPayloadType(void) const {
return _audioRtpRecord._dtmfPayloadType;
unsigned int getDtmfPayloadType() const {
return audioRtpRecord_.dtmfPayloadType_;
}
void putDtmfEvent(int digit);
protected:
AudioRtpRecord _audioRtpRecord;
AudioRtpRecord audioRtpRecord_;
private:
......
......@@ -36,6 +36,7 @@
#include "audio_symmetric_rtp_session.h"
#include "sip/sdp.h"
#include "sip/sipcall.h"
#include "audio/audiolayer.h"
#include <ccrtp/rtp.h>
#include <ccrtp/oqueue.h>
......@@ -44,33 +45,33 @@
namespace sfl {
AudioRtpSession::AudioRtpSession(SIPCall * sipcall, RtpMethod type, ost::RTPDataQueue *queue, ost::Thread *thread) :
AudioRtpRecordHandler(sipcall)
, _ca(sipcall)
, _type(type)
, _timestamp(0)
, _timestampIncrement(0)
, _timestampCount(0)
, _isStarted(false)
, _queue(queue)
, _thread(thread)
, ca_(sipcall)
, type_(type)
, timestamp_(0)
, timestampIncrement_(0)
, timestampCount_(0)
, isStarted_(false)
, queue_(queue)
, thread_(thread)
{
assert(_ca);
_queue->setTypeOfService(ost::RTPDataQueue::tosEnhanced);
assert(ca_);
queue_->setTypeOfService(ost::RTPDataQueue::tosEnhanced);
}
AudioRtpSession::~AudioRtpSession()
{
_queue->disableStack();
queue_->disableStack();
}
void AudioRtpSession::updateSessionMedia(AudioCodec *audioCodec)
{
int lastSamplingRate = _audioRtpRecord._codecSampleRate;
int lastSamplingRate = audioRtpRecord_.codecSampleRate_;
setSessionMedia(audioCodec);
Manager::instance().audioSamplingRateChanged(_audioRtpRecord._codecSampleRate);
Manager::instance().audioSamplingRateChanged(audioRtpRecord_.codecSampleRate_);
if (lastSamplingRate != _audioRtpRecord._codecSampleRate) {
if (lastSamplingRate != audioRtpRecord_.codecSampleRate_) {
_debug("AudioRtpSession: Update noise suppressor with sampling rate %d and frame size %d", getCodecSampleRate(), getCodecFrameSize());
initNoiseSuppress();
}
......@@ -89,65 +90,65 @@ void AudioRtpSession::setSessionMedia(AudioCodec *audioCodec)
// G722 requires timestamp to be incremented at 8kHz