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
2015-08-30 07:05:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
06ae74dd3fcaa6cbbfad53900a5055a43329fdae
06ae74dd
1 parent
4eb18749
for #319, move mw_latency to play.
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
102 行增加
和
108 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_reload.cpp
trunk/src/app/srs_app_reload.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/conf/full.conf
查看文件 @
06ae74d
...
...
@@ -373,18 +373,84 @@ vhost publish.srs.com {
}
}
# the play specified configs
vhost
play
.
srs
.
com
{
# for play client, both RTMP and other stream clients,
# for instance, the HTTP FLV stream clients.
play
{
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved/mixed monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# default: full
time_jitter
full
;
# whether use the interleaved/mixed algorithm to correct the timestamp.
# if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
# if off, use time_jitter to correct the timestamp if required.
# default: off
mix_correct
off
;
# vhost for atc for hls/hds/rtmp backup.
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
# when atc is on, server delivery rtmp stream by absolute time.
# atc is used, for instance, encoder will copy stream to master and slave server,
# server use atc to delivery stream to edge/client, where stream time from master/slave server
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
# if the time not the same, the HLS stream cannot slice to support system backup.
#
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
# @see http://www.baidu.com/#wd=hds%20hls%20atc
#
# default: off
atc
off
;
# whether enable the auto atc,
# if enabled, detect the bravo_atc="true" in onMetaData packet,
# set atc to on if matched.
# always ignore the onMetaData if atc_auto is off.
# default: off
atc_auto
off
;
# set the MW(merged-write) latency in ms.
# SRS always set mw on, so we just set the latency value.
# the latency of stream >= mw_latency + mr_latency
# the value recomment is [300, 1800]
# default: 350
mw_latency
350
;
}
}
# vhost for time jitter
vhost
jitter
.
srs
.
com
{
# @see play.srs.com
time_jitter
full
;
# @see play.srs.com
mix_correct
off
;
}
# vhost for atc.
vhost
atc
.
srs
.
com
{
# @see play.srs.com
atc
on
;
# @see play.srs.com
atc_auto
on
;
}
# the MR(merged-read) setting for publisher.
# the MW(merged-write) settings for player.
vhost
mrw
.
srs
.
com
{
# @see scope.vhost.srs.com
min_latency
off
;
# set the MW(merged-write) latency in ms.
# SRS always set mw on, so we just set the latency value.
# the latency of stream >= mw_latency + mr_latency
# the value recomment is [300, 1800]
# default: 350
mw_latency
350
;
# @see play.srs.com
play
{
mw_latency
350
;
}
# @see publish.srs.com
publish
{
...
...
@@ -395,10 +461,11 @@ vhost mrw.srs.com {
# the vhost for min delay, donot cache any stream.
vhost
min
.
delay
.
com
{
# @see
vhost mrw.srs.com for detail.
# @see
scope.vhost.srs.com
min_latency
on
;
# @see scope.vhost.srs.com
mw_latency
100
;
tcp_nodelay
on
;
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
# to enabled fast startup for client, client play immediately.
...
...
@@ -413,8 +480,11 @@ vhost min.delay.com {
# drop the old whole gop.
# default: 30
queue_length
10
;
# @see scope.vhost.srs.com
tcp_nodelay
on
;
# @see play.srs.com
play
{
mw_latency
100
;
}
# @see publish.srs.com
publish
{
...
...
@@ -424,12 +494,13 @@ vhost min.delay.com {
# the vhost to control the stream delivery feature
vhost
stream
.
control
.
com
{
# @see
vhost mrw.srs.com for detail.
# @see
scope.vhost.srs.com
min_latency
on
;
mw_latency
100
;
# @see scope.vhost.srs.com
tcp_nodelay
on
;
# @see vhost min.delay.com
queue_length
10
;
tcp_nodelay
on
;
# the minimal packets send interval in ms,
# used to control the ndiff of stream by srs_rtmp_dump,
# for example, some device can only accept some stream which
...
...
@@ -445,6 +516,11 @@ vhost stream.control.com {
# default: off
reduce_sequence_header
on
;
# @see play.srs.com
play
{
mw_latency
100
;
}
# @see publish.srs.com
publish
{
mr
off
;
...
...
@@ -485,67 +561,6 @@ vhost exec.srs.com {
}
}
# the play specified configs
vhost
play
.
srs
.
com
{
# for play client, both RTMP and other stream clients,
# for instance, the HTTP FLV stream clients.
play
{
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved/mixed monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# default: full
time_jitter
full
;
# whether use the interleaved/mixed algorithm to correct the timestamp.
# if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
# if off, use time_jitter to correct the timestamp if required.
# default: off
mix_correct
off
;
# vhost for atc for hls/hds/rtmp backup.
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
# when atc is on, server delivery rtmp stream by absolute time.
# atc is used, for instance, encoder will copy stream to master and slave server,
# server use atc to delivery stream to edge/client, where stream time from master/slave server
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
# if the time not the same, the HLS stream cannot slice to support system backup.
#
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
# @see http://www.baidu.com/#wd=hds%20hls%20atc
#
# default: off
atc
off
;
# whether enable the auto atc,
# if enabled, detect the bravo_atc="true" in onMetaData packet,
# set atc to on if matched.
# always ignore the onMetaData if atc_auto is off.
# default: off
atc_auto
off
;
}
}
# vhost for time jitter
vhost
jitter
.
srs
.
com
{
# @see play.srs.com
time_jitter
full
;
# @see play.srs.com
mix_correct
off
;
}
# vhost for atc.
vhost
atc
.
srs
.
com
{
# @see play.srs.com
atc
on
;
# @see play.srs.com
atc_auto
on
;
}
# the security to allow or deny clients.
vhost
security
.
srs
.
com
{
# security for host to allow or deny clients.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
06ae74d
...
...
@@ -841,18 +841,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
srs_trace
(
"vhost %s reload publish success."
,
vhost
.
c_str
());
}
// mw, only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"mw_latency"
),
old_vhost
->
get
(
"mw_latency"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_vhost_mw
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes mw failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload mw success."
,
vhost
.
c_str
());
}
// smi(send_min_interval), only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"send_min_interval"
),
old_vhost
->
get
(
"send_min_interval"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
...
...
@@ -1735,11 +1723,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
obj
->
set
(
"debug_srs_upnode"
,
dir
->
dumps_arg0_to_boolean
());
}
// mrw
if
((
dir
=
vhost
->
get
(
"mw_latency"
))
!=
NULL
)
{
obj
->
set
(
"mw_latency"
,
dir
->
dumps_arg0_to_number
());
}
// realtime latency
if
((
dir
=
vhost
->
get
(
"gop_cache"
))
!=
NULL
)
{
obj
->
set
(
"gop_cache"
,
dir
->
dumps_arg0_to_boolean
());
...
...
@@ -1772,6 +1755,8 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
play
->
set
(
"atc"
,
sdir
->
dumps_arg0_to_boolean
());
}
else
if
(
sdir
->
name
==
"atc_auto"
)
{
play
->
set
(
"atc_auto"
,
sdir
->
dumps_arg0_to_boolean
());
}
else
if
(
sdir
->
name
==
"mw_latency"
)
{
play
->
set
(
"mw_latency"
,
sdir
->
dumps_arg0_to_number
());
}
}
}
...
...
@@ -2654,7 +2639,7 @@ int SrsConfig::check_config()
&&
n
!=
"dvr"
&&
n
!=
"ingest"
&&
n
!=
"hls"
&&
n
!=
"http_hooks"
&&
n
!=
"gop_cache"
&&
n
!=
"queue_length"
&&
n
!=
"refer"
&&
n
!=
"forward"
&&
n
!=
"transcode"
&&
n
!=
"bandcheck"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"play"
&&
n
!=
"publish"
&&
n
!=
"mw_latency"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"play"
&&
n
!=
"publish"
&&
n
!=
"send_min_interval"
&&
n
!=
"reduce_sequence_header"
&&
n
!=
"security"
&&
n
!=
"http_remux"
&&
n
!=
"http_static"
&&
n
!=
"hds"
&&
n
!=
"exec"
...
...
@@ -2696,7 +2681,7 @@ int SrsConfig::check_config()
}
else
if
(
n
==
"play"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
if
(
m
!=
"time_jitter"
&&
m
!=
"mix_correct"
&&
m
!=
"atc"
&&
m
!=
"atc_auto"
)
{
if
(
m
!=
"time_jitter"
&&
m
!=
"mix_correct"
&&
m
!=
"atc"
&&
m
!=
"atc_auto"
&&
m
!=
"mw_latency"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported vhost play directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
...
...
@@ -3482,6 +3467,11 @@ int SrsConfig::get_mw_sleep_ms(string vhost)
if
(
!
conf
)
{
return
SRS_PERF_MW_SLEEP
;
}
conf
=
conf
->
get
(
"play"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_PERF_MW_SLEEP
;
}
conf
=
conf
->
get
(
"mw_latency"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
...
...
@@ -5789,12 +5779,12 @@ int srs_config_transform_vhost(SrsConfDirective* root)
}
// SRS3.0, change the folowing like a shadow:
// time_jitter, mix_correct, atc, atc_auto
// time_jitter, mix_correct, atc, atc_auto
, mw_latency
// SRS1/2:
// vhost { shadow; }
// SRS3+:
// vhost { play { shadow; } }
if
(
n
==
"time_jitter"
||
n
==
"mix_correct"
||
n
==
"atc"
||
n
==
"atc_auto"
)
{
if
(
n
==
"time_jitter"
||
n
==
"mix_correct"
||
n
==
"atc"
||
n
==
"atc_auto"
||
n
==
"mw_latency"
)
{
it
=
dir
->
directives
.
erase
(
it
);
SrsConfDirective
*
play
=
dir
->
get_or_create
(
"play"
);
...
...
trunk/src/app/srs_app_reload.cpp
查看文件 @
06ae74d
...
...
@@ -165,11 +165,6 @@ int ISrsReloadHandler::on_reload_vhost_publish(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_mw
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_smi
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_reload.hpp
查看文件 @
06ae74d
...
...
@@ -72,7 +72,6 @@ public:
virtual
int
on_reload_vhost_hds
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_dvr
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_publish
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_mw
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_smi
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_tcp_nodelay
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_realtime
(
std
::
string
vhost
);
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
06ae74d
...
...
@@ -231,18 +231,13 @@ int SrsRtmpConn::on_reload_vhost_removed(string vhost)
return
ret
;
}
int
SrsRtmpConn
::
on_reload_vhost_
mw
(
string
vhost
)
int
SrsRtmpConn
::
on_reload_vhost_
play
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
if
(
req
->
vhost
!=
vhost
)
{
return
ret
;
}
int
sleep_ms
=
_srs_config
->
get_mw_sleep_ms
(
req
->
vhost
);
// when mw_sleep changed, resize the socket send buffer.
change_mw_sleep
(
sleep_ms
);
return
ret
;
}
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
06ae74d
...
...
@@ -103,7 +103,7 @@ protected:
// interface ISrsReloadHandler
public:
virtual
int
on_reload_vhost_removed
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_
mw
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_
play
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_smi
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_tcp_nodelay
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_realtime
(
std
::
string
vhost
);
...
...
请
注册
或
登录
后发表评论