Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
fa33b302
提交
fa33b302
authored
3月 03, 2017
作者:
Anthony Minessale
提交者:
Mike Jerris
3月 07, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10088: [freeswitch-core] Backports #resolve
上级
70f4c411
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
797 行增加
和
683 行删除
+797
-683
switch_rtp.h
src/include/switch_rtp.h
+38
-38
switch_types.h
src/include/switch_types.h
+3
-2
switch_core_media.c
src/switch_core_media.c
+57
-4
switch_jitterbuffer.c
src/switch_jitterbuffer.c
+67
-58
switch_rtp.c
src/switch_rtp.c
+632
-581
没有找到文件。
src/include/switch_rtp.h
浏览文件 @
fa33b302
src/include/switch_types.h
浏览文件 @
fa33b302
...
@@ -231,8 +231,8 @@ SWITCH_BEGIN_EXTERN_C
...
@@ -231,8 +231,8 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_MAX_TRANS 2000
#define SWITCH_MAX_TRANS 2000
#define SWITCH_CORE_SESSION_MAX_PRIVATES 2
#define SWITCH_CORE_SESSION_MAX_PRIVATES 2
#define SWITCH_DEFAULT_VIDEO_SIZE 1200
#define SWITCH_DEFAULT_VIDEO_SIZE 1200
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "
5
000"
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "
1
000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "
2
000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "
1
000"
#define MAX_FMTP_LEN 256
#define MAX_FMTP_LEN 256
...
@@ -773,6 +773,7 @@ typedef enum {
...
@@ -773,6 +773,7 @@ typedef enum {
SWITCH_RTP_FLAG_GEN_TS_DELTA
,
SWITCH_RTP_FLAG_GEN_TS_DELTA
,
SWITCH_RTP_FLAG_GEN_TS_MANUAL
,
SWITCH_RTP_FLAG_GEN_TS_MANUAL
,
SWITCH_RTP_FLAG_DETECT_SSRC
,
SWITCH_RTP_FLAG_DETECT_SSRC
,
SWITCH_RTP_FLAG_OLD_FIR
,
SWITCH_RTP_FLAG_INVALID
SWITCH_RTP_FLAG_INVALID
}
switch_rtp_flag_t
;
}
switch_rtp_flag_t
;
...
...
src/switch_core_media.c
浏览文件 @
fa33b302
...
@@ -3554,6 +3554,8 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
...
@@ -3554,6 +3554,8 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
if
(
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
&&
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_port
)
{
if
(
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
&&
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_port
)
{
char
tmp
[
80
]
=
""
;
char
tmp
[
80
]
=
""
;
const
char
*
media_varname
=
NULL
,
*
port_varname
=
NULL
;
engine
->
cur_payload_map
->
remote_sdp_ip
=
switch_core_session_strdup
(
smh
->
session
,
(
char
*
)
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
);
engine
->
cur_payload_map
->
remote_sdp_ip
=
switch_core_session_strdup
(
smh
->
session
,
(
char
*
)
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
smh
->
session
),
SWITCH_LOG_DEBUG
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
smh
->
session
),
SWITCH_LOG_DEBUG
,
"setting remote %s ice addr to index %d %s:%d based on candidate
\n
"
,
type2str
(
type
),
engine
->
ice_in
.
chosen
[
0
],
"setting remote %s ice addr to index %d %s:%d based on candidate
\n
"
,
type2str
(
type
),
engine
->
ice_in
.
chosen
[
0
],
...
@@ -3570,12 +3572,23 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
...
@@ -3570,12 +3572,23 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
smh
->
mparams
->
remote_ip
=
engine
->
cur_payload_map
->
remote_sdp_ip
;
smh
->
mparams
->
remote_ip
=
engine
->
cur_payload_map
->
remote_sdp_ip
;
}
}
if
(
engine
->
type
==
SWITCH_MEDIA_TYPE_VIDEO
)
{
media_varname
=
"remote_video_rtp_ip"
;
port_varname
=
"remote_video_rtp_port"
;
}
else
if
(
engine
->
type
==
SWITCH_MEDIA_TYPE_AUDIO
)
{
media_varname
=
"remote_audio_rtp_ip"
;
port_varname
=
"remote_audio_rtp_port"
;
}
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_port
);
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_port
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
SWITCH_REMOTE_MEDIA_IP_VARIABLE
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
media_varname
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
0
]][
0
].
con_addr
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
SWITCH_REMOTE_MEDIA_PORT_VARIABLE
,
tmp
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
port_varname
,
tmp
);
}
}
if
(
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
)
{
if
(
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
)
{
char
tmp
[
80
]
=
""
;
const
char
*
media_varname
=
NULL
,
*
port_varname
=
NULL
;
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
smh
->
session
),
SWITCH_LOG_DEBUG
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
smh
->
session
),
SWITCH_LOG_DEBUG
,
"Setting remote rtcp %s addr to %s:%d based on candidate
\n
"
,
type2str
(
type
),
"Setting remote rtcp %s addr to %s:%d based on candidate
\n
"
,
type2str
(
type
),
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_addr
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
);
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_addr
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
);
...
@@ -3583,6 +3596,20 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
...
@@ -3583,6 +3596,20 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
engine
->
remote_rtcp_ice_addr
=
switch_core_session_strdup
(
smh
->
session
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_addr
);
engine
->
remote_rtcp_ice_addr
=
switch_core_session_strdup
(
smh
->
session
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_addr
);
engine
->
remote_rtcp_port
=
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
;
engine
->
remote_rtcp_port
=
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
;
if
(
engine
->
type
==
SWITCH_MEDIA_TYPE_VIDEO
)
{
media_varname
=
"remote_video_rtcp_ip"
;
port_varname
=
"remote_video_rtcp_port"
;
}
else
if
(
engine
->
type
==
SWITCH_MEDIA_TYPE_AUDIO
)
{
media_varname
=
"remote_audio_rtcp_ip"
;
port_varname
=
"remote_audio_rtcp_port"
;
}
switch_snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_port
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
media_varname
,
engine
->
ice_in
.
cands
[
engine
->
ice_in
.
chosen
[
1
]][
1
].
con_addr
);
switch_channel_set_variable
(
smh
->
session
->
channel
,
port_varname
,
tmp
);
}
}
...
@@ -5094,6 +5121,32 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -5094,6 +5121,32 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
t38_done
:
t38_done
:
if
(
v_engine
->
rtp_session
)
{
if
(
v_engine
->
fir
)
{
switch_rtp_set_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_FIR
);
}
else
{
switch_rtp_clear_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_FIR
);
}
if
(
v_engine
->
pli
)
{
switch_rtp_set_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_PLI
);
}
else
{
switch_rtp_clear_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_PLI
);
}
if
(
v_engine
->
nack
)
{
switch_rtp_set_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_NACK
);
}
else
{
switch_rtp_clear_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_NACK
);
}
if
(
v_engine
->
tmmbr
)
{
switch_rtp_set_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_TMMBR
);
}
else
{
switch_rtp_clear_flag
(
v_engine
->
rtp_session
,
SWITCH_RTP_FLAG_TMMBR
);
}
}
if
(
parser
)
{
if
(
parser
)
{
sdp_parser_free
(
parser
);
sdp_parser_free
(
parser
);
}
}
...
...
src/switch_jitterbuffer.c
浏览文件 @
fa33b302
...
@@ -101,6 +101,8 @@ struct switch_jb_s {
...
@@ -101,6 +101,8 @@ struct switch_jb_s {
switch_jb_type_t
type
;
switch_jb_type_t
type
;
switch_core_session_t
*
session
;
switch_core_session_t
*
session
;
switch_channel_t
*
channel
;
switch_channel_t
*
channel
;
uint32_t
buffer_lag
;
uint32_t
flush
;
};
};
...
@@ -600,7 +602,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
...
@@ -600,7 +602,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
ts_diff
=
abs
((
int
)((
int64_t
)
ntohl
(
node
->
packet
.
header
.
ts
)
-
(
int64_t
)
ntohl
(
jb
->
highest_wrote_ts
)));
ts_diff
=
abs
((
int
)((
int64_t
)
ntohl
(
node
->
packet
.
header
.
ts
)
-
(
int64_t
)
ntohl
(
jb
->
highest_wrote_ts
)));
}
}
if
(((
seq_diff
>=
jb
->
max_frame_len
)
||
(
ts_diff
>
(
900000
*
5
))))
{
if
(((
seq_diff
>=
100
)
||
(
ts_diff
>
(
900000
*
5
))))
{
jb_debug
(
jb
,
2
,
"CHANGE DETECTED, PUNT %u
\n
"
,
abs
(((
int
)
ntohs
(
packet
->
header
.
seq
)
-
ntohs
(
jb
->
highest_wrote_seq
))));
jb_debug
(
jb
,
2
,
"CHANGE DETECTED, PUNT %u
\n
"
,
abs
(((
int
)
ntohs
(
packet
->
header
.
seq
)
-
ntohs
(
jb
->
highest_wrote_seq
))));
switch_jb_reset
(
jb
);
switch_jb_reset
(
jb
);
}
}
...
@@ -622,7 +624,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
...
@@ -622,7 +624,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
jb
->
highest_wrote_ts
=
packet
->
header
.
ts
;
jb
->
highest_wrote_ts
=
packet
->
header
.
ts
;
}
}
}
else
{
}
else
{
if
(
jb
->
write_init
)
{
if
(
jb
->
write_init
||
jb
->
type
==
SJB_AUDIO
)
{
jb_debug
(
jb
,
2
,
"WRITE frame ts: %u complete=%u/%u n:%u
\n
"
,
ntohl
(
node
->
packet
.
header
.
ts
),
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb_debug
(
jb
,
2
,
"WRITE frame ts: %u complete=%u/%u n:%u
\n
"
,
ntohl
(
node
->
packet
.
header
.
ts
),
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb
->
complete_frames
++
;
jb
->
complete_frames
++
;
}
else
{
}
else
{
...
@@ -830,7 +832,7 @@ SWITCH_DECLARE(void) switch_jb_clear_flag(switch_jb_t *jb, switch_jb_flag_t flag
...
@@ -830,7 +832,7 @@ SWITCH_DECLARE(void) switch_jb_clear_flag(switch_jb_t *jb, switch_jb_flag_t flag
SWITCH_DECLARE
(
int
)
switch_jb_poll
(
switch_jb_t
*
jb
)
SWITCH_DECLARE
(
int
)
switch_jb_poll
(
switch_jb_t
*
jb
)
{
{
return
(
jb
->
complete_frames
>=
jb
->
frame_len
);
return
(
jb
->
complete_frames
>=
jb
->
frame_len
)
||
jb
->
flush
;
}
}
SWITCH_DECLARE
(
int
)
switch_jb_frame_count
(
switch_jb_t
*
jb
)
SWITCH_DECLARE
(
int
)
switch_jb_frame_count
(
switch_jb_t
*
jb
)
...
@@ -1203,13 +1205,19 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
...
@@ -1203,13 +1205,19 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
switch_mutex_lock
(
jb
->
mutex
);
switch_mutex_lock
(
jb
->
mutex
);
if
(
jb
->
complete_frames
==
0
)
{
if
(
jb
->
complete_frames
==
0
)
{
jb
->
flush
=
0
;
switch_goto_status
(
SWITCH_STATUS_BREAK
,
end
);
switch_goto_status
(
SWITCH_STATUS_BREAK
,
end
);
}
}
if
(
jb
->
complete_frames
<
jb
->
frame_len
)
{
if
(
jb
->
complete_frames
<
jb
->
frame_len
)
{
switch_jb_poll
(
jb
);
if
(
!
jb
->
flush
)
{
jb_debug
(
jb
,
2
,
"BUFFERING %u/%u
\n
"
,
jb
->
complete_frames
,
jb
->
frame_len
);
jb_debug
(
jb
,
2
,
"BUFFERING %u/%u
\n
"
,
jb
->
complete_frames
,
jb
->
frame_len
);
switch_goto_status
(
SWITCH_STATUS_MORE_DATA
,
end
);
switch_goto_status
(
SWITCH_STATUS_MORE_DATA
,
end
);
}
}
}
jb_debug
(
jb
,
2
,
"GET PACKET %u/%u n:%d
\n
"
,
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb_debug
(
jb
,
2
,
"GET PACKET %u/%u n:%d
\n
"
,
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
...
@@ -1254,9 +1262,9 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
...
@@ -1254,9 +1262,9 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
}
}
}
}
}
}
}
}
jb
->
period_miss_pct
=
((
double
)
jb
->
period_miss_count
/
jb
->
period_count
)
*
100
;
jb
->
period_miss_pct
=
((
double
)
jb
->
period_miss_count
/
jb
->
period_count
)
*
100
;
if
(
jb
->
period_miss_pct
>
60
.
0
f
)
{
if
(
jb
->
period_miss_pct
>
60
.
0
f
)
{
...
@@ -1272,7 +1280,8 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
...
@@ -1272,7 +1280,8 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
jb
->
highest_read_seq
=
node
->
packet
.
header
.
seq
;
jb
->
highest_read_seq
=
node
->
packet
.
header
.
seq
;
}
}
if
(
jb
->
read_init
&&
htons
(
node
->
packet
.
header
.
seq
)
>=
htons
(
jb
->
highest_read_seq
)
&&
(
ntohl
(
node
->
packet
.
header
.
ts
)
>
ntohl
(
jb
->
highest_read_ts
)))
{
if
(
jb
->
type
==
SJB_AUDIO
||
(
jb
->
read_init
&&
htons
(
node
->
packet
.
header
.
seq
)
>=
htons
(
jb
->
highest_read_seq
)
&&
(
ntohl
(
node
->
packet
.
header
.
ts
)
>
ntohl
(
jb
->
highest_read_ts
))))
{
jb
->
complete_frames
--
;
jb
->
complete_frames
--
;
jb_debug
(
jb
,
2
,
"READ frame ts: %u complete=%u/%u n:%u
\n
"
,
ntohl
(
node
->
packet
.
header
.
ts
),
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb_debug
(
jb
,
2
,
"READ frame ts: %u complete=%u/%u n:%u
\n
"
,
ntohl
(
node
->
packet
.
header
.
ts
),
jb
->
complete_frames
,
jb
->
frame_len
,
jb
->
visible_nodes
);
jb
->
highest_read_ts
=
node
->
packet
.
header
.
ts
;
jb
->
highest_read_ts
=
node
->
packet
.
header
.
ts
;
...
...
src/switch_rtp.c
浏览文件 @
fa33b302
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论