Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
92b51a7f
提交
92b51a7f
authored
2月 14, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DepLibUV: code cleanup
上级
1cb97030
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
25 行删除
+15
-25
DepLibUV.h
worker/include/DepLibUV.h
+14
-0
DepLibUV.cpp
worker/src/DepLibUV.cpp
+1
-25
没有找到文件。
worker/include/DepLibUV.h
浏览文件 @
92b51a7f
...
...
@@ -16,6 +16,7 @@ public:
private
:
static
uv_loop_t
*
loop
;
static
uint32_t
maxTimeCounter
;
static
uint32_t
timeUpdateCounter
;
};
...
...
@@ -27,4 +28,17 @@ uv_loop_t* DepLibUV::GetLoop()
return
DepLibUV
::
loop
;
}
inline
uint64_t
DepLibUV
::
GetTime
()
{
// Update the libuv's concept of “now” every maxTimeCounter usages.
if
(
++
DepLibUV
::
timeUpdateCounter
==
DepLibUV
::
maxTimeCounter
)
{
DepLibUV
::
timeUpdateCounter
=
0
;
uv_update_time
(
DepLibUV
::
loop
);
}
return
uv_now
(
DepLibUV
::
loop
);
}
#endif
worker/src/DepLibUV.cpp
浏览文件 @
92b51a7f
...
...
@@ -8,8 +8,8 @@
/* Static variables. */
uv_loop_t
*
DepLibUV
::
loop
=
nullptr
;
uint32_t
DepLibUV
::
maxTimeCounter
=
16384
;
uint32_t
DepLibUV
::
timeUpdateCounter
=
0
;
static
uint64_t
LAST_NOW
=
0
;
/* Static methods. */
...
...
@@ -23,8 +23,6 @@ void DepLibUV::ClassInit()
err
=
uv_loop_init
(
DepLibUV
::
loop
);
if
(
err
)
MS_ABORT
(
"libuv initialization failed"
);
LAST_NOW
=
uv_now
(
DepLibUV
::
loop
);
}
void
DepLibUV
::
ClassDestroy
()
...
...
@@ -56,25 +54,3 @@ void DepLibUV::RunLoop()
uv_run
(
DepLibUV
::
loop
,
UV_RUN_DEFAULT
);
}
// TODO: Move to inline in the .h file.
uint64_t
DepLibUV
::
GetTime
()
{
static
uint32_t
maxTimeCounter
=
32768
;
// TODO: Remove.
if
(
DepLibUV
::
timeUpdateCounter
==
0
)
{
MS_DEBUG_DEV
(
"now - LAST_NOW: %"
PRIu64
"ms"
,
uv_now
(
DepLibUV
::
loop
)
-
LAST_NOW
);
}
// Update the libuv's concept of “now” every N usages.
if
(
++
DepLibUV
::
timeUpdateCounter
==
maxTimeCounter
)
{
LAST_NOW
=
uv_now
(
DepLibUV
::
loop
);
DepLibUV
::
timeUpdateCounter
=
0
;
uv_update_time
(
DepLibUV
::
loop
);
}
return
uv_now
(
DepLibUV
::
loop
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论