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
2013-12-15 13:07:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fb67f9116781a9feadfc3456136802de8be52a07
fb67f911
1 parent
aaba290c
support reload the hls/forwarder/transcoder
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
79 行增加
和
0 行删除
trunk/src/core/srs_core_config.cpp
trunk/src/core/srs_core_reload.cpp
trunk/src/core/srs_core_reload.hpp
trunk/src/core/srs_core_source.cpp
trunk/src/core/srs_core_source.hpp
trunk/src/core/srs_core_config.cpp
查看文件 @
fb67f91
...
...
@@ -559,6 +559,28 @@ int SrsConfig::reload()
}
srs_trace
(
"vhost %s reload forward success."
,
vhost
.
c_str
());
}
// hls
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"hls"
),
old_vhost
->
get
(
"hls"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_hls
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes hls failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload hls success."
,
vhost
.
c_str
());
}
// transcode
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"transcode"
),
old_vhost
->
get
(
"transcode"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_transcode
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes transcode failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload transcode success."
,
vhost
.
c_str
());
}
// TODO: suppor reload hls/forward/ffmpeg/http
continue
;
}
...
...
trunk/src/core/srs_core_reload.cpp
查看文件 @
fb67f91
...
...
@@ -60,3 +60,13 @@ int ISrsReloadHandler::on_reload_forward(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_hls
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_transcode
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
...
...
trunk/src/core/srs_core_reload.hpp
查看文件 @
fb67f91
...
...
@@ -45,6 +45,8 @@ public:
virtual
int
on_reload_vhost_removed
(
std
::
string
vhost
);
virtual
int
on_reload_gop_cache
(
std
::
string
vhost
);
virtual
int
on_reload_forward
(
std
::
string
vhost
);
virtual
int
on_reload_hls
(
std
::
string
vhost
);
virtual
int
on_reload_transcode
(
std
::
string
vhost
);
};
#endif
\ No newline at end of file
...
...
trunk/src/core/srs_core_source.cpp
查看文件 @
fb67f91
...
...
@@ -455,6 +455,47 @@ int SrsSource::on_reload_forward(string vhost)
return
ret
;
}
int
SrsSource
::
on_reload_hls
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
if
(
req
->
vhost
!=
vhost
)
{
return
ret
;
}
// TODO: HLS should continue previous sequence and stream.
#ifdef SRS_HLS
hls
->
on_unpublish
();
if
((
ret
=
hls
->
on_publish
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hls publish failed. ret=%d"
,
ret
);
return
ret
;
}
srs_trace
(
"vhost %s hls reload success"
,
vhost
.
c_str
());
#endif
return
ret
;
}
int
SrsSource
::
on_reload_transcode
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
if
(
req
->
vhost
!=
vhost
)
{
return
ret
;
}
#ifdef SRS_FFMPEG
encoder
->
on_unpublish
();
if
((
ret
=
encoder
->
on_publish
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"start encoder failed. ret=%d"
,
ret
);
return
ret
;
}
srs_trace
(
"vhost %s transcode reload success"
,
vhost
.
c_str
());
#endif
return
ret
;
}
bool
SrsSource
::
can_publish
()
{
return
_can_publish
;
...
...
@@ -697,12 +738,14 @@ int SrsSource::on_publish(SrsRequest* _req)
#ifdef SRS_FFMPEG
if
((
ret
=
encoder
->
on_publish
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"start encoder failed. ret=%d"
,
ret
);
return
ret
;
}
#endif
#ifdef SRS_HLS
if
((
ret
=
hls
->
on_publish
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"start hls failed. ret=%d"
,
ret
);
return
ret
;
}
#endif
...
...
trunk/src/core/srs_core_source.hpp
查看文件 @
fb67f91
...
...
@@ -219,6 +219,8 @@ public:
public:
virtual
int
on_reload_gop_cache
(
std
::
string
vhost
);
virtual
int
on_reload_forward
(
std
::
string
vhost
);
virtual
int
on_reload_hls
(
std
::
string
vhost
);
virtual
int
on_reload_transcode
(
std
::
string
vhost
);
public
:
virtual
bool
can_publish
();
virtual
int
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
);
...
...
请
注册
或
登录
后发表评论