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-12-20 11:58:39 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
eef8034632f403c9e6ca7ea1e00df30d447d524c
eef80346
2 parents
c2ab3dea
77370427
merge from 1.0release for bug #264. 2.0.74
显示空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
58 行增加
和
8 行删除
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_source.cpp
trunk/src/core/srs_core.hpp
trunk/conf/full.conf
查看文件 @
eef8034
...
...
@@ -329,6 +329,12 @@ vhost with-hls.srs.com {
# the hls window in seconds, the number of ts in m3u8.
# default: 60
hls_window
60
;
# the error strategy. canbe:
# ignore, when error ignore and disable hls.
# disconnect, when error disconnect the publish connection.
# @see https://github.com/winlinvip/simple-rtmp-server/issues/264
# default: ignore
hls_on_error
ignore
;
}
}
# the vhost with hls disabled.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
eef8034
...
...
@@ -798,6 +798,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
srs_trace
(
"vhost %s reload forward success."
,
vhost
.
c_str
());
}
// hls, only one per vhost
// @remark, the hls_on_error directly support reload.
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"hls"
),
old_vhost
->
get
(
"hls"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
...
...
@@ -1412,7 +1413,7 @@ int SrsConfig::check_config()
}
else
if
(
n
==
"hls"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
if
(
m
!=
"enabled"
&&
m
!=
"hls_path"
&&
m
!=
"hls_fragment"
&&
m
!=
"hls_window"
)
{
if
(
m
!=
"enabled"
&&
m
!=
"hls_path"
&&
m
!=
"hls_fragment"
&&
m
!=
"hls_window"
&&
m
!=
"hls_on_error"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported vhost hls directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
...
...
@@ -3064,6 +3065,23 @@ double SrsConfig::get_hls_window(string vhost)
return
::
atof
(
conf
->
arg0
().
c_str
());
}
string
SrsConfig
::
get_hls_on_error
(
string
vhost
)
{
SrsConfDirective
*
hls
=
get_hls
(
vhost
);
if
(
!
hls
)
{
return
SRS_CONF_DEFAULT_HLS_ON_ERROR
;
}
SrsConfDirective
*
conf
=
hls
->
get
(
"hls_on_error"
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_HLS_ON_ERROR
;
}
return
conf
->
arg0
();
}
SrsConfDirective
*
SrsConfig
::
get_dvr
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
eef8034
...
...
@@ -48,6 +48,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10
#define SRS_CONF_DEFAULT_HLS_WINDOW 60
#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore"
#define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect"
#define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html"
#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"
#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment"
...
...
@@ -847,6 +850,13 @@ public:
* @remark SRS will delete the ts exceed the window.
*/
virtual
double
get_hls_window
(
std
::
string
vhost
);
/**
* get the hls hls_on_error config.
* the ignore will ignore error and disable hls.
* the disconnect will disconnect publish connection.
* @see https://github.com/winlinvip/simple-rtmp-server/issues/264
*/
virtual
std
::
string
get_hls_on_error
(
std
::
string
vhost
);
// dvr section
private:
/**
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
eef8034
...
...
@@ -1439,7 +1439,7 @@ int SrsHls::on_audio(SrsSharedPtrMessage* __audio)
sample
->
clear
();
if
((
ret
=
codec
->
audio_aac_demux
(
audio
->
payload
,
audio
->
size
,
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"codec demux audio failed. ret=%d"
,
ret
);
srs_error
(
"
hls
codec demux audio failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -1484,7 +1484,7 @@ int SrsHls::on_video(SrsSharedPtrMessage* __video)
sample
->
clear
();
if
((
ret
=
codec
->
video_avc_demux
(
video
->
payload
,
video
->
size
,
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"codec demux video failed. ret=%d"
,
ret
);
srs_error
(
"
hls
codec demux video failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
eef8034
...
...
@@ -1239,7 +1239,11 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
srs_verbose
(
"initialize shared ptr audio success."
);
#ifdef SRS_AUTO_HLS
if
((
ret
=
hls
->
on_audio
(
&
msg
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
hls
->
on_audio
(
msg
.
copy
()))
!=
ERROR_SUCCESS
)
{
// apply the error strategy for hls.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/264
std
::
string
hls_error_strategy
=
_srs_config
->
get_hls_on_error
(
_req
->
vhost
);
if
(
hls_error_strategy
==
SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
)
{
srs_warn
(
"hls process audio message failed, ignore and disable hls. ret=%d"
,
ret
);
// unpublish, ignore ret.
...
...
@@ -1247,6 +1251,10 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
// ignore.
ret
=
ERROR_SUCCESS
;
}
else
{
srs_warn
(
"hls disconnect publisher for audio error. ret=%d"
,
ret
);
return
ret
;
}
}
#endif
...
...
@@ -1298,7 +1306,7 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
SrsAvcAacCodec
codec
;
SrsCodecSample
sample
;
if
((
ret
=
codec
.
audio_aac_demux
(
msg
.
payload
,
msg
.
size
,
&
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"codec demux audio failed. ret=%d"
,
ret
);
srs_error
(
"
source
codec demux audio failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -1349,7 +1357,11 @@ int SrsSource::on_video(SrsCommonMessage* __video)
srs_verbose
(
"initialize shared ptr video success."
);
#ifdef SRS_AUTO_HLS
if
((
ret
=
hls
->
on_video
(
&
msg
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
hls
->
on_video
(
msg
.
copy
()))
!=
ERROR_SUCCESS
)
{
// apply the error strategy for hls.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/264
std
::
string
hls_error_strategy
=
_srs_config
->
get_hls_on_error
(
_req
->
vhost
);
if
(
hls_error_strategy
==
SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
)
{
srs_warn
(
"hls process video message failed, ignore and disable hls. ret=%d"
,
ret
);
// unpublish, ignore ret.
...
...
@@ -1357,6 +1369,10 @@ int SrsSource::on_video(SrsCommonMessage* __video)
// ignore.
ret
=
ERROR_SUCCESS
;
}
else
{
srs_warn
(
"hls disconnect publisher for video error. ret=%d"
,
ret
);
return
ret
;
}
}
#endif
...
...
@@ -1406,7 +1422,7 @@ int SrsSource::on_video(SrsCommonMessage* __video)
SrsAvcAacCodec
codec
;
SrsCodecSample
sample
;
if
((
ret
=
codec
.
video_avc_demux
(
msg
.
payload
,
msg
.
size
,
&
sample
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"codec demux video failed. ret=%d"
,
ret
);
srs_error
(
"
source
codec demux video failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/src/core/srs_core.hpp
查看文件 @
eef8034
...
...
@@ -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 7
3
#define VERSION_REVISION 7
4
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
请
注册
或
登录
后发表评论