Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2f2e2922
提交
2f2e2922
authored
8月 24, 2015
作者:
Michael Jerris
提交者:
Anthony Minessale
8月 24, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8031: [dtls] Fix delayed DTLS media due to changing ICE candidates
上级
c321261f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
35 行删除
+33
-35
switch_rtp.c
src/switch_rtp.c
+33
-35
没有找到文件。
src/switch_rtp.c
浏览文件 @
2f2e2922
...
...
@@ -373,6 +373,7 @@ struct switch_rtp {
char
*
local_host_str
;
char
*
remote_host_str
;
char
*
eff_remote_host_str
;
switch_time_t
first_stun
;
switch_time_t
last_stun
;
uint32_t
samples_per_interval
;
uint32_t
samples_per_second
;
...
...
@@ -844,7 +845,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
uint32_t
*
pri
=
NULL
;
int
is_rtcp
=
ice
==
&
rtp_session
->
rtcp_ice
;
uint32_t
elapsed
;
switch_time_t
ref_point
;
//if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
// switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF OK %s CALL\n", rtp_type(rtp_session));
//}
...
...
@@ -875,15 +877,22 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
}
if
(
!
rtp_session
->
last_stun
)
{
elapsed
=
0
;
}
else
{
elapsed
=
(
unsigned
int
)
((
switch_micro_time_now
()
-
rtp_session
->
last_stun
)
/
1000
)
;
rtp_session
->
last_stun
=
switch_micro_time_now
();
if
(
!
rtp_session
->
first_stun
)
{
rtp_session
->
first_stun
=
rtp_session
->
last_stun
;
}
if
(
ice
->
last_ok
)
{
ref_point
=
ice
->
last_ok
;
}
else
{
ref_point
=
rtp_session
->
first_stun
;
}
elapsed
=
(
unsigned
int
)
((
switch_micro_time_now
()
-
ref_point
)
/
1000
);
end_buf
=
buf
+
((
sizeof
(
buf
)
>
packet
->
header
.
length
)
?
packet
->
header
.
length
:
sizeof
(
buf
));
rtp_session
->
last_stun
=
switch_micro_time_now
(
);
end_buf
=
buf
+
((
sizeof
(
buf
)
>
packet
->
header
.
length
)
?
packet
->
header
.
length
:
sizeof
(
buf
)
);
switch_stun_packet_first_attribute
(
packet
,
attr
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG8
,
"STUN PACKET TYPE: %s
\n
"
,
...
...
@@ -1130,7 +1139,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
char
ipbuf
[
25
];
switch_sockaddr_t
*
from_addr
=
rtp_session
->
from_addr
;
switch_socket_t
*
sock_output
=
rtp_session
->
sock_output
;
uint8_t
hosts_set
=
0
;
uint8_t
do_adj
=
0
;
switch_time_t
now
=
switch_micro_time_now
();
if
(
is_rtcp
)
{
...
...
@@ -1152,53 +1161,40 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
remote_ip
=
switch_get_addr
(
ipbuf
,
sizeof
(
ipbuf
),
from_addr
);
switch_stun_packet_attribute_add_xor_binded_address
(
rpacket
,
(
char
*
)
remote_ip
,
switch_sockaddr_get_port
(
from_addr
));
if
(
switch_cmp_addr
(
from_addr
,
ice
->
addr
))
{
ice
->
last_ok
=
now
;
}
else
{
if
(
!
ice
->
last_ok
||
(
now
-
ice
->
last_ok
)
>
3000000
)
{
hosts_set
++
;
host
=
switch_get_addr
(
buf
,
sizeof
(
buf
),
from_addr
);
port
=
switch_sockaddr_get_port
(
from_addr
);
host2
=
switch_get_addr
(
buf2
,
sizeof
(
buf2
),
ice
->
addr
);
port2
=
switch_sockaddr_get_port
(
ice
->
addr
);
}
}
if
((
ice
->
type
&
ICE_VANILLA
))
{
switch_stun_packet_attribute_add_integrity
(
rpacket
,
ice
->
pass
);
switch_stun_packet_attribute_add_fingerprint
(
rpacket
);
}
if
(
hosts_set
)
{
//switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_NOTICE
,
"Auto Changing %s stun/%s/dtls port from %s:%u to %s:%u
\n
"
,
rtp_type
(
rtp_session
),
is_rtcp
?
"rtcp"
:
"rtp"
,
host2
,
port2
,
host
,
port
);
bytes
=
switch_stun_packet_length
(
rpacket
);
switch_rtp_change_ice_dest
(
rtp_session
,
ice
,
host
,
port
);
host
=
switch_get_addr
(
buf
,
sizeof
(
buf
),
from_addr
);
port
=
switch_sockaddr_get_port
(
from_addr
);
host2
=
switch_get_addr
(
buf2
,
sizeof
(
buf2
),
ice
->
addr
);
port2
=
switch_sockaddr_get_port
(
ice
->
addr
);
if
(
switch_cmp_addr
(
from_addr
,
ice
->
addr
))
{
ice
->
last_ok
=
now
;
}
else
{
if
(
elapsed
>=
3000
||
(
elapsed
>=
500
&&
(
rtp_session
->
dtls
->
state
!=
DS_READY
||
!
ice
->
ready
||
!
ice
->
rready
)))
{
do_adj
++
;
}
}
bytes
=
switch_stun_packet_length
(
rpacket
);
if
(
!
ice
->
rready
&&
(
ice
->
type
&
ICE_VANILLA
)
&&
ice
->
ice_params
&&
hosts_set
&&
!
switch_cmp_addr
(
from_addr
,
ice
->
addr
)
)
{
if
(
(
ice
->
type
&
ICE_VANILLA
)
&&
ice
->
ice_params
&&
do_adj
)
{
int
i
=
0
;
ice
->
missed_count
=
0
;
ice
->
rready
=
1
;
for
(
i
=
0
;
i
<=
ice
->
ice_params
->
cand_idx
[
ice
->
proto
];
i
++
)
{
if
(
ice
->
ice_params
->
cands
[
i
][
ice
->
proto
].
con_port
==
port
)
{
if
(
!
strcmp
(
ice
->
ice_params
->
cands
[
i
][
ice
->
proto
].
con_addr
,
host
)
&&
!
strcmp
(
ice
->
ice_params
->
cands
[
i
][
ice
->
proto
].
cand_type
,
"relay"
))
{
if
(
rtp_session
->
last_stun
&&
elapsed
<
5
000
)
{
if
(
elapsed
<
1
000
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_WARNING
,
"Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u
\n
"
,
is_rtcp
?
"rtcp"
:
"rtp"
,
host2
,
port2
,
...
...
@@ -1218,6 +1214,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
host
,
port
);
switch_rtp_change_ice_dest
(
rtp_session
,
ice
,
host
,
port
);
ice
->
last_ok
=
now
;
}
switch_socket_sendto
(
sock_output
,
from_addr
,
0
,
(
void
*
)
rpacket
,
&
bytes
);
...
...
@@ -2686,6 +2683,7 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
rtp_session
->
ts
=
0
;
memset
(
&
rtp_session
->
ts_norm
,
0
,
sizeof
(
rtp_session
->
ts_norm
));
rtp_session
->
last_stun
=
rtp_session
->
first_stun
=
0
;
rtp_session
->
rtcp_sent_packets
=
0
;
rtp_session
->
rtcp_last_sent
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论