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-29 23:18:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d6b0aa3a5bc1728baf99764c4749da404684b8f1
d6b0aa3a
1 parent
73864207
for #319, move time_jitter and mix_correct to play
隐藏空白字符变更
内嵌
并排对比
正在显示
11 个修改的文件
包含
168 行增加
和
98 行删除
trunk/conf/compatible.conf
trunk/conf/full.conf
trunk/conf/full.one.vhost.conf
trunk/conf/realtime.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_source.cpp
trunk/src/app/srs_app_source.hpp
trunk/src/utest/srs_utest_reload.cpp
trunk/src/utest/srs_utest_reload.hpp
trunk/conf/compatible.conf
查看文件 @
d6b0aa3
...
...
@@ -42,4 +42,32 @@ vhost __defaultVhost__ {
enabled
off
;
latency
350
;
}
# for SRS2
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
vhost
same
.
edge
.
srs
.
com
;
debug_srs_upnode
off
;
# for SRS2
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
# for SRS2
time_jitter
full
;
mix_correct
off
;
atc
on
;
atc_auto
on
;
min_latency
on
;
mw_latency
100
;
gop_cache
off
;
queue_length
10
;
send_min_interval
10
.
0
;
reduce_sequence_header
on
;
}
...
...
trunk/conf/full.conf
查看文件 @
d6b0aa3
...
...
@@ -979,7 +979,7 @@ vhost mrw.srs.com {
# @see publish.srs.com
publish
{
mr
o
ff
;
mr
o
n
;
mr_latenct
350
;
}
}
...
...
@@ -988,9 +988,6 @@ vhost mrw.srs.com {
vhost
min
.
delay
.
com
{
# @see vhost mrw.srs.com for detail.
min_latency
on
;
mr
{
enabled
off
;
}
mw_latency
100
;
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
...
...
@@ -1010,15 +1007,17 @@ vhost min.delay.com {
# if on, set the nodelay of fd by setsockopt
# default: off
tcp_nodelay
on
;
# @see publish.srs.com
publish
{
mr
off
;
}
}
# the vhost to control the stream delivery feature
vhost
stream
.
control
.
com
{
# @see vhost mrw.srs.com for detail.
min_latency
on
;
mr
{
enabled
off
;
}
mw_latency
100
;
# @see vhost min.delay.com
queue_length
10
;
...
...
@@ -1040,6 +1039,7 @@ vhost stream.control.com {
# @see publish.srs.com
publish
{
mr
off
;
firstpkt_timeout
20000
;
normal_timeout
7000
;
}
...
...
@@ -1086,24 +1086,36 @@ vhost chunksize.srs.com {
chunk_size
128
;
}
# 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 time jitter
vhost
jitter
.
srs
.
com
{
# 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
# @see play.srs.com
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
# @see play.srs.com
mix_correct
off
;
}
...
...
trunk/conf/full.one.vhost.conf
查看文件 @
d6b0aa3
...
...
@@ -48,30 +48,42 @@ vhost __defaultVhost__ {
vhost
vhost
.
srs
.
com
{
enabled
off
;
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
vhost
same
.
edge
.
srs
.
com
;
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
chunk_size
128
;
tcp_nodelay
on
;
debug_srs_upnode
off
;
# TODO
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
vhost
same
.
edge
.
srs
.
com
;
chunk_size
128
;
debug_srs_upnode
off
;
}
time_jitter
full
;
mix_correct
off
;
# TODO
forward
{
destination
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
}
atc
on
;
atc_auto
on
;
play
{
time_jitter
full
;
mix_correct
off
;
# TODO
atc
on
;
atc_auto
on
;
min_latency
on
;
mw_latency
100
;
gop_cache
off
;
queue_length
10
;
tcp_nodelay
on
;
send_min_interval
10
.
0
;
reduce_sequence_header
on
;
min_latency
on
;
mw_latency
100
;
gop_cache
off
;
queue_length
10
;
send_min_interval
10
.
0
;
reduce_sequence_header
on
;
}
publish
{
mr
off
;
...
...
trunk/conf/realtime.conf
查看文件 @
d6b0aa3
...
...
@@ -5,11 +5,15 @@
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
gop_cache
off
;
queue_length
10
;
min_latency
on
;
mw_latency
100
;
tcp_nodelay
on
;
play
{
gop_cache
off
;
queue_length
10
;
min_latency
on
;
mw_latency
100
;
}
publish
{
mr
off
;
}
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
d6b0aa3
...
...
@@ -731,28 +731,16 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
srs_trace
(
"vhost %s reload queue_length success."
,
vhost
.
c_str
());
}
// time_jitter, only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"time_jitter"
),
old_vhost
->
get
(
"time_jitter"
)))
{
// play, only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"play"
),
old_vhost
->
get
(
"play"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_vhost_time_jitter
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes time_jitter failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
if
((
ret
=
subscribe
->
on_reload_vhost_play
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes play failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload time_jitter success."
,
vhost
.
c_str
());
}
// mix_correct, only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"mix_correct"
),
old_vhost
->
get
(
"mix_correct"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_vhost_mix_correct
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes mix_correct failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload mix_correct success."
,
vhost
.
c_str
());
srs_trace
(
"vhost %s reload play success."
,
vhost
.
c_str
());
}
// forward, only one per vhost
...
...
@@ -1754,14 +1742,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
obj
->
set
(
"chunk_size"
,
dir
->
dumps_arg0_to_number
());
}
// time_jitter
if
((
dir
=
vhost
->
get
(
"time_jitter"
))
!=
NULL
)
{
obj
->
set
(
"time_jitter"
,
dir
->
dumps_arg0_to_str
());
}
if
((
dir
=
vhost
->
get
(
"mix_correct"
))
!=
NULL
)
{
obj
->
set
(
"mix_correct"
,
dir
->
dumps_arg0_to_boolean
());
}
// atc
if
((
dir
=
vhost
->
get
(
"atc"
))
!=
NULL
)
{
obj
->
set
(
"atc"
,
dir
->
dumps_arg0_to_boolean
());
...
...
@@ -1797,6 +1777,22 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
obj
->
set
(
"reduce_sequence_header"
,
dir
->
dumps_arg0_to_boolean
());
}
// play
if
((
dir
=
vhost
->
get
(
"play"
))
!=
NULL
)
{
SrsAmf0Object
*
play
=
SrsAmf0Any
::
object
();
obj
->
set
(
"play"
,
play
);
for
(
int
i
=
0
;
i
<
(
int
)
dir
->
directives
.
size
();
i
++
)
{
SrsConfDirective
*
sdir
=
dir
->
directives
.
at
(
i
);
if
(
sdir
->
name
==
"time_jitter"
)
{
play
->
set
(
"time_jitter"
,
sdir
->
dumps_arg0_to_str
());
}
else
if
(
sdir
->
name
==
"mix_correct"
)
{
play
->
set
(
"mix_correct"
,
sdir
->
dumps_arg0_to_boolean
());
}
}
}
// publish
if
((
dir
=
vhost
->
get
(
"publish"
))
!=
NULL
)
{
SrsAmf0Object
*
publish
=
SrsAmf0Any
::
object
();
...
...
@@ -2675,10 +2671,8 @@ 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
!=
"time_jitter"
&&
n
!=
"mix_correct"
&&
n
!=
"atc"
&&
n
!=
"atc_auto"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"publish"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"atc"
&&
n
!=
"atc_auto"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"play"
&&
n
!=
"publish"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"tcp_nodelay"
&&
n
!=
"send_min_interval"
&&
n
!=
"reduce_sequence_header"
&&
n
!=
"security"
&&
n
!=
"http_remux"
&&
n
!=
"http_static"
&&
n
!=
"hds"
&&
n
!=
"exec"
...
...
@@ -2717,6 +2711,15 @@ int SrsConfig::check_config()
return
ret
;
}
}
}
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"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported vhost play directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
}
}
}
else
if
(
n
==
"publish"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
...
...
@@ -3295,6 +3298,11 @@ int SrsConfig::get_time_jitter(string vhost)
return
_srs_time_jitter_string2int
(
DEFAULT
);
}
conf
=
conf
->
get
(
"play"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
_srs_time_jitter_string2int
(
DEFAULT
);
}
conf
=
conf
->
get
(
"time_jitter"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
_srs_time_jitter_string2int
(
DEFAULT
);
...
...
@@ -3312,6 +3320,11 @@ bool SrsConfig::get_mix_correct(string vhost)
return
DEFAULT
;
}
conf
=
conf
->
get
(
"play"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"mix_correct"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
...
...
@@ -5782,6 +5795,23 @@ int srs_config_transform_vhost(SrsConfDirective* root)
continue
;
}
// SRS3.0, change the folowing like a shadow:
// time_jitter, mix_correct
// SRS1/2:
// vhost { shadow; }
// SRS3+:
// vhost { play { shadow; } }
if
(
conf
->
name
==
"time_jitter"
||
conf
->
name
==
"mix_correct"
)
{
it
=
dir
->
directives
.
erase
(
it
);
SrsConfDirective
*
play
=
dir
->
get_or_create
(
"play"
);
SrsConfDirective
*
shadow
=
play
->
get_or_create
(
conf
->
name
);
shadow
->
args
=
conf
->
args
;
srs_freep
(
conf
);
continue
;
}
++
it
;
}
}
...
...
trunk/src/app/srs_app_reload.cpp
查看文件 @
d6b0aa3
...
...
@@ -140,12 +140,7 @@ int ISrsReloadHandler::on_reload_vhost_queue_length(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_time_jitter
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_mix_correct
(
string
/*vhost*/
)
int
ISrsReloadHandler
::
on_reload_vhost_play
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
...
...
trunk/src/app/srs_app_reload.hpp
查看文件 @
d6b0aa3
...
...
@@ -67,8 +67,7 @@ public:
virtual
int
on_reload_vhost_atc
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_gop_cache
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_queue_length
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_time_jitter
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_mix_correct
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_play
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_forward
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hls
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hds
(
std
::
string
vhost
);
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
d6b0aa3
...
...
@@ -1121,7 +1121,7 @@ int SrsSource::on_reload_vhost_queue_length(string vhost)
return
ret
;
}
int
SrsSource
::
on_reload_vhost_
time_jitter
(
string
vhost
)
int
SrsSource
::
on_reload_vhost_
play
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1129,19 +1129,10 @@ int SrsSource::on_reload_vhost_time_jitter(string vhost)
return
ret
;
}
// time_jitter
jitter_algorithm
=
(
SrsRtmpJitterAlgorithm
)
_srs_config
->
get_time_jitter
(
_req
->
vhost
);
return
ret
;
}
int
SrsSource
::
on_reload_vhost_mix_correct
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
if
(
_req
->
vhost
!=
vhost
)
{
return
ret
;
}
// mix_correct
bool
v
=
_srs_config
->
get_mix_correct
(
_req
->
vhost
);
// when changed, clear the mix queue.
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
d6b0aa3
...
...
@@ -521,8 +521,7 @@ public:
virtual
int
on_reload_vhost_atc
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_gop_cache
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_queue_length
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_time_jitter
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_mix_correct
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_play
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_forward
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hls
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hds
(
std
::
string
vhost
);
...
...
trunk/src/utest/srs_utest_reload.cpp
查看文件 @
d6b0aa3
...
...
@@ -248,7 +248,7 @@ int MockReloadHandler::on_reload_vhost_queue_length(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
MockReloadHandler
::
on_reload_vhost_
time_jitter
(
string
/*vhost*/
)
int
MockReloadHandler
::
on_reload_vhost_
play
(
string
/*vhost*/
)
{
vhost_time_jitter_reloaded
=
true
;
return
ERROR_SUCCESS
;
...
...
trunk/src/utest/srs_utest_reload.hpp
查看文件 @
d6b0aa3
...
...
@@ -88,7 +88,7 @@ public:
virtual
int
on_reload_vhost_atc
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_gop_cache
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_queue_length
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_
time_jitter
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_
play
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_forward
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hls
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_hds
(
std
::
string
vhost
);
...
...
请
注册
或
登录
后发表评论