Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
457b3433
Commit
457b3433
authored
Jun 18, 2009
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#1450] Add setRtpSessionMedia and setRtpSessionRemoteIp address
parent
13ba301d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
sflphone-common/src/audio/audiortp.cpp
+100
-4
100 additions, 4 deletions
sflphone-common/src/audio/audiortp.cpp
sflphone-common/src/audio/audiortp.h
+15
-0
15 additions, 0 deletions
sflphone-common/src/audio/audiortp.h
sflphone-common/src/sdp.cpp
+5
-1
5 additions, 1 deletion
sflphone-common/src/sdp.cpp
with
120 additions
and
5 deletions
sflphone-common/src/audio/audiortp.cpp
+
100
−
4
View file @
457b3433
...
@@ -106,6 +106,13 @@ AudioRtp::closeRtpSession () {
...
@@ -106,6 +106,13 @@ AudioRtp::closeRtpSession () {
}
}
AudioRtpRTX
*
AudioRtp
::
getRTX
()
{
return
_RTXThread
;
}
void
void
AudioRtp
::
setRecording
()
{
AudioRtp
::
setRecording
()
{
...
@@ -116,6 +123,8 @@ AudioRtp::setRecording() {
...
@@ -116,6 +123,8 @@ AudioRtp::setRecording() {
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// AudioRtpRTX Class //
// AudioRtpRTX Class //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
...
@@ -195,11 +204,16 @@ AudioRtpRTX::initBuffers()
...
@@ -195,11 +204,16 @@ AudioRtpRTX::initBuffers()
spkrDataDecoded
=
new
SFLDataFormat
[
nbSamplesMax
];
spkrDataDecoded
=
new
SFLDataFormat
[
nbSamplesMax
];
}
}
void
void
AudioRtpRTX
::
initAudioRtpSession
(
void
)
AudioRtpRTX
::
initAudioRtpSession
(
void
)
{
{
try
{
try
{
setRtpSessionMedia
();
/*
if (_ca == 0) { return; }
if (_ca == 0) { return; }
_audiocodec = _ca->getLocalSDP()->get_session_media ();
_audiocodec = _ca->getLocalSDP()->get_session_media ();
...
@@ -208,7 +222,6 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -208,7 +222,6 @@ AudioRtpRTX::initAudioRtpSession (void)
_codecSampleRate = _audiocodec->getClockRate();
_codecSampleRate = _audiocodec->getClockRate();
_codecFrameSize = _audiocodec->getFrameSize();
_codecFrameSize = _audiocodec->getFrameSize();
ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str());
ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str());
_debug("Init audio RTP session %s\n", _ca->getLocalSDP()->get_remote_ip().data());
_debug("Init audio RTP session %s\n", _ca->getLocalSDP()->get_remote_ip().data());
if (!remote_ip) {
if (!remote_ip) {
...
@@ -227,7 +240,11 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -227,7 +240,11 @@ AudioRtpRTX::initAudioRtpSession (void)
_session->setSchedulingTimeout(10000);
_session->setSchedulingTimeout(10000);
_session->setExpireTimeout(1000000);
_session->setExpireTimeout(1000000);
}
}
*/
setRtpSessionRemoteIp
();
/*
if (!_sym) {
if (!_sym) {
if ( !_sessionRecv->addDestination(remote_ip, (unsigned short) _ca->getLocalSDP()->get_remote_audio_port()) ) {
if ( !_sessionRecv->addDestination(remote_ip, (unsigned short) _ca->getLocalSDP()->get_remote_audio_port()) ) {
_debug("AudioRTP Thread Error: could not connect to port %d\n", _ca->getLocalSDP()->get_remote_audio_port());
_debug("AudioRTP Thread Error: could not connect to port %d\n", _ca->getLocalSDP()->get_remote_audio_port());
...
@@ -263,6 +280,7 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -263,6 +280,7 @@ AudioRtpRTX::initAudioRtpSession (void)
}
}
}
}
}
}
*/
}
catch
(...)
{
}
catch
(...)
{
...
@@ -272,6 +290,84 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -272,6 +290,84 @@ AudioRtpRTX::initAudioRtpSession (void)
}
}
void
AudioRtpRTX
::
setRtpSessionMedia
(
void
)
{
_debug
(
"setRtpSessionMedia()
\n
"
);
if
(
_ca
==
0
)
{
return
;
}
_audiocodec
=
_ca
->
getLocalSDP
()
->
get_session_media
();
if
(
_audiocodec
==
NULL
)
{
return
;
}
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_codecFrameSize
=
_audiocodec
->
getFrameSize
();
if
(
!
_sym
)
{
bool
payloadIsSet
=
false
;
if
(
_audiocodec
)
{
if
(
_audiocodec
->
hasDynamicPayload
())
{
payloadIsSet
=
_sessionRecv
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
((
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
}
else
{
payloadIsSet
=
_sessionRecv
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
((
ost
::
StaticPayloadType
)
_audiocodec
->
getPayload
()));
payloadIsSet
=
_sessionSend
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
((
ost
::
StaticPayloadType
)
_audiocodec
->
getPayload
()));
}
}
_sessionSend
->
setMark
(
true
);
}
else
{
bool
payloadIsSet
=
false
;
if
(
_audiocodec
)
{
if
(
_audiocodec
->
hasDynamicPayload
())
{
payloadIsSet
=
_session
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
((
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
}
else
{
payloadIsSet
=
_session
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
((
ost
::
StaticPayloadType
)
_audiocodec
->
getPayload
()));
}
}
}
}
void
AudioRtpRTX
::
setRtpSessionRemoteIp
(
void
)
{
if
(
_ca
==
0
)
{
return
;
}
ost
::
InetHostAddress
remote_ip
(
_ca
->
getLocalSDP
()
->
get_remote_ip
().
c_str
());
_debug
(
"Init audio RTP session %s
\n
"
,
_ca
->
getLocalSDP
()
->
get_remote_ip
().
data
());
if
(
!
remote_ip
)
{
_debug
(
"! ARTP Thread Error: Target IP address [%s] is not correct!
\n
"
,
_ca
->
getLocalSDP
()
->
get_remote_ip
().
data
());
return
;
}
if
(
!
_sym
)
{
if
(
!
_sessionRecv
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getLocalSDP
()
->
get_remote_audio_port
())
)
{
_debug
(
"AudioRTP Thread Error: could not connect to port %d
\n
"
,
_ca
->
getLocalSDP
()
->
get_remote_audio_port
());
return
;
}
if
(
!
_sessionSend
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getLocalSDP
()
->
get_remote_audio_port
()))
{
_debug
(
"! ARTP Thread Error: could not connect to port %d
\n
"
,
_ca
->
getLocalSDP
()
->
get_remote_audio_port
());
return
;
}
_sessionSend
->
setMark
(
true
);
}
else
{
if
(
!
_session
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getLocalSDP
()
->
get_remote_audio_port
()
))
{
return
;
}
}
}
float
float
AudioRtpRTX
::
computeCodecFrameSize
(
int
codecSamplePerFrame
,
int
codecClockRate
)
AudioRtpRTX
::
computeCodecFrameSize
(
int
codecSamplePerFrame
,
int
codecClockRate
)
{
{
...
...
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/audiortp.h
+
15
−
0
View file @
457b3433
...
@@ -74,6 +74,16 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
...
@@ -74,6 +74,16 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
/** A SIP call */
/** A SIP call */
SIPCall
*
_ca
;
SIPCall
*
_ca
;
/**
* Update RTP session media info as received from SDP negociation
*/
void
setRtpSessionMedia
(
void
);
/**
* Update RTP session remote ip destination as received from sip transaction
*/
void
setRtpSessionRemoteIp
(
void
);
friend
class
RtpTest
;
friend
class
RtpTest
;
...
@@ -222,6 +232,11 @@ class AudioRtp {
...
@@ -222,6 +232,11 @@ class AudioRtp {
*/
*/
bool
closeRtpSession
(
void
);
bool
closeRtpSession
(
void
);
/**
* Return a pointer to the RTP thead
*/
AudioRtpRTX
*
getRTX
();
/**
/**
* Start recording
* Start recording
*/
*/
...
...
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/sdp.cpp
+
5
−
1
View file @
457b3433
...
@@ -296,6 +296,7 @@ void Sdp::set_negociated_offer( const pjmedia_sdp_session *sdp ){
...
@@ -296,6 +296,7 @@ void Sdp::set_negociated_offer( const pjmedia_sdp_session *sdp ){
// Retrieve the payload
// Retrieve the payload
nb_codecs
=
current
->
desc
.
fmt_count
;
// Must be one
nb_codecs
=
current
->
desc
.
fmt_count
;
// Must be one
for
(
j
=
0
;
j
<
nb_codecs
;
j
++
){
for
(
j
=
0
;
j
<
nb_codecs
;
j
++
){
_debug
(
"================== set_negociated_offer ===================== %i
\n
"
,
atoi
(
current
->
desc
.
fmt
[
j
].
ptr
));
iter
=
codecs_list
.
find
((
AudioCodecType
)
atoi
(
current
->
desc
.
fmt
[
j
].
ptr
));
iter
=
codecs_list
.
find
((
AudioCodecType
)
atoi
(
current
->
desc
.
fmt
[
j
].
ptr
));
if
(
iter
==
codecs_list
.
end
())
if
(
iter
==
codecs_list
.
end
())
return
;
return
;
...
@@ -417,6 +418,7 @@ void Sdp::fetch_remote_ip_from_sdp (pjmedia_sdp_session *r_sdp) {
...
@@ -417,6 +418,7 @@ void Sdp::fetch_remote_ip_from_sdp (pjmedia_sdp_session *r_sdp) {
std
::
string
remote_ip
;
std
::
string
remote_ip
;
remote_ip
=
r_sdp
->
conn
->
addr
.
ptr
;
remote_ip
=
r_sdp
->
conn
->
addr
.
ptr
;
_debug
(
" Remote IP from fetching SDP: %s
\n
"
,
remote_ip
.
c_str
());
this
->
set_remote_ip
(
remote_ip
);
this
->
set_remote_ip
(
remote_ip
);
}
}
...
@@ -425,12 +427,14 @@ void Sdp::fetch_remote_audio_port_from_sdp (pjmedia_sdp_media *r_media){
...
@@ -425,12 +427,14 @@ void Sdp::fetch_remote_audio_port_from_sdp (pjmedia_sdp_media *r_media){
int
remote_port
;
int
remote_port
;
remote_port
=
r_media
->
desc
.
port
;
remote_port
=
r_media
->
desc
.
port
;
_debug
(
" Remote Audio Port: %d
\n
"
,
remote_port
);
_debug
(
" Remote Audio Port
from fetching SDP
: %d
\n
"
,
remote_port
);
this
->
set_remote_audio_port
(
remote_port
);
this
->
set_remote_audio_port
(
remote_port
);
}
}
void
Sdp
::
fetch_media_transport_info_from_remote_sdp
(
pjmedia_sdp_session
*
remote_sdp
)
{
void
Sdp
::
fetch_media_transport_info_from_remote_sdp
(
pjmedia_sdp_session
*
remote_sdp
)
{
_debug
(
"Fetching media from sdp
\n
"
);
pjmedia_sdp_media
*
r_media
;
pjmedia_sdp_media
*
r_media
;
this
->
get_remote_sdp_media_from_offer
(
remote_sdp
,
&
r_media
);
this
->
get_remote_sdp_media_from_offer
(
remote_sdp
,
&
r_media
);
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment