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 16:42:28 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
028539562831f75dd0026a14f409833bfdec6db3
02853956
2 parents
0b0f6566
ade81bb2
Merge branch 'srs.master'
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
28 行增加
和
2 行删除
trunk/src/app/srs_app_pipe.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_pipe.cpp
查看文件 @
0285395
...
...
@@ -81,7 +81,7 @@ int SrsPipe::active()
int
ret
=
ERROR_SUCCESS
;
int
v
=
0
;
if
(
st_write
(
read
_stfd
,
&
v
,
sizeof
(
int
),
ST_UTIME_NO_TIMEOUT
)
!=
sizeof
(
int
))
{
if
(
st_write
(
write
_stfd
,
&
v
,
sizeof
(
int
),
ST_UTIME_NO_TIMEOUT
)
!=
sizeof
(
int
))
{
ret
=
ERROR_SYSTEM_WRITE_PIPE
;
srs_error
(
"write pipe failed. ret=%d"
,
ret
);
return
ret
;
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
0285395
...
...
@@ -516,7 +516,12 @@ int SrsRtmpConn::playing(SrsSource* source)
SrsAutoFree
(
SrsConsumer
,
consumer
);
srs_verbose
(
"consumer created success."
);
// TODO: FIXME: remove it.
rtmp
->
set_recv_timeout
(
SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
);
// disable the timeout.
// TODO: FIXME: maybe can use larger timeout?
rtmp
->
set_recv_timeout
(
ST_UTIME_NO_TIMEOUT
);
rtmp
->
set_send_timeout
(
ST_UTIME_NO_TIMEOUT
);
SrsPithyPrint
pithy_print
(
SRS_CONSTS_STAGE_PLAY_USER
);
...
...
@@ -525,12 +530,30 @@ int SrsRtmpConn::playing(SrsSource* source)
bool
user_specified_duration_to_stop
=
(
req
->
duration
>
0
);
int64_t
starttime
=
-
1
;
pollfd
pds
[
2
];
// poll the client incoming fd.
pds
[
0
].
fd
=
st_netfd_fileno
(
stfd
);
pds
[
0
].
events
=
POLLIN
;
// poll the consumer queue pipe.
pds
[
1
].
fd
=
st_netfd_fileno
(
consumer
->
pipe_fd
());
pds
[
1
].
events
=
POLLIN
;
while
(
true
)
{
// collect elapse for pithy print.
pithy_print
.
elapse
();
pds
[
0
].
revents
=
0
;
pds
[
1
].
revents
=
0
;
// wait for packet incoming or data outgoing.
if
(
st_poll
(
pds
,
2
,
ST_UTIME_NO_TIMEOUT
)
<=
0
)
{
srs_error
(
"st_poll failed."
);
break
;
}
// packet incoming, read from RTMP.
// read from client.
if
(
true
)
{
if
(
pds
[
0
].
revents
&
POLLIN
)
{
SrsMessage
*
msg
=
NULL
;
ret
=
rtmp
->
recv_message
(
&
msg
);
srs_verbose
(
"play loop recv message. ret=%d"
,
ret
);
...
...
@@ -553,6 +576,8 @@ int SrsRtmpConn::playing(SrsSource* source)
}
}
// data outgoing, sendout packets.
if
(
pds
[
1
].
revents
&
POLLIN
)
{
// get messages from consumer.
int
count
=
0
;
if
((
ret
=
consumer
->
dump_packets
(
msgs
.
size
,
msgs
.
msgs
,
count
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -598,6 +623,7 @@ int SrsRtmpConn::playing(SrsSource* source)
return
ret
;
}
}
}
// if duration specified, and exceed it, stop play live.
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/45
...
...
请
注册
或
登录
后发表评论