Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5658e581
提交
5658e581
authored
11月 02, 2017
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10770: [freeswitch-core] Make nack buffer bigger by default #resolve
上级
873a7bbd
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
44 行增加
和
6 行删除
+44
-6
switch_rtp.c
src/switch_rtp.c
+44
-6
没有找到文件。
src/switch_rtp.c
浏览文件 @
5658e581
...
@@ -312,6 +312,8 @@ typedef struct ts_normalize_s {
...
@@ -312,6 +312,8 @@ typedef struct ts_normalize_s {
int
last_external
;
int
last_external
;
}
ts_normalize_t
;
}
ts_normalize_t
;
#define MAX_NACKS 25
struct
switch_rtp
{
struct
switch_rtp
{
/*
/*
* Two sockets are needed because we might be transcoding protocol families
* Two sockets are needed because we might be transcoding protocol families
...
@@ -477,6 +479,10 @@ struct switch_rtp {
...
@@ -477,6 +479,10 @@ struct switch_rtp {
uint8_t
punts
;
uint8_t
punts
;
uint8_t
clean
;
uint8_t
clean
;
uint32_t
last_max_vb_frames
;
uint32_t
last_max_vb_frames
;
uint32_t
nack_buf
[
MAX_NACKS
];
int
nack_idx
;
#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
;
...
@@ -6254,6 +6260,21 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -6254,6 +6260,21 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
return
status
;
return
status
;
}
}
char
*
pBin
(
long
int
x
,
char
*
so
,
int
width
)
{
char
s
[
width
+
1
];
int
i
=
width
;
s
[
i
--
]
=
0x00
;
// terminate string
do
{
// fill in array from right to left
s
[
i
--
]
=
(
x
&
1
)
?
'1'
:
'0'
;
// determine bit
x
>>=
1
;
// shift right 1 bit
}
while
(
x
>
0
);
i
++
;
// point to last valid character
sprintf
(
so
,
"%s"
,
s
+
i
);
// stick it in the temp string string
return
so
;
}
static
void
handle_nack
(
switch_rtp_t
*
rtp_session
,
uint32_t
nack
)
static
void
handle_nack
(
switch_rtp_t
*
rtp_session
,
uint32_t
nack
)
{
{
switch_size_t
bytes
=
0
;
switch_size_t
bytes
=
0
;
...
@@ -6265,7 +6286,8 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
...
@@ -6265,7 +6286,8 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
const
char
*
old_host
=
NULL
;
const
char
*
old_host
=
NULL
;
const
char
*
my_host
=
NULL
;
const
char
*
my_host
=
NULL
;
char
bufa
[
50
],
bufb
[
50
],
bufc
[
50
];
char
bufa
[
50
],
bufb
[
50
],
bufc
[
50
];
char
foo
[
64
]
=
""
;
if
(
!
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_NACK
]
&&
rtp_session
->
vbw
))
{
if
(
!
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_NACK
]
&&
rtp_session
->
vbw
))
{
return
;
/* not enabled */
return
;
/* not enabled */
}
}
...
@@ -6276,8 +6298,8 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
...
@@ -6276,8 +6298,8 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
my_host
=
switch_get_addr
(
bufc
,
sizeof
(
bufc
),
rtp_session
->
local_addr
);
my_host
=
switch_get_addr
(
bufc
,
sizeof
(
bufc
),
rtp_session
->
local_addr
);
}
}
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG1
,
"%s Got NACK [%u][0x%x] for seq %u
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG1
,
"%s Got NACK [%u][0x%x] for seq %u
bits [%s]
\n
"
,
switch_core_session_get_name
(
rtp_session
->
session
),
nack
,
nack
,
ntohs
(
seq
));
switch_core_session_get_name
(
rtp_session
->
session
),
nack
,
nack
,
ntohs
(
seq
)
,
pBin
(
nack
,
foo
,
sizeof
(
foo
))
);
if
(
switch_jb_get_packet_by_seq
(
rtp_session
->
vbw
,
seq
,
(
switch_rtp_packet_t
*
)
send_msg
,
&
bytes
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_jb_get_packet_by_seq
(
rtp_session
->
vbw
,
seq
,
(
switch_rtp_packet_t
*
)
send_msg
,
&
bytes
)
==
SWITCH_STATUS_SUCCESS
)
{
...
@@ -6380,7 +6402,12 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
...
@@ -6380,7 +6402,12 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
for
(
i
=
0
;
i
<
ntohs
(
extp
->
header
.
length
)
-
2
;
i
++
)
{
for
(
i
=
0
;
i
<
ntohs
(
extp
->
header
.
length
)
-
2
;
i
++
)
{
handle_nack
(
rtp_session
,
*
nack
);
//handle_nack(rtp_session, *nack);
switch_mutex_lock
(
rtp_session
->
flag_mutex
);
if
(
rtp_session
->
nack_idx
<
MAX_NACKS
)
{
rtp_session
->
nack_buf
[
rtp_session
->
nack_idx
++
]
=
*
nack
;
}
switch_mutex_unlock
(
rtp_session
->
flag_mutex
);
nack
++
;
nack
++
;
}
}
...
@@ -8313,7 +8340,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
...
@@ -8313,7 +8340,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
rtp_session
->
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
rtp_session
->
session
);
if
(
!
rtp_session
->
vbw
)
{
if
(
!
rtp_session
->
vbw
)
{
int
nack_size
=
100
;
int
nack_size
=
100
0
;
const
char
*
var
;
const
char
*
var
;
if
((
var
=
switch_channel_get_variable
(
channel
,
"rtp_nack_buffer_size"
)))
{
if
((
var
=
switch_channel_get_variable
(
channel
,
"rtp_nack_buffer_size"
)))
{
...
@@ -8492,6 +8519,17 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
...
@@ -8492,6 +8519,17 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
return
0
;
return
0
;
}
}
switch_mutex_lock
(
rtp_session
->
flag_mutex
);
if
(
rtp_session
->
nack_idx
)
{
int
i
=
0
;
for
(
i
=
0
;
i
<
rtp_session
->
nack_idx
;
i
++
)
{
handle_nack
(
rtp_session
,
rtp_session
->
nack_buf
[
i
]);
}
rtp_session
->
nack_idx
=
0
;
}
switch_mutex_unlock
(
rtp_session
->
flag_mutex
);
//if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
//if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
// rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;
// rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;
// rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
// rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
...
@@ -8536,7 +8574,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
...
@@ -8536,7 +8574,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
old_host
=
switch_get_addr
(
bufb
,
sizeof
(
bufb
),
rtp_session
->
remote_addr
);
old_host
=
switch_get_addr
(
bufb
,
sizeof
(
bufb
),
rtp_session
->
remote_addr
);
my_host
=
switch_get_addr
(
bufc
,
sizeof
(
bufc
),
rtp_session
->
local_addr
);
my_host
=
switch_get_addr
(
bufc
,
sizeof
(
bufc
),
rtp_session
->
local_addr
);
printf
(
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG_CLEAN
(
rtp_session
->
session
),
SWITCH_LOG_CONSOLE
,
"W %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u seq=%u m=%d
\n
"
,
"W %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u seq=%u m=%d
\n
"
,
rtp_session
->
session
?
switch_channel_get_name
(
switch_core_session_get_channel
(
rtp_session
->
session
))
:
"NoName"
,
rtp_session
->
session
?
switch_channel_get_name
(
switch_core_session_get_channel
(
rtp_session
->
session
))
:
"NoName"
,
(
long
)
bytes
,
(
long
)
bytes
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论