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
0289ba68
Commit
0289ba68
authored
11 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
sdp: fix failed unit tests
parent
ded27dcd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/sip/sdp.cpp
+16
-17
16 additions, 17 deletions
daemon/src/sip/sdp.cpp
daemon/src/sip/sdp.h
+11
-5
11 additions, 5 deletions
daemon/src/sip/sdp.h
with
27 additions
and
22 deletions
daemon/src/sip/sdp.cpp
+
16
−
17
View file @
0289ba68
...
@@ -39,7 +39,6 @@
...
@@ -39,7 +39,6 @@
#include
"sipaccount.h"
#include
"sipaccount.h"
#include
"manager.h"
#include
"manager.h"
#include
"logger.h"
#include
"logger.h"
#include
"ip_utils.h"
#ifdef SFL_VIDEO
#ifdef SFL_VIDEO
#include
"video/libav_utils.h"
#include
"video/libav_utils.h"
...
@@ -64,7 +63,7 @@ Sdp::Sdp(pj_pool_t *pool)
...
@@ -64,7 +63,7 @@ Sdp::Sdp(pj_pool_t *pool)
,
sessionAudioMedia_
()
,
sessionAudioMedia_
()
,
sessionVideoMedia_
()
,
sessionVideoMedia_
()
,
publishedIpAddr_
()
,
publishedIpAddr_
()
,
publishedIpAddr
Str
_
()
,
publishedIpAddr
Type
_
()
,
remoteIpAddr_
()
,
remoteIpAddr_
()
,
localAudioDataPort_
(
0
)
,
localAudioDataPort_
(
0
)
,
localAudioControlPort_
(
0
)
,
localAudioControlPort_
(
0
)
...
@@ -342,8 +341,9 @@ Sdp::setMediaDescriptorLines(bool audio)
...
@@ -342,8 +341,9 @@ Sdp::setMediaDescriptorLines(bool audio)
void
Sdp
::
addRTCPAttribute
(
pjmedia_sdp_media
*
med
)
void
Sdp
::
addRTCPAttribute
(
pjmedia_sdp_media
*
med
)
{
{
auto
ip
=
ip_utils
::
strToAddr
(
publishedIpAddr_
);
pj_sockaddr
outputAddr
;
pj_sockaddr
outputAddr
;
pj_sockaddr_cp
(
&
outputAddr
,
&
p
ublishedIpAddr_
);
pj_sockaddr_cp
(
&
outputAddr
,
&
i
p
);
pj_sockaddr_set_port
(
&
outputAddr
,
localAudioControlPort_
);
pj_sockaddr_set_port
(
&
outputAddr
,
localAudioControlPort_
);
pjmedia_sdp_attr
*
attr
=
pjmedia_sdp_attr_create_rtcp
(
memPool_
,
&
outputAddr
);
pjmedia_sdp_attr
*
attr
=
pjmedia_sdp_attr_create_rtcp
(
memPool_
,
&
outputAddr
);
if
(
attr
)
if
(
attr
)
...
@@ -351,29 +351,28 @@ void Sdp::addRTCPAttribute(pjmedia_sdp_media *med)
...
@@ -351,29 +351,28 @@ void Sdp::addRTCPAttribute(pjmedia_sdp_media *med)
}
}
void
void
Sdp
::
setPublishedIP
(
const
std
::
string
&
ip_
addr
)
Sdp
::
setPublishedIP
(
const
std
::
string
&
addr
,
pj_uint16_t
addr_type
)
{
{
setPublishedIP
(
ip_utils
::
strToAddr
(
ip_addr
));
publishedIpAddr_
=
addr
;
}
publishedIpAddrType_
=
addr_type
;
void
Sdp
::
setPublishedIP
(
const
pj_sockaddr
&
ip_addr
)
{
publishedIpAddr_
=
ip_addr
;
publishedIpAddrStr_
=
ip_utils
::
addrToStr
(
publishedIpAddr_
);
if
(
localSession_
)
{
if
(
localSession_
)
{
if
(
publishedIpAddr_
.
addr
.
sa_family
==
pj_AF_INET6
())
if
(
addr_type
==
pj_AF_INET6
())
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP6"
);
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP6"
);
else
else
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP4"
);
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP4"
);
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
publishedIpAddr
Str
_
.
c_str
());
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
publishedIpAddr_
.
c_str
());
localSession_
->
conn
->
addr
=
localSession_
->
origin
.
addr
;
localSession_
->
conn
->
addr
=
localSession_
->
origin
.
addr
;
if
(
pjmedia_sdp_validate
(
localSession_
)
!=
PJ_SUCCESS
)
if
(
pjmedia_sdp_validate
(
localSession_
)
!=
PJ_SUCCESS
)
ERROR
(
"Could not validate SDP"
);
ERROR
(
"Could not validate SDP"
);
}
}
}
}
void
Sdp
::
setPublishedIP
(
const
pj_sockaddr
&
ip_addr
)
{
setPublishedIP
(
ip_utils
::
addrToStr
(
ip_addr
),
ip_addr
.
addr
.
sa_family
);
}
void
void
Sdp
::
updatePorts
(
const
std
::
vector
<
pj_sockaddr
>
&
sockets
)
Sdp
::
updatePorts
(
const
std
::
vector
<
pj_sockaddr
>
&
sockets
)
{
{
...
@@ -474,11 +473,11 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector
...
@@ -474,11 +473,11 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector
// Use Network Time Protocol format timestamp to ensure uniqueness.
// Use Network Time Protocol format timestamp to ensure uniqueness.
localSession_
->
origin
.
id
=
tv
.
sec
+
2208988800UL
;
localSession_
->
origin
.
id
=
tv
.
sec
+
2208988800UL
;
localSession_
->
origin
.
net_type
=
pj_str
((
char
*
)
"IN"
);
localSession_
->
origin
.
net_type
=
pj_str
((
char
*
)
"IN"
);
if
(
publishedIpAddr
_
.
addr
.
sa_family
==
pj_AF_INET6
())
if
(
publishedIpAddr
Type_
==
pj_AF_INET6
())
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP6"
);
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP6"
);
else
else
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP4"
);
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP4"
);
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
publishedIpAddr
Str
_
.
c_str
());
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
publishedIpAddr_
.
c_str
());
localSession_
->
name
=
pj_str
((
char
*
)
PACKAGE
);
localSession_
->
name
=
pj_str
((
char
*
)
PACKAGE
);
...
...
This diff is collapsed.
Click to expand it.
daemon/src/sip/sdp.h
+
11
−
5
View file @
0289ba68
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include
"global.h"
#include
"global.h"
#include
"noncopyable.h"
#include
"noncopyable.h"
#include
"ip_utils.h"
#include
<pjmedia/sdp.h>
#include
<pjmedia/sdp.h>
#include
<pjmedia/sdp_neg.h>
#include
<pjmedia/sdp_neg.h>
...
@@ -154,13 +155,17 @@ class Sdp {
...
@@ -154,13 +155,17 @@ class Sdp {
/*
/*
* Write accessor. Set the local IP address that will be used in the sdp session
* Write accessor. Set the local IP address that will be used in the sdp session
*/
*/
void
setPublishedIP
(
const
std
::
string
&
ip_
addr
);
void
setPublishedIP
(
const
std
::
string
&
addr
,
pj_uint16_t
addr_type
=
pj_AF_UNSPEC
()
);
void
setPublishedIP
(
const
pj_sockaddr
&
ip_
addr
);
void
setPublishedIP
(
const
pj_sockaddr
&
addr
);
/*
/*
* Read accessor. Get the local IP address
* Read accessor. Get the local IP address
*/
*/
pj_sockaddr
getPublishedIP
()
const
{
pj_sockaddr
getPublishedIPAddr
()
const
{
return
ip_utils
::
strToAddr
(
publishedIpAddr_
);
}
std
::
string
getPublishedIP
()
const
{
return
publishedIpAddr_
;
return
publishedIpAddr_
;
}
}
...
@@ -311,8 +316,9 @@ class Sdp {
...
@@ -311,8 +316,9 @@ class Sdp {
std
::
vector
<
sfl
::
AudioCodec
*>
sessionAudioMedia_
;
std
::
vector
<
sfl
::
AudioCodec
*>
sessionAudioMedia_
;
std
::
vector
<
std
::
string
>
sessionVideoMedia_
;
std
::
vector
<
std
::
string
>
sessionVideoMedia_
;
pj_sockaddr
publishedIpAddr_
;
std
::
string
publishedIpAddr_
;
std
::
string
publishedIpAddrStr_
;
pj_uint16_t
publishedIpAddrType_
;
std
::
string
remoteIpAddr_
;
std
::
string
remoteIpAddr_
;
int
localAudioDataPort_
;
int
localAudioDataPort_
;
...
...
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