Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
66feec2d
提交
66feec2d
authored
2月 07, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
timer mojo
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@4149
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
068ced69
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
33 行增加
和
17 行删除
+33
-17
switch_core.h
src/include/switch_core.h
+2
-1
switch_module_interfaces.h
src/include/switch_module_interfaces.h
+1
-1
mod_softtimer.c
src/mod/timers/mod_softtimer/mod_softtimer.c
+24
-11
switch_core.c
src/switch_core.c
+2
-2
switch_rtp.c
src/switch_rtp.c
+4
-2
没有找到文件。
src/include/switch_core.h
浏览文件 @
66feec2d
...
...
@@ -905,9 +905,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_step(switch_timer_t *timer);
/*!
\brief Check if the current step has been exceeded
\param timer the timer to wait on
\param diff the remaining number of ms
\return the newest sample count
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_core_timer_check
(
switch_timer_t
*
timer
);
SWITCH_DECLARE
(
switch_status_t
)
switch_core_timer_check
(
switch_timer_t
*
timer
,
uint32_t
*
diff
);
/*!
\brief Destroy an allocated timer
...
...
src/include/switch_module_interfaces.h
浏览文件 @
66feec2d
...
...
@@ -245,7 +245,7 @@ struct switch_timer_interface {
/*! function to step the timer one step */
switch_status_t
(
*
timer_step
)(
switch_timer_t
*
);
/*! function to check if the current step has expired */
switch_status_t
(
*
timer_check
)(
switch_timer_t
*
);
switch_status_t
(
*
timer_check
)(
switch_timer_t
*
,
uint32_t
*
);
/*! function to deallocate the timer */
switch_status_t
(
*
timer_destroy
)(
switch_timer_t
*
);
const
struct
switch_timer_interface
*
next
;
...
...
src/mod/timers/mod_softtimer/mod_softtimer.c
浏览文件 @
66feec2d
...
...
@@ -78,8 +78,10 @@ static inline switch_status_t timer_step(switch_timer_t *timer)
{
timer_private_t
*
private_info
=
timer
->
private_info
;
private_info
->
reference
+=
timer
->
interval
;
while
(
private_info
->
reference
<=
TIMER_MATRIX
[
timer
->
interval
].
tick
)
{
private_info
->
reference
+=
timer
->
interval
;
}
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -87,28 +89,39 @@ static inline switch_status_t timer_step(switch_timer_t *timer)
static
inline
switch_status_t
timer_next
(
switch_timer_t
*
timer
)
{
timer_private_t
*
private_info
=
timer
->
private_info
;
timer_step
(
timer
);
while
(
TIMER_MATRIX
[
timer
->
interval
].
tick
<
private_info
->
reference
)
{
switch_yield
(
1000
);
uint64_t
diff
;
if
((
diff
=
(
private_info
->
reference
-
TIMER_MATRIX
[
timer
->
interval
].
tick
)))
{
switch_yield
(
diff
*
1000
);
}
}
timer
->
samplecount
+=
timer
->
samples
;
return
SWITCH_STATUS_SUCCESS
;
}
static
inline
switch_status_t
timer_check
(
switch_timer_t
*
timer
)
static
inline
switch_status_t
timer_check
(
switch_timer_t
*
timer
,
uint32_t
*
diff
)
{
timer_private_t
*
private_info
=
timer
->
private_info
;
switch_status_t
status
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
if
(
TIMER_MATRIX
[
timer
->
interval
].
tick
<
private_info
->
reference
)
{
status
=
SWITCH_STATUS_FALSE
;
uint64_t
_diff
=
private_info
->
reference
-
TIMER_MATRIX
[
timer
->
interval
].
tick
;
*
diff
=
(
uint32_t
)
_diff
;
}
else
{
private_info
->
reference
+=
timer
->
interval
;
status
=
SWITCH_STATUS_SUCCESS
;
*
diff
=
0
;
}
if
(
*
diff
)
{
status
=
SWITCH_STATUS_FALSE
;
}
else
{
timer_step
(
timer
);
}
return
status
;
}
...
...
@@ -159,8 +172,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
twice the granularity we need, we'll change it if we need anything smaller
*/
#define STEP_MS 1
0
#define STEP_MIC 1000
0
#define STEP_MS 1
#define STEP_MIC 1000
SWITCH_MOD_DECLARE
(
switch_status_t
)
switch_module_runtime
(
void
)
{
switch_time_t
reference
=
switch_time_now
();
...
...
src/switch_core.c
浏览文件 @
66feec2d
...
...
@@ -1321,14 +1321,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_step(switch_timer_t *timer)
return
timer
->
timer_interface
->
timer_step
(
timer
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_timer_check
(
switch_timer_t
*
timer
)
SWITCH_DECLARE
(
switch_status_t
)
switch_core_timer_check
(
switch_timer_t
*
timer
,
uint32_t
*
diff
)
{
if
(
!
timer
->
timer_interface
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Timer is not initilized!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
return
timer
->
timer_interface
->
timer_check
(
timer
);
return
timer
->
timer_interface
->
timer_check
(
timer
,
diff
);
}
...
...
src/switch_rtp.c
浏览文件 @
66feec2d
...
...
@@ -711,6 +711,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_size_t
bytes
=
0
;
switch_status_t
status
;
uint8_t
check
=
1
;
uint32_t
diff
=
0
;
if
(
!
rtp_session
->
timer
.
interval
)
{
rtp_session
->
last_time
=
switch_time_now
();
...
...
@@ -757,7 +758,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
if
(
rtp_session
->
timer
.
interval
)
{
check
=
(
uint8_t
)(
switch_core_timer_check
(
&
rtp_session
->
timer
)
==
SWITCH_STATUS_SUCCESS
);
check
=
(
uint8_t
)(
switch_core_timer_check
(
&
rtp_session
->
timer
,
&
diff
)
==
SWITCH_STATUS_SUCCESS
);
}
if
(
check
)
{
...
...
@@ -780,7 +781,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if
(
status
==
SWITCH_STATUS_BREAK
||
bytes
==
0
)
{
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_DATAWAIT
))
{
switch_yield
(
rtp_session
->
ms_per_packet
/
2
);
switch_yield
(
diff
*
1000
);
continue
;
}
return
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论