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-09-14 18:36:44 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
511627ababc2e759cfcfbfcd808614f179cc380c
511627ab
1 parent
eb578b4a
fix #474, config to donot parse width/height from sps. 2.0.189
隐藏空白字符变更
内嵌
并排对比
正在显示
10 个修改的文件
包含
94 行增加
和
11 行删除
README.md
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_source.cpp
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_codec.cpp
trunk/src/kernel/srs_kernel_codec.hpp
README.md
查看文件 @
511627a
...
...
@@ -343,6 +343,7 @@ Remark:
## History
*
v2.0, 2015-09-14, fix
[
#474
][
bug #474
]
config to donot parse width/height from sps. 2.0.189
*
v2.0, 2015-09-14, for
[
#474
][
bug #474
]
always release publish for source.
*
v2.0, 2015-09-14, for
[
#458
][
bug #458
]
http hooks use source thread cid. 2.0.188
*
v2.0, 2015-09-14, for
[
#475
][
bug #475
]
fix http hooks crash for st context switch. 2.0.187
...
...
trunk/conf/full.conf
查看文件 @
511627a
...
...
@@ -858,6 +858,17 @@ vhost min.delay.com {
tcp_nodelay
on
;
}
# whether disable the sps parse, for the resolution of video.
vhost
no
.
parse
.
sps
.
com
{
publish
{
# whether parse the sps when publish stream.
# we can got the resolution of video for stat api.
# but we may failed to cause publish failed.
# default: on
parse_sps
on
;
}
}
# the vhost to control the stream delivery feature
vhost
stream
.
control
.
com
{
# @see vhost mrw.srs.com for detail.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
511627a
...
...
@@ -618,6 +618,9 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
srs_error
(
"reload never supports mode changed. ret=%d"
,
ret
);
return
ret
;
}
// the auto reload configs:
// publish.parse_sps
// ENABLED => ENABLED (modified)
if
(
get_vhost_enabled
(
new_vhost
)
&&
get_vhost_enabled
(
old_vhost
))
{
...
...
@@ -1806,7 +1809,7 @@ int SrsConfig::check_config()
&&
n
!=
"time_jitter"
&&
n
!=
"mix_correct"
&&
n
!=
"atc"
&&
n
!=
"atc_auto"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"mr"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"mr"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"publish"
&&
n
!=
"tcp_nodelay"
&&
n
!=
"send_min_interval"
&&
n
!=
"reduce_sequence_header"
&&
n
!=
"publish_1stpkt_timeout"
&&
n
!=
"publish_normal_timeout"
&&
n
!=
"security"
&&
n
!=
"http_remux"
...
...
@@ -1839,6 +1842,16 @@ int SrsConfig::check_config()
return
ret
;
}
}
}
else
if
(
n
==
"publish"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
if
(
m
!=
"parse_sps"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported vhost publish directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
}
}
}
else
if
(
n
==
"ingest"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
...
...
@@ -2473,6 +2486,29 @@ int SrsConfig::get_chunk_size(string vhost)
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
bool
SrsConfig
::
get_parse_sps
(
string
vhost
)
{
static
bool
DEFAULT
=
true
;
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"publish"
);
if
(
!
conf
)
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"parse_sps"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
return
SRS_CONF_PERFER_TRUE
(
conf
->
arg0
());
}
bool
SrsConfig
::
get_mr_enabled
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
511627a
...
...
@@ -500,6 +500,10 @@ public:
*/
virtual
int
get_chunk_size
(
std
::
string
vhost
);
/**
* whether parse the sps when publish stream to SRS.
*/
virtual
bool
get_parse_sps
(
std
::
string
vhost
);
/**
* whether mr is enabled for vhost.
* @param vhost, the vhost to get the mr.
*/
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
511627a
...
...
@@ -1395,7 +1395,7 @@ int SrsHls::on_audio(SrsSharedPtrMessage* shared_audio)
return
ret
;
}
int
SrsHls
::
on_video
(
SrsSharedPtrMessage
*
shared_video
)
int
SrsHls
::
on_video
(
SrsSharedPtrMessage
*
shared_video
,
bool
is_sps_pps
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1409,6 +1409,12 @@ int SrsHls::on_video(SrsSharedPtrMessage* shared_video)
SrsSharedPtrMessage
*
video
=
shared_video
->
copy
();
SrsAutoFree
(
SrsSharedPtrMessage
,
video
);
// user can disable the sps parse to workaround when parse sps failed.
// @see https://github.com/simple-rtmp-server/srs/issues/474
if
(
is_sps_pps
)
{
codec
->
avc_parse_sps
=
_srs_config
->
get_parse_sps
(
_req
->
vhost
);
}
sample
->
clear
();
if
((
ret
=
codec
->
video_avc_demux
(
video
->
payload
,
video
->
size
,
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hls codec demux video failed. ret=%d"
,
ret
);
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
511627a
...
...
@@ -444,10 +444,11 @@ public:
*/
virtual
int
on_audio
(
SrsSharedPtrMessage
*
shared_audio
);
/**
* mux the video packets to ts.
* @param shared_video, directly ptr, copy it if need to save it.
*/
virtual
int
on_video
(
SrsSharedPtrMessage
*
shared_video
);
* mux the video packets to ts.
* @param shared_video, directly ptr, copy it if need to save it.
* @param is_sps_pps whether the video is h.264 sps/pps.
*/
virtual
int
on_video
(
SrsSharedPtrMessage
*
shared_video
,
bool
is_sps_pps
);
private
:
virtual
void
hls_show_mux_log
();
};
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
511627a
...
...
@@ -1290,7 +1290,7 @@ int SrsSource::on_hls_start()
// when reload to start hls, hls will never get the sequence header in stream,
// use the SrsSource.on_hls_start to push the sequence header to HLS.
// TODO: maybe need to decode the metadata?
if
(
cache_sh_video
&&
(
ret
=
hls
->
on_video
(
cache_sh_video
))
!=
ERROR_SUCCESS
)
{
if
(
cache_sh_video
&&
(
ret
=
hls
->
on_video
(
cache_sh_video
,
true
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hls process video sequence header message failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -1587,7 +1587,6 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
codec
.
audio_data_rate
/
1000
,
aac_sample_rates
[
codec
.
aac_sample_rate
],
flv_sample_sizes
[
sample
.
sound_size
],
flv_sound_types
[
sample
.
sound_type
],
flv_sample_rates
[
sample
.
sound_rate
]);
return
ret
;
}
#ifdef SRS_AUTO_HLS
...
...
@@ -1674,6 +1673,11 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
cache_sh_audio
=
msg
->
copy
();
}
// when sequence header, donot push to gop cache and adjust the timestamp.
if
(
is_sequence_header
)
{
return
ret
;
}
// cache the last gop packets
if
((
ret
=
gop_cache
->
cache
(
msg
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"shrink gop cache failed. ret=%d"
,
ret
);
...
...
@@ -1779,6 +1783,11 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
// parse detail audio codec
SrsAvcAacCodec
codec
;
// user can disable the sps parse to workaround when parse sps failed.
// @see https://github.com/simple-rtmp-server/srs/issues/474
codec
.
avc_parse_sps
=
_srs_config
->
get_parse_sps
(
_req
->
vhost
);
SrsCodecSample
sample
;
if
((
ret
=
codec
.
video_avc_demux
(
msg
->
payload
,
msg
->
size
,
&
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"source codec demux video failed. ret=%d"
,
ret
);
...
...
@@ -1796,11 +1805,10 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
srs_codec_avc_profile2str
(
codec
.
avc_profile
).
c_str
(),
srs_codec_avc_level2str
(
codec
.
avc_level
).
c_str
(),
codec
.
width
,
codec
.
height
,
codec
.
video_data_rate
/
1000
,
codec
.
frame_rate
,
codec
.
duration
);
return
ret
;
}
#ifdef SRS_AUTO_HLS
if
((
ret
=
hls
->
on_video
(
msg
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
hls
->
on_video
(
msg
,
is_sequence_header
))
!=
ERROR_SUCCESS
)
{
// apply the error strategy for hls.
// @see https://github.com/simple-rtmp-server/srs/issues/264
std
::
string
hls_error_strategy
=
_srs_config
->
get_hls_on_error
(
_req
->
vhost
);
...
...
@@ -1874,6 +1882,11 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
}
}
}
// when sequence header, donot push to gop cache and adjust the timestamp.
if
(
is_sequence_header
)
{
return
ret
;
}
// cache the last gop packets
if
((
ret
=
gop_cache
->
cache
(
msg
))
!=
ERROR_SUCCESS
)
{
...
...
trunk/src/core/srs_core.hpp
查看文件 @
511627a
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 18
8
#define VERSION_REVISION 18
9
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/kernel/srs_kernel_codec.cpp
查看文件 @
511627a
...
...
@@ -382,6 +382,8 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
SrsAvcAacCodec
::
SrsAvcAacCodec
()
{
avc_parse_sps
=
true
;
width
=
0
;
height
=
0
;
duration
=
0
;
...
...
@@ -939,6 +941,12 @@ int SrsAvcAacCodec::avc_demux_sps_rbsp(char* rbsp, int nb_rbsp)
{
int
ret
=
ERROR_SUCCESS
;
// we donot parse the detail of sps.
// @see https://github.com/simple-rtmp-server/srs/issues/474
if
(
!
avc_parse_sps
)
{
return
ret
;
}
// reparse the rbsp.
SrsStream
stream
;
if
((
ret
=
stream
.
initialize
(
rbsp
,
nb_rbsp
))
!=
ERROR_SUCCESS
)
{
...
...
trunk/src/kernel/srs_kernel_codec.hpp
查看文件 @
511627a
...
...
@@ -606,6 +606,9 @@ public:
int
aac_extra_size
;
char
*
aac_extra_data
;
public
:
// for sequence header, whether parse the h.264 sps.
bool
avc_parse_sps
;
public
:
SrsAvcAacCodec
();
virtual
~
SrsAvcAacCodec
();
public
:
...
...
请
注册
或
登录
后发表评论