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
bec1a6ce
Commit
bec1a6ce
authored
Feb 07, 2008
by
Emmanuel Milou
Browse files
SIP codecs negociation with user choices
parent
3e65410e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/audio/codecDescriptor.cpp
View file @
bec1a6ce
...
@@ -68,19 +68,15 @@ CodecDescriptor::getCodecName(CodecType payload)
...
@@ -68,19 +68,15 @@ CodecDescriptor::getCodecName(CodecType payload)
}
}
bool
bool
CodecDescriptor
::
is
Supported
(
CodecType
payload
)
CodecDescriptor
::
is
Active
(
CodecType
payload
)
{
{
CodecMap
::
iterator
iter
=
_codecMap
.
begin
();
int
i
;
while
(
iter
!=
_codecMap
.
end
())
{
for
(
i
=
0
;
i
<
_codecOrder
.
size
()
;
i
++
)
if
(
iter
->
first
==
payload
)
{
{
// codec is already in the map --> nothing to do
if
(
_codecOrder
[
i
]
==
payload
)
_debug
(
"Codec with payload %i already in the map
\n
"
,
payload
);
return
true
;
//break;
return
true
;
}
iter
++
;
}
}
return
false
;
return
false
;
}
}
void
void
...
...
src/audio/codecDescriptor.h
View file @
bec1a6ce
...
@@ -91,7 +91,7 @@ public:
...
@@ -91,7 +91,7 @@ public:
* @return true if the codec specified is supported
* @return true if the codec specified is supported
* false otherwise
* false otherwise
*/
*/
bool
is
Supported
(
CodecType
payload
);
bool
is
Active
(
CodecType
payload
);
/**
/**
* Remove the codec with payload payload from the list
* Remove the codec with payload payload from the list
...
...
src/sipcall.cpp
View file @
bec1a6ce
...
@@ -353,17 +353,18 @@ SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
...
@@ -353,17 +353,18 @@ SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
remote_med_m_payloads
=
&
(
remote_med
->
m_payloads
);
remote_med_m_payloads
=
&
(
remote_med
->
m_payloads
);
#endif
#endif
while
(
!
osip_list_eol
(
remote_med_m_payloads
,
iPayload
)
&&
iPayload
<
2
)
{
//while (!osip_list_eol(remote_med_m_payloads, iPayload) && iPayload < 2) {
while
(
!
osip_list_eol
(
remote_med_m_payloads
,
iPayload
))
{
tmp
=
(
char
*
)
osip_list_get
(
remote_med_m_payloads
,
iPayload
);
tmp
=
(
char
*
)
osip_list_get
(
remote_med_m_payloads
,
iPayload
);
if
(
tmp
!=
NULL
)
{
if
(
tmp
!=
NULL
)
{
int
payload
=
atoi
(
tmp
);
int
payload
=
atoi
(
tmp
);
_debug
(
"remote payload = %s
\n
"
,
tmp
);
_debug
(
"remote payload = %s
\n
"
,
tmp
);
CodecType
audiocodec
=
(
CodecType
)
payload
;
CodecType
audiocodec
=
(
CodecType
)
payload
;
//
if (audiocodec !=
NULL && audio
codec
->
isActive(
)) {
if
(
audiocodec
!=
(
CodecType
)
-
1
&&
_
codec
Map
.
isActive
(
audiocodec
))
{
if
(
audiocodec
!=
(
CodecType
)
-
1
&&
_codecMap
.
isSupported
(
audiocodec
))
{
_debug
(
"PAYLOAD = %i"
,
payload
);
listCodec
<<
payload
<<
" "
;
listCodec
<<
payload
<<
" "
;
//listRtpMap << "a=rtpmap:" << payload << " " << audiocodec->getCodecName() << "/" << audiocodec->getClockRate();
//listRtpMap << "a=rtpmap:" << payload << " " << audiocodec->getCodecName() << "/" << audiocodec->getClockRate();
listRtpMap
<<
"a=rtpmap:"
<<
payload
<<
" "
<<
_codecMap
.
getCodecName
(
audiocodec
)
<<
"/"
<<
8000
;
listRtpMap
<<
"a=rtpmap:"
<<
payload
<<
" "
<<
_codecMap
.
getCodecName
(
audiocodec
)
<<
"/"
<<
_codecMap
.
getSampleRate
(
audiocodec
)
;
// TODO: manage a way to get the channel infos
// TODO: manage a way to get the channel infos
/*if ( audiocodec->getChannel() != 1) {
/*if ( audiocodec->getChannel() != 1) {
listRtpMap << "/" << audiocodec->getChannel();
listRtpMap << "/" << audiocodec->getChannel();
...
@@ -586,7 +587,7 @@ SIPCall::setAudioCodecFromSDP(sdp_media_t* remote_med, int tid)
...
@@ -586,7 +587,7 @@ SIPCall::setAudioCodecFromSDP(sdp_media_t* remote_med, int tid)
if
(
tmp
!=
NULL
)
{
if
(
tmp
!=
NULL
)
{
int
payload
=
atoi
(
tmp
);
int
payload
=
atoi
(
tmp
);
// stop if we find a correct codec
// stop if we find a correct codec
if
(
_codecMap
.
is
Supported
((
CodecType
)
payload
)){
if
(
_codecMap
.
is
Active
((
CodecType
)
payload
)){
break
;
break
;
}
}
}
}
...
...
src/sipvoiplink.cpp
View file @
bec1a6ce
...
@@ -943,32 +943,32 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject)
...
@@ -943,32 +943,32 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject)
std
::
ostringstream
media_audio
;
std
::
ostringstream
media_audio
;
std
::
ostringstream
rtpmap_attr
;
std
::
ostringstream
rtpmap_attr
;
int
payload
;
CodecType
payload
;
int
nbChannel
;
int
nbChannel
;
int
iter
;
// Set rtpmap according to the supported codec order
// Set rtpmap according to the supported codec order
CodecMap
map
=
call
->
getCodecMap
().
getCodecMap
();
//CodecMap map = call->getCodecMap().getCodecMap();
//CodecMap map = Manager::instance().getCodecDescriptorMap();
CodecOrder
map
=
call
->
getCodecMap
().
getActiveCodecs
();
CodecMap
::
iterator
iter
=
map
.
begin
();
for
(
iter
=
0
;
iter
<
map
.
size
()
;
iter
++
){
while
(
iter
!=
map
.
end
())
{
if
(
map
[
iter
]
!=
-
1
){
//if (iter->second!=0 && iter->second->isActive()) {
payload
=
map
[
iter
];
if
(
iter
->
first
!=
-
1
){
// add each payload in the list of payload
payload
=
iter
->
first
;
media_audio
<<
payload
<<
" "
;
// add each payload in the list of payload
media_audio
<<
payload
<<
" "
;
rtpmap_attr
<<
"a=rtpmap:"
<<
payload
<<
" "
<<
call
->
getCodecMap
().
getCodecName
(
payload
)
<<
"/"
<<
call
->
getCodecMap
().
getSampleRate
(
payload
);
rtpmap_attr
<<
"a=rtpmap:"
<<
payload
<<
" "
<<
iter
->
second
.
data
()
<<
"/"
<<
call
->
getCodecMap
().
getSampleRate
(
iter
->
first
);
//TODO add channel infos
/*nbChannel = iter->second->getChannel();
/*nbChannel = iter->second->getChannel();
if (nbChannel!=1) {
if (nbChannel!=1) {
rtpmap_attr << "/" << nbChannel;
rtpmap_attr << "/" << nbChannel;
}*/
}*/
rtpmap_attr
<<
"
\r\n
"
;
rtpmap_attr
<<
"
\r\n
"
;
}
}
// go to next codec
// go to next codec
iter
++
;
//*
iter++;
}
}
// http://www.antisip.com/documentation/eXosip2/group__howto1__initialize.html
// http://www.antisip.com/documentation/eXosip2/group__howto1__initialize.html
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment