Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
3889f125
Commit
3889f125
authored
Oct 13, 2011
by
Tristan Matthews
Browse files
* #7131: renamed logging macros
parent
765508ff
Changes
64
Show whitespace changes
Inline
Side-by-side
daemon/src/audio/alsa/alsalayer.cpp
View file @
3889f125
...
...
@@ -113,7 +113,7 @@ bool AlsaLayer::openDevice(snd_pcm_t **pcm, const std::string &dev, snd_pcm_stre
}
if
(
err
<
0
)
{
_error
(
"Alsa: couldn't open device %s : %s"
,
dev
.
c_str
(),
ERROR
(
"Alsa: couldn't open device %s : %s"
,
dev
.
c_str
(),
snd_strerror
(
err
));
return
false
;
}
...
...
@@ -218,7 +218,7 @@ AlsaLayer::stopStream()
#define ALSA_CALL(call, error) ({ \
int err_code = call; \
if (err_code < 0) \
_error
("ALSA: "error": %s", snd_strerror(err_code)); \
ERROR
("ALSA: "error": %s", snd_strerror(err_code)); \
err_code; \
})
...
...
@@ -320,7 +320,7 @@ bool AlsaLayer::alsa_set_params(snd_pcm_t *pcm_handle)
TRY
(
snd_pcm_hw_params
(
HW
),
"hwparams"
);
#undef HW
_debug
(
"ALSA: %s using sampling rate %dHz"
,
DEBUG
(
"ALSA: %s using sampling rate %dHz"
,
(
snd_pcm_stream
(
pcm_handle
)
==
SND_PCM_STREAM_PLAYBACK
)
?
"playback"
:
"capture"
,
audioSampleRate_
);
...
...
@@ -369,7 +369,7 @@ AlsaLayer::write(void* buffer, int length, snd_pcm_t * handle)
}
default:
_error
(
"ALSA: unknown write error, dropping frames: %s"
,
snd_strerror
(
err
));
ERROR
(
"ALSA: unknown write error, dropping frames: %s"
,
snd_strerror
(
err
));
stopPlaybackStream
();
break
;
}
...
...
@@ -404,12 +404,12 @@ AlsaLayer::read(void* buffer, int toCopy)
startCaptureStream
();
}
_error
(
"ALSA: XRUN capture ignored (%s)"
,
snd_strerror
(
err
));
ERROR
(
"ALSA: XRUN capture ignored (%s)"
,
snd_strerror
(
err
));
break
;
}
case
EPERM
:
_error
(
"ALSA: Can't capture, EPERM (%s)"
,
snd_strerror
(
err
));
ERROR
(
"ALSA: Can't capture, EPERM (%s)"
,
snd_strerror
(
err
));
prepareCaptureStream
();
startCaptureStream
();
break
;
...
...
@@ -459,9 +459,9 @@ AlsaLayer::getSoundCardsInfo(int stream)
snd_pcm_info_set_stream
(
pcminfo
,
(
stream
==
SFL_PCM_CAPTURE
)
?
SND_PCM_STREAM_CAPTURE
:
SND_PCM_STREAM_PLAYBACK
);
if
(
snd_ctl_pcm_info
(
handle
,
pcminfo
)
<
0
)
_debug
(
" Cannot get info"
);
DEBUG
(
" Cannot get info"
);
else
{
_debug
(
"card %i : %s [%s]"
,
DEBUG
(
"card %i : %s [%s]"
,
numCard
,
snd_ctl_card_info_get_id
(
info
),
snd_ctl_card_info_get_name
(
info
));
...
...
@@ -531,7 +531,7 @@ void AlsaLayer::capture()
int
toGetSamples
=
snd_pcm_avail_update
(
captureHandle_
);
if
(
toGetSamples
<
0
)
_error
(
"Audio: Mic error: %s"
,
snd_strerror
(
toGetSamples
));
ERROR
(
"Audio: Mic error: %s"
,
snd_strerror
(
toGetSamples
));
if
(
toGetSamples
<=
0
)
return
;
...
...
@@ -545,7 +545,7 @@ void AlsaLayer::capture()
SFLDataFormat
*
in
=
(
SFLDataFormat
*
)
malloc
(
toGetBytes
);
if
(
read
(
in
,
toGetBytes
)
!=
toGetBytes
)
{
_error
(
"ALSA MIC : Couldn't read!"
);
ERROR
(
"ALSA MIC : Couldn't read!"
);
goto
end
;
}
...
...
daemon/src/audio/audioloop.cpp
View file @
3889f125
...
...
@@ -52,7 +52,7 @@ AudioLoop::getNext(SFLDataFormat* output, size_t total_samples, short volume)
size_t
pos
=
pos_
;
if
(
size_
==
0
)
{
_error
(
"AudioLoop: Error: Audio loop size is 0"
);
ERROR
(
"AudioLoop: Error: Audio loop size is 0"
);
return
;
}
...
...
daemon/src/audio/audiorecord.cpp
View file @
3889f125
...
...
@@ -100,12 +100,12 @@ void AudioRecord::initFileName(std::string peerNumber)
if
(
fileType_
==
FILE_RAW
)
{
if
(
strstr
(
fileName_
,
".raw"
)
==
NULL
)
{
_debug
(
"AudioRecord: concatenate .raw file extension: name : %s"
,
fileName_
);
DEBUG
(
"AudioRecord: concatenate .raw file extension: name : %s"
,
fileName_
);
fName
.
append
(
".raw"
);
}
}
else
if
(
fileType_
==
FILE_WAV
)
{
if
(
strstr
(
fileName_
,
".wav"
)
==
NULL
)
{
_debug
(
"AudioRecord: concatenate .wav file extension: name : %s"
,
fileName_
);
DEBUG
(
"AudioRecord: concatenate .wav file extension: name : %s"
,
fileName_
);
fName
.
append
(
".wav"
);
}
}
...
...
@@ -122,10 +122,10 @@ bool AudioRecord::openFile()
{
bool
result
=
false
;
_debug
(
"AudioRecord: Open file()"
);
DEBUG
(
"AudioRecord: Open file()"
);
if
(
not
fileExists
())
{
_debug
(
"AudioRecord: Filename does not exist, creating one"
);
DEBUG
(
"AudioRecord: Filename does not exist, creating one"
);
byteCounter_
=
0
;
if
(
fileType_
==
FILE_RAW
)
...
...
@@ -133,7 +133,7 @@ bool AudioRecord::openFile()
else
if
(
fileType_
==
FILE_WAV
)
result
=
setWavFile
();
}
else
{
_debug
(
"AudioRecord: Filename already exists, opening it"
);
DEBUG
(
"AudioRecord: Filename already exists, opening it"
);
if
(
fileType_
==
FILE_RAW
)
result
=
openExistingRawFile
();
else
if
(
fileType_
==
FILE_WAV
)
...
...
@@ -163,7 +163,7 @@ bool AudioRecord::isOpenFile()
bool
AudioRecord
::
fileExists
()
{
_info
(
"AudioRecord: Trying to open %s "
,
fileName_
);
INFO
(
"AudioRecord: Trying to open %s "
,
fileName_
);
return
fopen
(
fileName_
,
"rb"
)
!=
0
;
}
...
...
@@ -177,10 +177,10 @@ bool AudioRecord::setRecording()
{
if
(
isOpenFile
())
{
if
(
!
recordingEnabled_
)
{
_info
(
"AudioRecording: Start recording"
);
INFO
(
"AudioRecording: Start recording"
);
recordingEnabled_
=
true
;
}
else
{
_info
(
"AudioRecording: Stop recording"
);
INFO
(
"AudioRecording: Stop recording"
);
recordingEnabled_
=
false
;
}
}
else
{
...
...
@@ -195,7 +195,7 @@ bool AudioRecord::setRecording()
void
AudioRecord
::
stopRecording
()
{
_info
(
"AudioRecording: Stop recording"
);
INFO
(
"AudioRecording: Stop recording"
);
recordingEnabled_
=
false
;
}
...
...
@@ -249,7 +249,7 @@ void AudioRecord::createFilename()
// fileName_ = out.str();
strncpy
(
fileName_
,
out
.
str
().
c_str
(),
8192
);
_info
(
"AudioRecord: create filename for this call %s "
,
fileName_
);
INFO
(
"AudioRecord: create filename for this call %s "
,
fileName_
);
}
bool
AudioRecord
::
setRawFile
()
...
...
@@ -257,11 +257,11 @@ bool AudioRecord::setRawFile()
fileHandle_
=
fopen
(
savePath_
.
c_str
(),
"wb"
);
if
(
!
fileHandle_
)
{
_warn
(
"AudioRecord: Could not create RAW file!"
);
WARN
(
"AudioRecord: Could not create RAW file!"
);
return
false
;
}
_debug
(
"AudioRecord:setRawFile() : created RAW file."
);
DEBUG
(
"AudioRecord:setRawFile() : created RAW file."
);
return
true
;
}
...
...
@@ -269,12 +269,12 @@ bool AudioRecord::setRawFile()
bool
AudioRecord
::
setWavFile
()
{
_debug
(
"AudioRecord: Create new wave file %s, sampling rate: %d"
,
savePath_
.
c_str
(),
sndSmplRate_
);
DEBUG
(
"AudioRecord: Create new wave file %s, sampling rate: %d"
,
savePath_
.
c_str
(),
sndSmplRate_
);
fileHandle_
=
fopen
(
savePath_
.
c_str
(),
"wb"
);
if
(
!
fileHandle_
)
{
_warn
(
"AudioRecord: Error: could not create WAV file."
);
WARN
(
"AudioRecord: Error: could not create WAV file."
);
return
false
;
}
...
...
@@ -300,11 +300,11 @@ bool AudioRecord::setWavFile()
if
(
fwrite
(
&
hdr
,
4
,
11
,
fileHandle_
)
!=
11
)
{
_warn
(
"AudioRecord: Error: could not write WAV header for file. "
);
WARN
(
"AudioRecord: Error: could not write WAV header for file. "
);
return
false
;
}
_debug
(
"AudioRecord: created WAV file successfully."
);
DEBUG
(
"AudioRecord: created WAV file successfully."
);
return
true
;
}
...
...
@@ -315,7 +315,7 @@ bool AudioRecord::openExistingRawFile()
fileHandle_
=
fopen
(
fileName_
,
"ab+"
);
if
(
!
fileHandle_
)
{
_warn
(
"AudioRecord: could not create RAW file!"
);
WARN
(
"AudioRecord: could not create RAW file!"
);
return
false
;
}
...
...
@@ -325,37 +325,37 @@ bool AudioRecord::openExistingRawFile()
bool
AudioRecord
::
openExistingWavFile
()
{
_info
(
"%s(%s)
\n
"
,
__PRETTY_FUNCTION__
,
fileName_
);
INFO
(
"%s(%s)
\n
"
,
__PRETTY_FUNCTION__
,
fileName_
);
fileHandle_
=
fopen
(
fileName_
,
"rb+"
);
if
(
!
fileHandle_
)
{
_warn
(
"AudioRecord: Error: could not open WAV file!"
);
WARN
(
"AudioRecord: Error: could not open WAV file!"
);
return
false
;
}
if
(
fseek
(
fileHandle_
,
40
,
SEEK_SET
)
!=
0
)
// jump to data length
_warn
(
"AudioRecord: Error: Couldn't seek offset 40 in the file "
);
WARN
(
"AudioRecord: Error: Couldn't seek offset 40 in the file "
);
if
(
fread
(
&
byteCounter_
,
4
,
1
,
fileHandle_
))
_warn
(
"AudioRecord: Error: bytecounter Read successfully "
);
WARN
(
"AudioRecord: Error: bytecounter Read successfully "
);
if
(
fseek
(
fileHandle_
,
0
,
SEEK_END
)
!=
0
)
_warn
(
"AudioRecord: Error: Couldn't seek at the en of the file "
);
WARN
(
"AudioRecord: Error: Couldn't seek at the en of the file "
);
if
(
fclose
(
fileHandle_
)
!=
0
)
_warn
(
"AudioRecord: Error: Can't close file r+ "
);
WARN
(
"AudioRecord: Error: Can't close file r+ "
);
fileHandle_
=
fopen
(
fileName_
,
"ab+"
);
if
(
!
fileHandle_
)
{
_warn
(
"AudioRecord: Error: Could not createopen WAV file ab+!"
);
WARN
(
"AudioRecord: Error: Could not createopen WAV file ab+!"
);
return
false
;
}
if
(
fseek
(
fileHandle_
,
4
,
SEEK_END
)
!=
0
)
_warn
(
"AudioRecord: Error: Couldn't seek at the en of the file "
);
WARN
(
"AudioRecord: Error: Couldn't seek at the en of the file "
);
return
true
;
...
...
@@ -364,38 +364,38 @@ bool AudioRecord::openExistingWavFile()
void
AudioRecord
::
closeWavFile
()
{
if
(
fileHandle_
==
0
)
{
_debug
(
"AudioRecord: Can't closeWavFile, a file has not yet been opened!"
);
DEBUG
(
"AudioRecord: Can't closeWavFile, a file has not yet been opened!"
);
return
;
}
_debug
(
"AudioRecord: Close wave file"
);
DEBUG
(
"AudioRecord: Close wave file"
);
SINT32
bytes
=
byteCounter_
*
channels_
;
fseek
(
fileHandle_
,
40
,
SEEK_SET
);
// jump to data length
if
(
ferror
(
fileHandle_
))
_warn
(
"AudioRecord: Error: can't reach offset 40 while closing"
);
WARN
(
"AudioRecord: Error: can't reach offset 40 while closing"
);
fwrite
(
&
bytes
,
sizeof
(
SINT32
),
1
,
fileHandle_
);
if
(
ferror
(
fileHandle_
))
_warn
(
"AudioRecord: Error: can't write bytes for data length "
);
WARN
(
"AudioRecord: Error: can't write bytes for data length "
);
bytes
=
byteCounter_
*
channels_
+
44
;
// + 44 for the wave header
fseek
(
fileHandle_
,
4
,
SEEK_SET
);
// jump to file size
if
(
ferror
(
fileHandle_
))
_warn
(
"AudioRecord: Error: can't reach offset 4"
);
WARN
(
"AudioRecord: Error: can't reach offset 4"
);
fwrite
(
&
bytes
,
4
,
1
,
fileHandle_
);
if
(
ferror
(
fileHandle_
))
_warn
(
"AudioRecord: Error: can't reach offset 4"
);
WARN
(
"AudioRecord: Error: can't reach offset 4"
);
if
(
fclose
(
fileHandle_
)
!=
0
)
_warn
(
"AudioRecord: Error: can't close file"
);
WARN
(
"AudioRecord: Error: can't close file"
);
}
void
AudioRecord
::
recSpkrData
(
SFLDataFormat
*
buffer
,
int
nSamples
)
...
...
@@ -425,12 +425,12 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples)
{
if
(
recordingEnabled_
)
{
if
(
fileHandle_
==
0
)
{
_debug
(
"AudioRecord: Can't record data, a file has not yet been opened!"
);
DEBUG
(
"AudioRecord: Can't record data, a file has not yet been opened!"
);
return
;
}
if
(
fwrite
(
buffer
,
sizeof
(
SFLDataFormat
),
nSamples
,
fileHandle_
)
!=
(
unsigned
int
)
nSamples
)
_warn
(
"AudioRecord: Could not record data! "
);
WARN
(
"AudioRecord: Could not record data! "
);
else
{
fflush
(
fileHandle_
);
byteCounter_
+=
(
unsigned
long
)(
nSamples
*
sizeof
(
SFLDataFormat
));
...
...
@@ -444,7 +444,7 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2,
{
if
(
recordingEnabled_
)
{
if
(
fileHandle_
==
0
)
{
_debug
(
"AudioRecord: Can't record data, a file has not yet been opened!"
);
DEBUG
(
"AudioRecord: Can't record data, a file has not yet been opened!"
);
return
;
}
...
...
@@ -452,7 +452,7 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2,
mixBuffer_
[
k
]
=
(
buffer_1
[
k
]
+
buffer_2
[
k
]);
if
(
fwrite
(
&
mixBuffer_
[
k
],
2
,
1
,
fileHandle_
)
!=
1
)
_warn
(
"AudioRecord: Could not record data!"
);
WARN
(
"AudioRecord: Could not record data!"
);
else
fflush
(
fileHandle_
);
}
...
...
daemon/src/audio/audiortp/audio_rtp_record_handler.cpp
View file @
3889f125
...
...
@@ -125,7 +125,7 @@ int AudioRtpRecordHandler::processDataEncode()
int
bytes
=
Manager
::
instance
().
getMainBuffer
()
->
getData
(
micData
,
bytesToGet
,
id_
);
if
(
bytes
!=
bytesToGet
)
{
_error
(
"%s : asked %d bytes from mainbuffer, got %d"
,
__PRETTY_FUNCTION__
,
bytesToGet
,
bytes
);
ERROR
(
"%s : asked %d bytes from mainbuffer, got %d"
,
__PRETTY_FUNCTION__
,
bytesToGet
,
bytes
);
return
0
;
}
...
...
daemon/src/audio/audiortp/audio_rtp_session.cpp
View file @
3889f125
...
...
@@ -72,7 +72,7 @@ void AudioRtpSession::updateSessionMedia(AudioCodec *audioCodec)
Manager
::
instance
().
audioSamplingRateChanged
(
audioRtpRecord_
.
codecSampleRate_
);
if
(
lastSamplingRate
!=
audioRtpRecord_
.
codecSampleRate_
)
{
_debug
(
"AudioRtpSession: Update noise suppressor with sampling rate %d and frame size %d"
,
getCodecSampleRate
(),
getCodecFrameSize
());
DEBUG
(
"AudioRtpSession: Update noise suppressor with sampling rate %d and frame size %d"
,
getCodecSampleRate
(),
getCodecFrameSize
());
initNoiseSuppress
();
}
...
...
@@ -94,20 +94,20 @@ void AudioRtpSession::setSessionMedia(AudioCodec *audioCodec)
else
timestampIncrement_
=
frameSize
;
_debug
(
"AudioRptSession: Codec payload: %d"
,
payloadType
);
_debug
(
"AudioSymmetricRtpSession: Codec sampling rate: %d"
,
smplRate
);
_debug
(
"AudioSymmetricRtpSession: Codec frame size: %d"
,
frameSize
);
_debug
(
"AudioSymmetricRtpSession: RTP timestamp increment: %d"
,
timestampIncrement_
);
DEBUG
(
"AudioRptSession: Codec payload: %d"
,
payloadType
);
DEBUG
(
"AudioSymmetricRtpSession: Codec sampling rate: %d"
,
smplRate
);
DEBUG
(
"AudioSymmetricRtpSession: Codec frame size: %d"
,
frameSize
);
DEBUG
(
"AudioSymmetricRtpSession: RTP timestamp increment: %d"
,
timestampIncrement_
);
if
(
payloadType
==
g722PayloadType
)
{
_debug
(
"AudioSymmetricRtpSession: Setting G722 payload format"
);
DEBUG
(
"AudioSymmetricRtpSession: Setting G722 payload format"
);
queue_
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
((
ost
::
PayloadType
)
payloadType
,
g722RtpClockRate
));
}
else
{
if
(
dynamic
)
{
_debug
(
"AudioSymmetricRtpSession: Setting dynamic payload format"
);
DEBUG
(
"AudioSymmetricRtpSession: Setting dynamic payload format"
);
queue_
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
((
ost
::
PayloadType
)
payloadType
,
smplRate
));
}
else
{
_debug
(
"AudioSymmetricRtpSession: Setting static payload format"
);
DEBUG
(
"AudioSymmetricRtpSession: Setting static payload format"
);
queue_
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
((
ost
::
StaticPayloadType
)
payloadType
));
}
}
...
...
@@ -127,7 +127,7 @@ void AudioRtpSession::sendDtmfEvent()
audioRtpRecord_
.
dtmfQueue_
.
pop_front
();
_debug
(
"AudioRtpSession: Send RTP Dtmf (%d)"
,
payload
.
event
);
DEBUG
(
"AudioRtpSession: Send RTP Dtmf (%d)"
,
payload
.
event
);
timestamp_
+=
(
type_
==
Zrtp
)
?
160
:
timestampIncrement_
;
...
...
@@ -186,7 +186,7 @@ void AudioRtpSession::sendMicData()
void
AudioRtpSession
::
setSessionTimeouts
()
{
_debug
(
"AudioRtpSession: Set session scheduling timeout (%d) and expireTimeout (%d)"
,
sfl
::
schedulingTimeout
,
sfl
::
expireTimeout
);
DEBUG
(
"AudioRtpSession: Set session scheduling timeout (%d) and expireTimeout (%d)"
,
sfl
::
schedulingTimeout
,
sfl
::
expireTimeout
);
queue_
->
setSchedulingTimeout
(
sfl
::
schedulingTimeout
);
queue_
->
setExpireTimeout
(
sfl
::
expireTimeout
);
...
...
@@ -194,13 +194,13 @@ void AudioRtpSession::setSessionTimeouts()
void
AudioRtpSession
::
setDestinationIpAddress
()
{
_info
(
"AudioRtpSession: Setting IP address for the RTP session"
);
INFO
(
"AudioRtpSession: Setting IP address for the RTP session"
);
// Store remote ip in case we would need to forget current destination
remote_ip_
=
ost
::
InetHostAddress
(
ca_
->
getLocalSDP
()
->
getRemoteIP
().
c_str
());
if
(
!
remote_ip_
)
{
_warn
(
"AudioRtpSession: Target IP address (%s) is not correct!"
,
WARN
(
"AudioRtpSession: Target IP address (%s) is not correct!"
,
ca_
->
getLocalSDP
()
->
getRemoteIP
().
data
());
return
;
}
...
...
@@ -208,24 +208,24 @@ void AudioRtpSession::setDestinationIpAddress()
// Store remote port in case we would need to forget current destination
remote_port_
=
(
unsigned
short
)
ca_
->
getLocalSDP
()
->
getRemoteAudioPort
();
_info
(
"AudioRtpSession: New remote address for session: %s:%d"
,
INFO
(
"AudioRtpSession: New remote address for session: %s:%d"
,
ca_
->
getLocalSDP
()
->
getRemoteIP
().
data
(),
remote_port_
);
if
(
!
queue_
->
addDestination
(
remote_ip_
,
remote_port_
))
{
_warn
(
"AudioRtpSession: Can't add new destination to session!"
);
WARN
(
"AudioRtpSession: Can't add new destination to session!"
);
return
;
}
}
void
AudioRtpSession
::
updateDestinationIpAddress
()
{
_debug
(
"AudioRtpSession: Update destination ip address"
);
DEBUG
(
"AudioRtpSession: Update destination ip address"
);
// Destination address are stored in a list in ccrtp
// This method remove the current destination entry
if
(
!
queue_
->
forgetDestination
(
remote_ip_
,
remote_port_
,
remote_port_
+
1
))
_debug
(
"AudioRtpSession: Did not remove previous destination"
);
DEBUG
(
"AudioRtpSession: Did not remove previous destination"
);
// new destination is stored in call
// we just need to recall this method
...
...
@@ -238,7 +238,7 @@ int AudioRtpSession::startRtpThread(AudioCodec* audiocodec)
if
(
isStarted_
)
return
0
;
_debug
(
"AudioSymmetricRtpSession: Starting main thread"
);
DEBUG
(
"AudioSymmetricRtpSession: Starting main thread"
);
isStarted_
=
true
;
setSessionTimeouts
();
...
...
daemon/src/audio/audiortp/audio_srtp_session.cpp
View file @
3889f125
...
...
@@ -61,12 +61,12 @@ AudioSrtpSession::AudioSrtpSession(SIPCall * sipcall) :
AudioSrtpSession
::~
AudioSrtpSession
()
{
_debug
(
"AudioSrtp: Destroy audio srtp session"
);
DEBUG
(
"AudioSrtp: Destroy audio srtp session"
);
}
void
AudioSrtpSession
::
initLocalCryptoInfo
()
{
_debug
(
"AudioSrtp: Set cryptographic info for this rtp session"
);
DEBUG
(
"AudioSrtp: Set cryptographic info for this rtp session"
);
// Initialize local Crypto context
initializeLocalMasterKey
();
...
...
@@ -82,7 +82,7 @@ void AudioSrtpSession::initLocalCryptoInfo()
std
::
vector
<
std
::
string
>
AudioSrtpSession
::
getLocalCryptoInfo
()
{
_debug
(
"AudioSrtp: Get Cryptographic info from this rtp session"
);
DEBUG
(
"AudioSrtp: Get Cryptographic info from this rtp session"
);
std
::
vector
<
std
::
string
>
crypto_vector
;
...
...
@@ -104,7 +104,7 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo()
crypto_attr
+=
crypto_suite
.
append
(
" "
);
crypto_attr
+=
srtp_keys
;
_debug
(
"%s"
,
crypto_attr
.
c_str
());
DEBUG
(
"%s"
,
crypto_attr
.
c_str
());
crypto_vector
.
push_back
(
crypto_attr
);
...
...
@@ -114,7 +114,7 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo()
void
AudioSrtpSession
::
setRemoteCryptoInfo
(
sfl
::
SdesNegotiator
&
nego
)
{
if
(
not
remoteOfferIsSet_
)
{
_debug
(
"%s"
,
nego
.
getKeyInfo
().
c_str
());
DEBUG
(
"%s"
,
nego
.
getKeyInfo
().
c_str
());
// Use second crypto suite if key length is 32 bit, default is 80;
...
...
@@ -137,12 +137,12 @@ void AudioSrtpSession::setRemoteCryptoInfo(sfl::SdesNegotiator& nego)
void
AudioSrtpSession
::
initializeLocalMasterKey
()
{
_debug
(
"AudioSrtp: Init local master key"
);
DEBUG
(
"AudioSrtp: Init local master key"
);
// @TODO key may have different length depending on cipher suite
localMasterKeyLength_
=
sfl
::
CryptoSuites
[
localCryptoSuite_
].
masterKeyLength
/
8
;
_debug
(
"AudioSrtp: Local master key length %d"
,
localMasterKeyLength_
);
DEBUG
(
"AudioSrtp: Local master key length %d"
,
localMasterKeyLength_
);
// Allocate memory for key
unsigned
char
*
random_key
=
new
unsigned
char
[
localMasterKeyLength_
];
...
...
@@ -151,7 +151,7 @@ void AudioSrtpSession::initializeLocalMasterKey()
int
err
;
if
((
err
=
RAND_bytes
(
random_key
,
localMasterKeyLength_
))
!=
1
)
_debug
(
"Error occured while generating cryptographically strong pseudo-random key"
);
DEBUG
(
"Error occured while generating cryptographically strong pseudo-random key"
);
memcpy
(
localMasterKey_
,
random_key
,
localMasterKeyLength_
);
}
...
...
@@ -164,27 +164,27 @@ void AudioSrtpSession::initializeLocalMasterSalt()
// Allocate memory for key
unsigned
char
*
random_key
=
new
unsigned
char
[
localMasterSaltLength_
];
_debug
(
"AudioSrtp: Local master salt length %d"
,
localMasterSaltLength_
);
DEBUG
(
"AudioSrtp: Local master salt length %d"
,
localMasterSaltLength_
);
// Generate ryptographically strong pseudo-random bytes
int
err
;
if
((
err
=
RAND_bytes
(
random_key
,
localMasterSaltLength_
))
!=
1
)
_debug
(
"Error occured while generating cryptographically strong pseudo-random key"
);
DEBUG
(
"Error occured while generating cryptographically strong pseudo-random key"
);
memcpy
(
localMasterSalt_
,
random_key
,
localMasterSaltLength_
);
}
std
::
string
AudioSrtpSession
::
getBase64ConcatenatedKeys
()
{
_debug
(
"AudioSrtp: Get base64 concatenated keys"
);
DEBUG
(
"AudioSrtp: Get base64 concatenated keys"
);
// compute concatenated master and salt length
int
concatLength
=
localMasterKeyLength_
+
localMasterSaltLength_
;
uint8
concatKeys
[
concatLength
];
_debug
(
"AudioSrtp: Concatenated length %d"
,
concatLength
);
DEBUG
(
"AudioSrtp: Concatenated length %d"
,
concatLength
);
// concatenate keys
memcpy
((
void
*
)
concatKeys
,
(
void
*
)
localMasterKey_
,
localMasterKeyLength_
);
...
...
@@ -214,7 +214,7 @@ void AudioSrtpSession::unBase64ConcatenatedKeys(std::string base64keys)
void
AudioSrtpSession
::
initializeRemoteCryptoContext
()
{
_debug
(
"AudioSrtp: Initialize remote crypto context"
);
DEBUG
(
"AudioSrtp: Initialize remote crypto context"
);
CryptoSuiteDefinition
crypto
=
sfl
::
CryptoSuites
[
remoteCryptoSuite_
];
...
...
@@ -241,7 +241,7 @@ void AudioSrtpSession::initializeRemoteCryptoContext()
void
AudioSrtpSession
::
initializeLocalCryptoContext
()
{
_debug
(
"AudioSrtp: Initialize local crypto context"
);
DEBUG
(
"AudioSrtp: Initialize local crypto context"
);
CryptoSuiteDefinition
crypto
=
sfl
::
CryptoSuites
[
localCryptoSuite_
];
...
...
daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp
View file @
3889f125
...
...
@@ -46,7 +46,7 @@ AudioSymmetricRtpSession::AudioSymmetricRtpSession(SIPCall * sipcall) :
,
AudioRtpSession
(
sipcall
,
Symmetric
,
this
,
this
)
,
rtpThread_
(
new
AudioRtpThread
(
this
))
{
_info
(
"AudioSymmetricRtpSession: Setting new RTP session with destination %s:%d"
,
ca_
->
getLocalIp
().
c_str
(),
ca_
->
getLocalAudioPort
());
INFO
(
"AudioSymmetricRtpSession: Setting new RTP session with destination %s:%d"
,
ca_
->
getLocalIp
().
c_str
(),
ca_
->
getLocalAudioPort
());
audioRtpRecord_
.
callId_
=
ca_
->
getCallId
();
}
...
...
@@ -65,7 +65,7 @@ void AudioSymmetricRtpSession::AudioRtpThread::run()
TimerPort
::
setTimer
(
threadSleep
);
_debug
(
"AudioRtpThread: Entering Audio rtp thread main loop"
);
DEBUG
(
"AudioRtpThread: Entering Audio rtp thread main loop"
);
while
(
running
)
{
// Send session
...
...
@@ -79,7 +79,7 @@ void AudioSymmetricRtpSession::AudioRtpThread::run()
TimerPort
::
incTimer
(
threadSleep
);
}
_debug
(
"AudioRtpThread: Leaving audio rtp thread loop"
);
DEBUG
(
"AudioRtpThread: Leaving audio rtp thread loop"
);
}
}
daemon/src/audio/audiortp/audio_zrtp_session.cpp
View file @
3889f125
...
...
@@ -58,12 +58,12 @@ AudioZrtpSession::AudioZrtpSession(SIPCall * sipcall, const std::string& zidFile
ost
::
defaultApplication
()),
zidFilename_
(
zidFilename
)
{
_debug
(
"AudioZrtpSession initialized"
);
DEBUG
(
"AudioZrtpSession initialized"
);
initializeZid
();
setCancel
(
cancelDefault
);
_info
(
"AudioZrtpSession: Setting new RTP session with destination %s:%d"
,
ca_
->
getLocalIp
().
c_str
(),
ca_
->
getLocalAudioPort
());
INFO
(
"AudioZrtpSession: Setting new RTP session with destination %s:%d"
,
ca_
->
getLocalIp
().
c_str
(),
ca_
->
getLocalAudioPort
());
}
AudioZrtpSession
::~
AudioZrtpSession
()
...
...
@@ -93,24 +93,24 @@ void AudioZrtpSession::initializeZid()
std
::
string
xdg_config
=
std
::
string
(
HOMEDIR
)
+
DIR_SEPARATOR_STR
+
".cache"
+
DIR_SEPARATOR_STR
+
PACKAGE
+
"/"
+
zidFilename_
;
_debug
(
" xdg_config %s"
,
xdg_config
.
c_str
());
DEBUG
(
" xdg_config %s"
,
xdg_config
.
c_str
());
if
(
XDG_CACHE_HOME
!=
NULL
)
{