Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
63f3531c
提交
63f3531c
authored
12月 13, 2017
作者:
Anthony Minessale
提交者:
Muteesa Fred
7月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10843: [freeswitch-core] Tweak RTP write timing #resolve
上级
a17993a2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
21 行删除
+16
-21
switch_rtp.c
src/switch_rtp.c
+16
-21
没有找到文件。
src/switch_rtp.c
浏览文件 @
63f3531c
...
...
@@ -377,6 +377,7 @@ struct switch_rtp {
switch_rtp_invalid_handler_t
invalid_handler
;
void
*
private_data
;
uint32_t
ts
;
//uint32_t last_clock_ts;
uint32_t
last_write_ts
;
uint32_t
last_read_ts
;
uint32_t
last_cng_ts
;
...
...
@@ -1518,16 +1519,8 @@ static uint8_t get_next_write_ts(switch_rtp_t *rtp_session, uint32_t timestamp)
if
(
timestamp
)
{
rtp_session
->
ts
=
(
uint32_t
)
timestamp
;
changed
++
;
/* Send marker bit if timestamp is lower/same as before (resetted/new timer) */
if
(
abs
((
int32_t
)(
rtp_session
->
ts
-
rtp_session
->
last_write_ts
))
>
rtp_session
->
samples_per_interval
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_NEVER_SEND_MARKER
))
{
m
++
;
}
}
else
if
(
switch_rtp_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
))
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
if
(
rtp_session
->
last_write_ts
==
rtp_session
->
write_timer
.
samplecount
)
{
switch_core_timer_step
(
&
rtp_session
->
write_timer
);
}
switch_core_timer_next
(
&
rtp_session
->
write_timer
);
rtp_session
->
ts
=
rtp_session
->
write_timer
.
samplecount
;
changed
++
;
}
...
...
@@ -1535,6 +1528,12 @@ static uint8_t get_next_write_ts(switch_rtp_t *rtp_session, uint32_t timestamp)
if
(
!
changed
)
{
rtp_session
->
ts
=
rtp_session
->
last_write_ts
+
rtp_session
->
samples_per_interval
;
}
else
{
/* Send marker bit if timestamp is lower/same as before (resetted/new timer) */
if
(
abs
((
int32_t
)(
rtp_session
->
ts
-
rtp_session
->
last_write_ts
))
>
rtp_session
->
samples_per_interval
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_NEVER_SEND_MARKER
))
{
m
++
;
}
}
return
m
;
...
...
@@ -2020,10 +2019,6 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
int
rate
=
0
,
nack_ttl
=
0
;
uint32_t
cur_nack
[
MAX_NACK
]
=
{
0
};
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
}
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_UDPTL
]
&&
rtp_session
->
flags
[
SWITCH_RTP_FLAG_AUTO_CNG
]
&&
rtp_session
->
send_msg
.
header
.
ts
&&
...
...
@@ -4154,7 +4149,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_ses
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"RE-Starting timer [%s] %d bytes per %dms
\n
"
,
rtp_session
->
timer_name
,
samples_per_interval
,
ms_per_packet
/
1000
);
switch_core_timer_init
(
&
rtp_session
->
write_timer
,
rtp_session
->
timer_name
,
ms_per_packet
/
1000
,
samples_per_interval
,
rtp_session
->
pool
);
switch_core_timer_init
(
&
rtp_session
->
write_timer
,
rtp_session
->
timer_name
,
(
ms_per_packet
/
1000
)
,
samples_per_interval
,
rtp_session
->
pool
);
}
else
{
memset
(
&
rtp_session
->
timer
,
0
,
sizeof
(
rtp_session
->
timer
));
...
...
@@ -4279,7 +4274,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
if
(
switch_core_timer_init
(
&
rtp_session
->
timer
,
timer_name
,
ms_per_packet
/
1000
,
samples_per_interval
,
pool
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
rtp_session
->
session
),
SWITCH_LOG_DEBUG
,
"Starting timer [%s] %d bytes per %dms
\n
"
,
timer_name
,
samples_per_interval
,
ms_per_packet
/
1000
);
switch_core_timer_init
(
&
rtp_session
->
write_timer
,
timer_name
,
ms_per_packet
/
1000
,
samples_per_interval
,
pool
);
switch_core_timer_init
(
&
rtp_session
->
write_timer
,
timer_name
,
(
ms_per_packet
/
1000
)
,
samples_per_interval
,
pool
);
#ifdef DEBUG_TS_ROLLOVER
rtp_session
->
timer
.
tick
=
TS_ROLLOVER_START
/
samples_per_interval
;
#endif
...
...
@@ -5261,7 +5256,7 @@ static void do_2833(switch_rtp_t *rtp_session)
if
(
!
rtp_session
->
last_write_ts
)
{
if
(
rtp_session
->
timer
.
timer_interface
)
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
rtp_session
->
last_write_ts
=
rtp_session
->
write_timer
.
samplecount
;
}
else
{
rtp_session
->
last_write_ts
=
rtp_session
->
samples_per_interval
;
...
...
@@ -5312,7 +5307,7 @@ static void do_2833(switch_rtp_t *rtp_session)
rtp_session
->
need_mark
=
1
;
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
rtp_session
->
last_write_samplecount
=
rtp_session
->
write_timer
.
samplecount
;
}
...
...
@@ -5330,7 +5325,7 @@ static void do_2833(switch_rtp_t *rtp_session)
void
*
pop
;
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
if
(
rtp_session
->
write_timer
.
samplecount
<
rtp_session
->
next_write_samplecount
)
{
return
;
}
...
...
@@ -8002,7 +7997,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
WRITE_INC
(
rtp_session
);
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
}
if
(
send_msg
)
{
...
...
@@ -8056,7 +8051,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
}
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
]
&&
...
...
@@ -8502,7 +8497,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
}
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_core_timer_sync
(
&
rtp_session
->
write_timer
);
//
switch_core_timer_sync(&rtp_session->write_timer);
rtp_session
->
last_write_samplecount
=
rtp_session
->
write_timer
.
samplecount
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论