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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
ab3df1e1
Commit
ab3df1e1
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
Build RTP session with right remote IP and remote audio port
parent
a6edb365
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/audio/audiortp.cpp
+13
-9
13 additions, 9 deletions
src/audio/audiortp.cpp
src/call.cpp
+0
-16
0 additions, 16 deletions
src/call.cpp
src/call.h
+1
-31
1 addition, 31 deletions
src/call.h
src/sdp.cpp
+3
-3
3 additions, 3 deletions
src/sdp.cpp
src/sdp.h
+35
-3
35 additions, 3 deletions
src/sdp.h
with
52 additions
and
62 deletions
src/audio/audiortp.cpp
+
13
−
9
View file @
ab3df1e1
...
@@ -185,19 +185,22 @@ AudioRtpRTX::initBuffers()
...
@@ -185,19 +185,22 @@ AudioRtpRTX::initBuffers()
void
void
AudioRtpRTX
::
initAudioRtpSession
(
void
)
AudioRtpRTX
::
initAudioRtpSession
(
void
)
{
{
std
::
string
remoteIP
;
unsigned
int
remotePort
;
try
{
try
{
if
(
_ca
==
0
)
{
return
;
}
if
(
_ca
==
0
)
{
return
;
}
_audiocodec
=
Manager
::
instance
().
getCodecDescriptorMap
().
getCodec
(
_ca
->
getLocalSDP
()
->
getAudioCodec
()
);
_audiocodec
=
Manager
::
instance
().
getCodecDescriptorMap
().
getCodec
(
_ca
->
getLocalSDP
()
->
getAudioCodec
()
);
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_debug
(
"Init audio RTP session
\n
"
);
remoteIP
=
_ca
->
getLocalSDP
()
->
getRemoteIp
();
ost
::
InetHostAddress
remote_ip
(
_ca
->
getRemoteIp
().
c_str
());
_debug
(
"Init audio RTP session - remote IP = %s
\n
"
,
remoteIP
.
c_str
());
ost
::
InetHostAddress
remote_ip
(
remoteIP
.
c_str
());
if
(
!
remote_ip
)
{
if
(
!
remote_ip
)
{
_debug
(
"! ARTP Thread Error: Target IP address [%s] is not correct!
\n
"
,
_ca
->
getR
emoteI
p
()
.
data
());
_debug
(
"! ARTP Thread Error: Target IP address [%s] is not correct!
\n
"
,
r
emoteI
P
.
data
());
return
;
return
;
}
}
if
(
!
_sym
)
{
if
(
!
_sym
)
{
_sessionRecv
->
setSchedulingTimeout
(
10000
);
_sessionRecv
->
setSchedulingTimeout
(
10000
);
_sessionRecv
->
setExpireTimeout
(
1000000
);
_sessionRecv
->
setExpireTimeout
(
1000000
);
...
@@ -210,12 +213,13 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -210,12 +213,13 @@ AudioRtpRTX::initAudioRtpSession (void)
}
}
if
(
!
_sym
)
{
if
(
!
_sym
)
{
if
(
!
_sessionRecv
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getRemoteAudioPort
())
)
{
remotePort
=
_ca
->
getLocalSDP
()
->
getRemoteAudioPort
();
_debug
(
"AudioRTP Thread Error: could not connect to port %d
\n
"
,
_ca
->
getRemoteAudioPort
());
if
(
!
_sessionRecv
->
addDestination
(
remote_ip
,
(
unsigned
short
)
remotePort
)
)
{
_debug
(
"AudioRTP Thread Error: could not connect to port %d
\n
"
,
remotePort
);
return
;
return
;
}
}
if
(
!
_sessionSend
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getRemoteAudio
Port
()
))
{
if
(
!
_sessionSend
->
addDestination
(
remote_ip
,
(
unsigned
short
)
remote
Port
))
{
_debug
(
"! ARTP Thread Error: could not connect to port %d
\n
"
,
_ca
->
getRemoteAudio
Port
()
);
_debug
(
"! ARTP Thread Error: could not connect to port %d
\n
"
,
remote
Port
);
return
;
return
;
}
}
...
@@ -233,7 +237,7 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -233,7 +237,7 @@ AudioRtpRTX::initAudioRtpSession (void)
//_debug("AudioRTP Thread: Added session destination %s\n", remote_ip.getHostname() );
//_debug("AudioRTP Thread: Added session destination %s\n", remote_ip.getHostname() );
if
(
!
_session
->
addDestination
(
remote_ip
,
(
unsigned
short
)
_ca
->
getRemoteAudio
Port
()
))
{
if
(
!
_session
->
addDestination
(
remote_ip
,
(
unsigned
short
)
remote
Port
))
{
return
;
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/call.cpp
+
0
−
16
View file @
ab3df1e1
...
@@ -26,8 +26,6 @@ Call::Call(const CallID& id, Call::CallType type)
...
@@ -26,8 +26,6 @@ Call::Call(const CallID& id, Call::CallType type)
,
_localIPAddress
(
""
)
,
_localIPAddress
(
""
)
,
_localAudioPort
(
0
)
,
_localAudioPort
(
0
)
,
_localExternalAudioPort
(
0
)
,
_localExternalAudioPort
(
0
)
,
_remoteIPAddress
(
""
)
,
_remoteAudioPort
(
0
)
,
_id
(
id
)
,
_id
(
id
)
,
_type
(
type
)
,
_type
(
type
)
,
_connectionState
(
Call
::
Disconnected
)
,
_connectionState
(
Call
::
Disconnected
)
...
@@ -97,20 +95,6 @@ Call::getLocalAudioPort()
...
@@ -97,20 +95,6 @@ Call::getLocalAudioPort()
return
_localAudioPort
;
return
_localAudioPort
;
}
}
unsigned
int
Call
::
getRemoteAudioPort
()
{
ost
::
MutexLock
m
(
_callMutex
);
return
_remoteAudioPort
;
}
const
std
::
string
&
Call
::
getRemoteIp
()
{
ost
::
MutexLock
m
(
_callMutex
);
return
_remoteIPAddress
;
}
void
void
Call
::
setAudioStart
(
bool
start
)
Call
::
setAudioStart
(
bool
start
)
{
{
...
...
This diff is collapsed.
Click to expand it.
src/call.h
+
1
−
31
View file @
ab3df1e1
...
@@ -180,18 +180,6 @@ class Call{
...
@@ -180,18 +180,6 @@ class Call{
*/
*/
unsigned
int
getLocalAudioPort
();
unsigned
int
getLocalAudioPort
();
/**
* Return audio port at destination [mutex protected]
* @return unsigned int The remote audio port
*/
unsigned
int
getRemoteAudioPort
();
/**
* Return IP of destination [mutex protected]
* @return const std:string The remote IP address
*/
const
std
::
string
&
getRemoteIp
();
/**
/**
* @return Return the file name for this call
* @return Return the file name for this call
*/
*/
...
@@ -226,18 +214,6 @@ class Call{
...
@@ -226,18 +214,6 @@ class Call{
/** Protect every attribute that can be changed by two threads */
/** Protect every attribute that can be changed by two threads */
ost
::
Mutex
_callMutex
;
ost
::
Mutex
_callMutex
;
/**
* Set remote's IP addr. [not protected]
* @param ip The remote IP address
*/
void
setRemoteIP
(
const
std
::
string
&
ip
)
{
_remoteIPAddress
=
ip
;
}
/**
* Set remote's audio port. [not protected]
* @param port The remote audio port
*/
void
setRemoteAudioPort
(
unsigned
int
port
)
{
_remoteAudioPort
=
port
;
}
bool
_audioStarted
;
bool
_audioStarted
;
// Informations about call socket / audio
// Informations about call socket / audio
...
@@ -251,12 +227,6 @@ class Call{
...
@@ -251,12 +227,6 @@ class Call{
/** Port assigned to my machine by the NAT, as seen by remote peer (he connects there) */
/** Port assigned to my machine by the NAT, as seen by remote peer (he connects there) */
unsigned
int
_localExternalAudioPort
;
unsigned
int
_localExternalAudioPort
;
/** Remote's IP address */
std
::
string
_remoteIPAddress
;
/** Remote's audio port */
unsigned
int
_remoteAudioPort
;
private
:
private
:
...
...
This diff is collapsed.
Click to expand it.
src/sdp.cpp
+
3
−
3
View file @
ab3df1e1
...
@@ -147,10 +147,10 @@ Sdp::setRemoteAudioFromSDP(pjmedia_sdp_session* remote_sdp, pjmedia_sdp_media *r
...
@@ -147,10 +147,10 @@ Sdp::setRemoteAudioFromSDP(pjmedia_sdp_session* remote_sdp, pjmedia_sdp_media *r
{
{
std
::
string
remoteIP
(
remote_sdp
->
conn
->
addr
.
ptr
,
remote_sdp
->
conn
->
addr
.
slen
);
std
::
string
remoteIP
(
remote_sdp
->
conn
->
addr
.
ptr
,
remote_sdp
->
conn
->
addr
.
slen
);
_debug
(
" Remote Audio IP: %s
\n
"
,
remoteIP
.
data
());
_debug
(
" Remote Audio IP: %s
\n
"
,
remoteIP
.
data
());
//
setRemoteIP(remoteIP);
setRemoteIP
(
remoteIP
);
int
remotePort
=
remote_med
->
desc
.
port
;
int
remotePort
=
remote_med
->
desc
.
port
;
_debug
(
" Remote Audio Port: %d
\n
"
,
remotePort
);
_debug
(
" Remote Audio Port: %d
\n
"
,
remotePort
);
//
setRemoteAudioPort(remotePort);
setRemoteAudioPort
(
remotePort
);
return
true
;
return
true
;
}
}
...
@@ -382,6 +382,6 @@ void Sdp::toString (void) {
...
@@ -382,6 +382,6 @@ void Sdp::toString (void) {
sdp
<<
"fmt_count="
<<
_localSDP
->
media
[
0
]
->
desc
.
fmt_count
<<
"
\n
"
;
sdp
<<
"fmt_count="
<<
_localSDP
->
media
[
0
]
->
desc
.
fmt_count
<<
"
\n
"
;
sdp
<<
"fmt="
<<
_localSDP
->
media
[
0
]
->
desc
.
fmt
[
0
].
ptr
<<
"
\n
"
;
sdp
<<
"fmt="
<<
_localSDP
->
media
[
0
]
->
desc
.
fmt
[
0
].
ptr
<<
"
\n
"
;
_debug
(
"LOCAL SDP:
\n
%s
\n
"
,
sdp
.
str
().
c_str
());
//
_debug ("LOCAL SDP: \n%s\n", sdp.str().c_str());
}
}
This diff is collapsed.
Click to expand it.
src/sdp.h
+
35
−
3
View file @
ab3df1e1
...
@@ -101,6 +101,31 @@ class Sdp {
...
@@ -101,6 +101,31 @@ class Sdp {
AudioCodecType
getAudioCodec
(
void
)
{
return
_audioCodec
;
}
AudioCodecType
getAudioCodec
(
void
)
{
return
_audioCodec
;
}
/**
* Set remote's IP addr. [not protected]
* @param ip The remote IP address
*/
void
setRemoteIP
(
const
std
::
string
&
ip
)
{
_remoteIPAddress
=
ip
;
}
/**
* Set remote's audio port. [not protected]
* @param port The remote audio port
*/
void
setRemoteAudioPort
(
unsigned
int
port
)
{
_remoteAudioPort
=
port
;
}
/**
* Return audio port at destination [mutex protected]
* @return unsigned int The remote audio port
*/
unsigned
int
getRemoteAudioPort
()
{
return
_remoteAudioPort
;
}
/**
* Return IP of destination [mutex protected]
* @return const std:string The remote IP address
*/
const
std
::
string
&
getRemoteIp
()
{
return
_remoteIPAddress
;
}
private
:
private
:
/**
/**
* Set the audio codec used. [not protected]
* Set the audio codec used. [not protected]
...
@@ -116,6 +141,13 @@ class Sdp {
...
@@ -116,6 +141,13 @@ class Sdp {
int
_localPort
;
int
_localPort
;
/** Remote's IP address */
std
::
string
_remoteIPAddress
;
/** Remote's audio port */
unsigned
int
_remoteAudioPort
;
/**
/**
* Get a valid remote media
* Get a valid remote media
* @param remote_sdp pjmedia_sdp_session*
* @param remote_sdp pjmedia_sdp_session*
...
...
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
register
or
sign in
to comment