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-04-14 10:51:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c6b6c6846243de9c2e9f73c518f4ff8b558d6c4
2c6b6c68
1 parent
bcfe82f8
fix bug #47: use stream time to stop for duration of rtmpdump
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
25 行增加
和
12 行删除
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/core/srs_core.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
2c6b6c6
...
...
@@ -72,6 +72,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd)
http_hooks
=
new
SrsHttpHooks
();
#endif
bandwidth
=
new
SrsBandwidth
();
duration
=
0
;
_srs_config
->
subscribe
(
this
);
}
...
...
@@ -414,18 +415,10 @@ int SrsRtmpConn::playing(SrsSource* source)
SrsPithyPrint
pithy_print
(
SRS_STAGE_PLAY_USER
);
int64_t
starttime
=
-
1
;
while
(
true
)
{
pithy_print
.
elapse
(
SRS_PULSE_TIMEOUT_US
/
1000
);
// if duration specified, and exceed it, stop play live.
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/45
// TODO: maybe the duration should use the stream duration.
if
(
req
->
duration
>
0
&&
pithy_print
.
get_age
()
>=
(
int64_t
)
req
->
duration
)
{
ret
=
ERROR_RTMP_DURATION_EXCEED
;
srs_trace
(
"stop live for duration exceed. ret=%d"
,
ret
);
return
ret
;
}
// switch to other st-threads.
st_usleep
(
0
);
...
...
@@ -460,8 +453,8 @@ int SrsRtmpConn::playing(SrsSource* source)
// reportable
if
(
pithy_print
.
can_print
())
{
srs_trace
(
"-> time=%"
PRId64
", cmr=%d, msgs=%d, obytes=%"
PRId64
", ibytes=%"
PRId64
", okbps=%d, ikbps=%d"
,
pithy_print
.
get_age
(),
ctl_msg_ret
,
count
,
rtmp
->
get_send_bytes
(),
rtmp
->
get_recv_bytes
(),
rtmp
->
get_send_kbps
(),
rtmp
->
get_recv_kbps
());
srs_trace
(
"-> time=%"
PRId64
", duration=%"
PRId64
", cmr=%d, msgs=%d, obytes=%"
PRId64
", ibytes=%"
PRId64
", okbps=%d, ikbps=%d"
,
pithy_print
.
get_age
(),
duration
,
ctl_msg_ret
,
count
,
rtmp
->
get_send_bytes
(),
rtmp
->
get_recv_bytes
(),
rtmp
->
get_send_kbps
(),
rtmp
->
get_recv_kbps
());
}
if
(
count
<=
0
)
{
...
...
@@ -482,6 +475,22 @@ int SrsRtmpConn::playing(SrsSource* source)
srs_error
(
"send message to client failed. ret=%d"
,
ret
);
return
ret
;
}
// foreach msg, collect the duration.
if
(
starttime
<
0
||
starttime
>
msg
->
header
.
timestamp
)
{
starttime
=
msg
->
header
.
timestamp
;
}
duration
+=
msg
->
header
.
timestamp
-
starttime
;
starttime
=
msg
->
header
.
timestamp
;
}
// if duration specified, and exceed it, stop play live.
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/45
// TODO: maybe the duration should use the stream duration.
if
(
req
->
duration
>
0
&&
duration
>=
(
int64_t
)
req
->
duration
)
{
ret
=
ERROR_RTMP_DURATION_EXCEED
;
srs_trace
(
"stop live for duration exceed. ret=%d"
,
ret
);
return
ret
;
}
}
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
2c6b6c6
...
...
@@ -62,6 +62,10 @@ private:
SrsHttpHooks
*
http_hooks
;
#endif
SrsBandwidth
*
bandwidth
;
// elapse duration in ms
// for live play duration, for instance, rtmpdump to record.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/47
int64_t
duration
;
public
:
SrsRtmpConn
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
);
virtual
~
SrsRtmpConn
();
...
...
trunk/src/core/srs_core.hpp
查看文件 @
2c6b6c6
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "6
3
"
#define VERSION_REVISION "6
4
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
...
...
请
注册
或
登录
后发表评论