Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
75b01a30
提交
75b01a30
authored
10月 04, 2015
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8130
上级
1b1326ca
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
64 行增加
和
17 行删除
+64
-17
switch_types.h
src/include/switch_types.h
+1
-0
mod_opus.c
src/mod/codecs/mod_opus/mod_opus.c
+2
-2
switch_rtp.c
src/switch_rtp.c
+61
-15
没有找到文件。
src/include/switch_types.h
浏览文件 @
75b01a30
...
@@ -1170,6 +1170,7 @@ typedef enum {
...
@@ -1170,6 +1170,7 @@ typedef enum {
SWITCH_STATUS_CONTINUE
,
SWITCH_STATUS_CONTINUE
,
SWITCH_STATUS_TERM
,
SWITCH_STATUS_TERM
,
SWITCH_STATUS_NOT_INITALIZED
,
SWITCH_STATUS_NOT_INITALIZED
,
SWITCH_STATUS_TOO_LATE
,
SWITCH_STATUS_XBREAK
=
35
,
SWITCH_STATUS_XBREAK
=
35
,
SWITCH_STATUS_WINBREAK
=
730035
SWITCH_STATUS_WINBREAK
=
730035
}
switch_status_t
;
}
switch_status_t
;
...
...
src/mod/codecs/mod_opus/mod_opus.c
浏览文件 @
75b01a30
...
@@ -949,9 +949,9 @@ static switch_status_t opus_load_config(switch_bool_t reload)
...
@@ -949,9 +949,9 @@ static switch_status_t opus_load_config(switch_bool_t reload)
memset
(
&
opus_prefs
,
0
,
sizeof
(
opus_prefs
));
memset
(
&
opus_prefs
,
0
,
sizeof
(
opus_prefs
));
opus_prefs
.
use_jb_lookahead
=
1
;
opus_prefs
.
use_jb_lookahead
=
1
;
opus_prefs
.
keep_fec
=
1
;
opus_prefs
.
keep_fec
=
1
;
opus_prefs
.
use_dtx
=
1
;
opus_prefs
.
use_dtx
=
0
;
opus_prefs
.
plpct
=
20
;
opus_prefs
.
plpct
=
20
;
opus_prefs
.
use_vbr
=
1
;
opus_prefs
.
use_vbr
=
0
;
opus_prefs
.
fec_decode
=
1
;
opus_prefs
.
fec_decode
=
1
;
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
...
...
src/switch_rtp.c
浏览文件 @
75b01a30
...
@@ -80,7 +80,7 @@ static const switch_payload_t INVALID_PT = 255;
...
@@ -80,7 +80,7 @@ static const switch_payload_t INVALID_PT = 255;
static switch_port_t START_PORT = RTP_START_PORT;
static switch_port_t START_PORT = RTP_START_PORT;
static switch_port_t END_PORT = RTP_END_PORT;
static switch_port_t END_PORT = RTP_END_PORT;
static switch_mutex_t *port_lock = NULL;
static switch_mutex_t *port_lock = NULL;
static
void
do_flush
(
switch_rtp_t
*
rtp_session
,
int
force
);
static
switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_t bytes_in
);
typedef srtp_hdr_t rtp_hdr_t;
typedef srtp_hdr_t rtp_hdr_t;
...
@@ -434,6 +434,7 @@ struct switch_rtp {
...
@@ -434,6 +434,7 @@ struct switch_rtp {
switch_core_session_t *session;
switch_core_session_t *session;
payload_map_t **pmaps;
payload_map_t **pmaps;
payload_map_t *pmap_tail;
payload_map_t *pmap_tail;
int ice_adj;
#ifdef ENABLE_ZRTP
#ifdef ENABLE_ZRTP
zrtp_session_t *zrtp_session;
zrtp_session_t *zrtp_session;
zrtp_profile_t *zrtp_profile;
zrtp_profile_t *zrtp_profile;
...
@@ -1184,9 +1185,12 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
...
@@ -1184,9 +1185,12 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
ice->last_ok = now;
ice->last_ok = now;
rtp_session->wrong_addrs = 0;
rtp_session->wrong_addrs = 0;
} else {
} else {
if
(((
rtp_session
->
dtls
&&
rtp_session
->
dtls
->
state
!=
DS_READY
)
||
!
ice
->
ready
||
!
ice
->
rready
)
&&
rtp_session
->
wrong_addrs
>
2
)
{
if (((rtp_session->dtls && rtp_session->dtls->state != DS_READY) || !ice->ready || !ice->rready) &&
rtp_session->wrong_addrs > 2 && rtp_session->ice_adj == 0) {
do_adj++;
do_adj++;
}
else
if
(
rtp_session
->
wrong_addrs
>
5
||
elapsed
>=
3000
)
{
rtp_session->ice_adj = 1;
rtp_session->wrong_addrs = 0;
} else if (rtp_session->wrong_addrs > 10 || elapsed >= 10000) {
do_adj++;
do_adj++;
}
}
...
@@ -2715,7 +2719,8 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
...
@@ -2715,7 +2719,8 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
rtp_session->wrong_addrs = 0;
rtp_session->wrong_addrs = 0;
rtp_session->rtcp_sent_packets = 0;
rtp_session->rtcp_sent_packets = 0;
rtp_session->rtcp_last_sent = 0;
rtp_session->rtcp_last_sent = 0;
rtp_session->ice_adj = 0;
//switch_rtp_del_dtls(rtp_session, DTLS_TYPE_RTP|DTLS_TYPE_RTCP);
//switch_rtp_del_dtls(rtp_session, DTLS_TYPE_RTP|DTLS_TYPE_RTCP);
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE);
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE);
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_MUTE);
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_MUTE);
...
@@ -4846,14 +4851,14 @@ static int jb_valid(switch_rtp_t *rtp_session)
...
@@ -4846,14 +4851,14 @@ static int jb_valid(switch_rtp_t *rtp_session)
}
}
static
void
do_flush
(
switch_rtp_t
*
rtp_session
,
int
force
)
static
switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_t bytes_in
)
{
{
int was_blocking = 0;
int was_blocking = 0;
switch_size_t bytes;
switch_size_t bytes;
uint32_t flushed = 0;
uint32_t flushed = 0;
if (!switch_rtp_ready(rtp_session)) {
if (!switch_rtp_ready(rtp_session)) {
return
;
return
0
;
}
}
reset_jitter_seq(rtp_session);
reset_jitter_seq(rtp_session);
...
@@ -4863,7 +4868,7 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
...
@@ -4863,7 +4868,7 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] ||
rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] ||
rtp_session->flags[SWITCH_RTP_FLAG_DTMF_ON]
rtp_session->flags[SWITCH_RTP_FLAG_DTMF_ON]
) {
) {
return
;
return
0
;
}
}
}
}
...
@@ -4872,7 +4877,8 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
...
@@ -4872,7 +4877,8 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
if (switch_rtp_ready(rtp_session) ) {
if (switch_rtp_ready(rtp_session) ) {
if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
switch_jb_reset
(
rtp_session
->
jb
);
//switch_jb_reset(rtp_session->jb);
return bytes_in;
}
}
//if (rtp_session->vb) {
//if (rtp_session->vb) {
...
@@ -4881,6 +4887,7 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
...
@@ -4881,6 +4887,7 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
if (rtp_session->vbw) {
if (rtp_session->vbw) {
switch_jb_reset(rtp_session->vbw);
switch_jb_reset(rtp_session->vbw);
//return bytes_in;
}
}
if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]) {
if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]) {
...
@@ -4937,6 +4944,8 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
...
@@ -4937,6 +4944,8 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
}
}
READ_DEC(rtp_session);
READ_DEC(rtp_session);
return 0;
}
}
static int check_recv_payload(switch_rtp_t *rtp_session)
static int check_recv_payload(switch_rtp_t *rtp_session)
...
@@ -4975,10 +4984,39 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -4975,10 +4984,39 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
int sync = 0;
int sync = 0;
switch_time_t now;
switch_time_t now;
switch_size_t xcheck_jitter = 0;
switch_size_t xcheck_jitter = 0;
int tries = 0;
int block = 0;
switch_assert(bytes);
switch_assert(bytes);
more:
more:
tries++;
if (tries > 20) {
return SWITCH_STATUS_BREAK;
}
if (block) {
int to = 20000;
int fdr = 0;
if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
to = 100000;
} else {
if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval) {
to = rtp_session->timer.interval * 1000;
}
}
switch_poll(rtp_session->read_pollfd, 1, &fdr, to);
if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval) {
switch_core_timer_sync(&rtp_session->timer);
}
block = 0;
}
*bytes = sizeof(rtp_msg_t);
*bytes = sizeof(rtp_msg_t);
sync = 0;
sync = 0;
...
@@ -5413,7 +5451,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5413,7 +5451,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (rtp_session->recv_msg.header.version == 2 && *bytes) {
if (rtp_session->recv_msg.header.version == 2 && *bytes) {
if (rtp_session->vb && jb_valid(rtp_session)) {
if (rtp_session->vb && jb_valid(rtp_session)) {
switch_jb_put_packet
(
rtp_session
->
vb
,
(
switch_rtp_packet_t
*
)
&
rtp_session
->
recv_msg
,
*
bytes
);
status = switch_jb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
if (status == SWITCH_STATUS_TOO_LATE) {
goto more;
}
status = SWITCH_STATUS_FALSE;
status = SWITCH_STATUS_FALSE;
*bytes = 0;
*bytes = 0;
...
@@ -5439,8 +5482,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5439,8 +5482,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
reset_jitter_seq(rtp_session);
reset_jitter_seq(rtp_session);
}
}
switch_jb_put_packet
(
rtp_session
->
jb
,
(
switch_rtp_packet_t
*
)
&
rtp_session
->
recv_msg
,
*
bytes
);
status = switch_jb_put_packet(rtp_session->jb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
if (status == SWITCH_STATUS_TOO_LATE) {
goto more;
}
status = SWITCH_STATUS_FALSE;
status = SWITCH_STATUS_FALSE;
*bytes = 0;
*bytes = 0;
...
@@ -5459,8 +5506,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -5459,8 +5506,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
switch(jstatus) {
switch(jstatus) {
case SWITCH_STATUS_MORE_DATA:
case SWITCH_STATUS_MORE_DATA:
status
=
SWITCH_STATUS_BREAK
;
block = 1
;
break
;
goto more
;
case SWITCH_STATUS_NOTFOUND:
case SWITCH_STATUS_NOTFOUND:
{
{
(*flags) |= SFF_PLC;
(*flags) |= SFF_PLC;
...
@@ -6351,8 +6398,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -6351,8 +6398,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
check = !bytes;
check = !bytes;
if (rtp_session->flags[SWITCH_RTP_FLAG_FLUSH]) {
if (rtp_session->flags[SWITCH_RTP_FLAG_FLUSH]) {
do_flush
(
rtp_session
,
SWITCH_FALSE
);
bytes = do_flush(rtp_session, SWITCH_FALSE, bytes);
bytes
=
0
;
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论