Skip to content
Snippets Groups Projects
Commit 75c9eab2 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2929] Cleanup debug messages in Audio Rtp

parent 100cb622
No related branches found
No related tags found
No related merge requests found
...@@ -249,7 +249,7 @@ namespace sfl { ...@@ -249,7 +249,7 @@ namespace sfl {
template <typename D> template <typename D>
AudioRtpSession<D>::~AudioRtpSession() AudioRtpSession<D>::~AudioRtpSession()
{ {
_debug ("Rtp: Delete AudioRtpSession instance"); _debug ("RTP: Delete AudioRtpSession instance");
try { try {
terminate(); terminate();
...@@ -273,11 +273,9 @@ namespace sfl { ...@@ -273,11 +273,9 @@ namespace sfl {
void AudioRtpSession<D>::initBuffers() void AudioRtpSession<D>::initBuffers()
{ {
// Set sampling rate, main buffer choose the highest one // Set sampling rate, main buffer choose the highest one
// _audiolayer->getMainBuffer()->setInternalSamplingRate(_codecSampleRate);
_manager->getAudioDriver()->getMainBuffer()->setInternalSamplingRate(_codecSampleRate); _manager->getAudioDriver()->getMainBuffer()->setInternalSamplingRate(_codecSampleRate);
// may be different than one already setted // may be different than one already setted
// converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
_converterSamplingRate = _manager->getAudioDriver()->getMainBuffer()->getInternalSamplingRate(); _converterSamplingRate = _manager->getAudioDriver()->getMainBuffer()->getInternalSamplingRate();
// initialize SampleRate converter using AudioLayer's sampling rate // initialize SampleRate converter using AudioLayer's sampling rate
...@@ -311,28 +309,33 @@ namespace sfl { ...@@ -311,28 +309,33 @@ namespace sfl {
{ {
assert(_ca); assert(_ca);
_debug("RTP: Get audio codec for call %s", _ca->getCallId().c_str());
AudioCodecType pl = (AudioCodecType)_ca->getLocalSDP()->get_session_media()->getPayload(); AudioCodecType pl = (AudioCodecType)_ca->getLocalSDP()->get_session_media()->getPayload();
_audiocodec = _manager->getCodecDescriptorMap().instantiateCodec(pl); _audiocodec = _manager->getCodecDescriptorMap().instantiateCodec(pl);
if (_audiocodec == NULL) { if (!_audiocodec) {
_debug ("No audiocodec, can't init RTP media"); _error ("RTP: Error: No audiocodec, can't init RTP media");
throw AudioRtpSessionException(); throw AudioRtpSessionException();
} }
_debug ("Init audio RTP session: codec payload %i", _audiocodec->getPayload()); _debug ("RTP: Init codec payload %i", _audiocodec->getPayload());
_codecSampleRate = _audiocodec->getClockRate(); _codecSampleRate = _audiocodec->getClockRate();
_codecFrameSize = _audiocodec->getFrameSize(); _codecFrameSize = _audiocodec->getFrameSize();
_debug("RTP: Codec sampling rate: %d", _codecSampleRate);
_debug("RTP: Codec frame size: %d", _codecFrameSize);
//TODO: figure out why this is necessary. //TODO: figure out why this is necessary.
if (_audiocodec->getPayload() == 9) { if (_audiocodec->getPayload() == 9) {
_debug ("Setting payload format to G722"); _debug ("RTP: Setting payload format to G722");
static_cast<D*>(this)->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate())); static_cast<D*>(this)->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate()));
} else if (_audiocodec->hasDynamicPayload()) { } else if (_audiocodec->hasDynamicPayload()) {
_debug ("Setting a dynamic payload format"); _debug ("RTP: Setting a dynamic payload format");
static_cast<D*>(this)->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate())); static_cast<D*>(this)->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate()));
} else if (!_audiocodec->hasDynamicPayload() && _audiocodec->getPayload() != 9) { } else if (!_audiocodec->hasDynamicPayload() && _audiocodec->getPayload() != 9) {
_debug ("Setting a static payload format"); _debug ("RTP: Setting a static payload format");
static_cast<D*>(this)->setPayloadFormat (ost::StaticPayloadFormat ( (ost::StaticPayloadType) _audiocodec->getPayload())); static_cast<D*>(this)->setPayloadFormat (ost::StaticPayloadFormat ( (ost::StaticPayloadType) _audiocodec->getPayload()));
} }
} }
...@@ -341,7 +344,7 @@ namespace sfl { ...@@ -341,7 +344,7 @@ namespace sfl {
void AudioRtpSession<D>::setDestinationIpAddress(void) void AudioRtpSession<D>::setDestinationIpAddress(void)
{ {
if (_ca == NULL) { if (_ca == NULL) {
_warn ("Rtp: Sipcall is gone."); _error ("RTP: Sipcall is gone.");
throw AudioRtpSessionException(); throw AudioRtpSessionException();
} }
...@@ -351,7 +354,7 @@ namespace sfl { ...@@ -351,7 +354,7 @@ namespace sfl {
_remote_ip = ost::InetHostAddress(_ca->getLocalSDP()->get_remote_ip().c_str()); _remote_ip = ost::InetHostAddress(_ca->getLocalSDP()->get_remote_ip().c_str());
if (!_remote_ip) { if (!_remote_ip) {
_warn("Rtp: Target IP address (%s) is not correct!", _warn("RTP: Target IP address (%s) is not correct!",
_ca->getLocalSDP()->get_remote_ip().data()); _ca->getLocalSDP()->get_remote_ip().data());
return; return;
} }
...@@ -363,7 +366,7 @@ namespace sfl { ...@@ -363,7 +366,7 @@ namespace sfl {
_ca->getLocalSDP()->get_remote_ip().data(), _remote_port); _ca->getLocalSDP()->get_remote_ip().data(), _remote_port);
if (! static_cast<D*>(this)->addDestination (_remote_ip, _remote_port)) { if (! static_cast<D*>(this)->addDestination (_remote_ip, _remote_port)) {
_warn("Rtp: Can't add new destination to session!"); _warn("RTP: Can't add new destination to session!");
return; return;
} }
} }
...@@ -375,7 +378,7 @@ namespace sfl { ...@@ -375,7 +378,7 @@ namespace sfl {
// This method remove the current destination entry // This method remove the current destination entry
if(!static_cast<D*>(this)->forgetDestination(_remote_ip, _remote_port, _remote_port+1)) if(!static_cast<D*>(this)->forgetDestination(_remote_ip, _remote_port, _remote_port+1))
_warn("Rtp: Could not remove previous destination"); _warn("RTP: Could not remove previous destination");
// new destination is stored in call // new destination is stored in call
// we just need to recall this method // we just need to recall this method
...@@ -619,7 +622,7 @@ namespace sfl { ...@@ -619,7 +622,7 @@ namespace sfl {
template <typename D> template <typename D>
int AudioRtpSession<D>::startRtpThread () int AudioRtpSession<D>::startRtpThread ()
{ {
_debug("Starting main thread"); _debug("RTP: Starting main thread");
return start(_mainloopSemaphore); return start(_mainloopSemaphore);
} }
...@@ -638,16 +641,17 @@ namespace sfl { ...@@ -638,16 +641,17 @@ namespace sfl {
int sessionWaiting; int sessionWaiting;
int threadSleep = 0; int threadSleep = 0;
if (_codecSampleRate != 0) if (_codecSampleRate != 0){
{ threadSleep = (_codecFrameSize * 1000) / _codecSampleRate; } threadSleep = (_codecFrameSize * 1000) / _codecSampleRate;
else }
{ threadSleep = _layerFrameSize; } else {
threadSleep = _layerFrameSize;
}
TimerPort::setTimer (threadSleep); TimerPort::setTimer (threadSleep);
if (_audiolayer == NULL) { if (_audiolayer == NULL) {
_debug("For some unknown reason, audiolayer is null, just as \ _error("RTP: Error: Audiolayer is null, cannot start the audio stream");
we were about to start the audio stream");
throw AudioRtpSessionException(); throw AudioRtpSessionException();
} }
...@@ -658,7 +662,7 @@ namespace sfl { ...@@ -658,7 +662,7 @@ namespace sfl {
static_cast<D*>(this)->startRunning(); static_cast<D*>(this)->startRunning();
_debug ("Entering RTP mainloop for callid %s",_ca->getCallId().c_str()); _debug ("RTP: Entering mainloop for call %s",_ca->getCallId().c_str());
while (!testCancel()) { while (!testCancel()) {
...@@ -667,11 +671,12 @@ namespace sfl { ...@@ -667,11 +671,12 @@ namespace sfl {
_manager->getAudioLayerMutex()->enter(); _manager->getAudioLayerMutex()->enter();
// converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate(); // converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
_manager->getAudioDriver()->getMainBuffer()->getInternalSamplingRate(); _converterSamplingRate = _manager->getAudioDriver()->getMainBuffer()->getInternalSamplingRate();
// Send session
sessionWaiting = static_cast<D*>(this)->isWaiting(); sessionWaiting = static_cast<D*>(this)->isWaiting();
// Send session
if(_eventQueue.size() > 0) { if(_eventQueue.size() > 0) {
sendDtmfEvent(_eventQueue.front()); sendDtmfEvent(_eventQueue.front());
} }
...@@ -698,7 +703,7 @@ namespace sfl { ...@@ -698,7 +703,7 @@ namespace sfl {
TimerPort::incTimer (threadSleep); TimerPort::incTimer (threadSleep);
} }
_debug ("Left RTP main loop for callid %s",_ca->getCallId().c_str()); _debug ("RTP: Left main loop for call%s", _ca->getCallId().c_str());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment