Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-11 18:46:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
21f16f3a83b63ffb7d868bf0ddcf9e5a655ddecc
21f16f3a
1 parent
164f632b
for bug #194, use play fd poll to improve performance, it works.
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
9 行增加
和
4 行删除
trunk/src/app/srs_app_poll.cpp
trunk/src/app/srs_app_poll.cpp
查看文件 @
21f16f3
...
...
@@ -26,6 +26,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_error.hpp>
#include <srs_kernel_log.hpp>
// the interval in us to refresh the poll for all fds.
// for performance refine, @see: https://github.com/winlinvip/simple-rtmp-server/issues/194
#define SRS_POLL_CYCLE_INTERVAL 10 * 1000 * 1000
SrsPoll
::
SrsPoll
()
{
_pds
=
NULL
;
...
...
@@ -54,10 +58,8 @@ int SrsPoll::cycle()
}
int
nb_pds
=
(
int
)
fds
.
size
();
st_usleep
(
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
);
return
ret
;
// TODO: FIXME: use more efficient way for the poll.
srs_freep
(
_pds
);
_pds
=
new
pollfd
[
nb_pds
];
...
...
@@ -77,7 +79,10 @@ return ret;
srs_assert
(
index
==
(
int
)
fds
.
size
());
}
if
(
st_poll
(
_pds
,
nb_pds
,
ST_UTIME_NO_TIMEOUT
)
<=
0
)
{
// Upon successful completion, a non-negative value is returned.
// A positive value indicates the total number of OS file descriptors in pds that have events.
// A value of 0 indicates that the call timed out.
if
(
st_poll
(
_pds
,
nb_pds
,
SRS_POLL_CYCLE_INTERVAL
)
<
0
)
{
srs_warn
(
"ignore st_poll failed, size=%d"
,
nb_pds
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论