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-03-13 07:46:12 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
51967afb5292b6eac95028520f79e61178334830
51967afb
2 parents
984145de
643f18ab
Merge pull request #330 from wenjiegit/develop
HDS support reload,for #328
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
75 行增加
和
3 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_hds.cpp
trunk/src/app/srs_app_hds.hpp
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/src/app/srs_app_config.cpp
查看文件 @
51967af
...
...
@@ -826,6 +826,19 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
}
srs_trace
(
"vhost %s reload hls success."
,
vhost
.
c_str
());
}
// hds reload
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"hds"
),
old_vhost
->
get
(
"hds"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
ISrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_vhost_hds
(
vhost
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"vhost %s notify subscribes hds failed. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
}
srs_trace
(
"vhost %s reload hds success."
,
vhost
.
c_str
());
}
// dvr, only one per vhost
if
(
!
srs_directive_equals
(
new_vhost
->
get
(
"dvr"
),
old_vhost
->
get
(
"dvr"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
...
...
trunk/src/app/srs_app_hds.cpp
查看文件 @
51967af
...
...
@@ -267,6 +267,7 @@ SrsHds::SrsHds(SrsSource *s)
,
video_sh
(
NULL
)
,
audio_sh
(
NULL
)
,
hds_req
(
NULL
)
,
hds_enabled
(
false
)
{
}
...
...
@@ -278,9 +279,18 @@ SrsHds::~SrsHds()
int
SrsHds
::
on_publish
(
SrsRequest
*
req
)
{
// TODO: FIXME: check whether disabled.
// TODO: FIXME: support reload.
int
ret
=
ERROR_SUCCESS
;
if
(
hds_enabled
)
{
return
ret
;
}
std
::
string
vhost
=
req
->
vhost
;
if
(
!
_srs_config
->
get_hds_enabled
(
vhost
))
{
hds_enabled
=
false
;
return
ret
;
}
hds_enabled
=
true
;
hds_req
=
req
->
copy
();
return
flush_mainfest
();
...
...
@@ -290,6 +300,12 @@ int SrsHds::on_unpublish()
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
hds_enabled
)
{
return
ret
;
}
hds_enabled
=
false
;
srs_freep
(
video_sh
);
srs_freep
(
audio_sh
);
srs_freep
(
hds_req
);
...
...
@@ -313,6 +329,10 @@ int SrsHds::on_video(SrsSharedPtrMessage* msg)
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
hds_enabled
)
{
return
ret
;
}
if
(
SrsFlvCodec
::
video_is_sequence_header
(
msg
->
payload
,
msg
->
size
))
{
srs_freep
(
video_sh
);
video_sh
=
msg
->
copy
();
...
...
@@ -361,6 +381,10 @@ int SrsHds::on_audio(SrsSharedPtrMessage* msg)
{
int
ret
=
ERROR_SUCCESS
;
if
(
!
hds_enabled
)
{
return
ret
;
}
if
(
SrsFlvCodec
::
audio_is_sequence_header
(
msg
->
payload
,
msg
->
size
))
{
srs_freep
(
audio_sh
);
audio_sh
=
msg
->
copy
();
...
...
trunk/src/app/srs_app_hds.hpp
查看文件 @
51967af
...
...
@@ -61,6 +61,7 @@ private:
SrsSharedPtrMessage
*
audio_sh
;
SrsRequest
*
hds_req
;
bool
hds_enabled
;
};
#endif
...
...
trunk/src/app/srs_app_reload.cpp
查看文件 @
51967af
...
...
@@ -140,6 +140,11 @@ int ISrsReloadHandler::on_reload_vhost_hls(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_hds
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
}
int
ISrsReloadHandler
::
on_reload_vhost_dvr
(
string
/*vhost*/
)
{
return
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_reload.hpp
查看文件 @
51967af
...
...
@@ -65,6 +65,7 @@ public:
virtual
int
on_reload_vhost_time_jitter
(
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
);
virtual
int
on_reload_vhost_dvr
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_mr
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_mw
(
std
::
string
vhost
);
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
51967af
...
...
@@ -1013,6 +1013,26 @@ int SrsSource::on_reload_vhost_hls(string vhost)
return
ret
;
}
int
SrsSource
::
on_reload_vhost_hds
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
if
(
_req
->
vhost
!=
vhost
)
{
return
ret
;
}
#ifdef SRS_AUTO_HDS
hds
->
on_unpublish
();
if
((
ret
=
hds
->
on_publish
(
_req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hds publish failed. ret=%d"
,
ret
);
return
ret
;
}
srs_trace
(
"vhost %s hds reload success"
,
vhost
.
c_str
());
#endif
return
ret
;
}
int
SrsSource
::
on_reload_vhost_dvr
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
51967af
...
...
@@ -476,6 +476,7 @@ public:
virtual
int
on_reload_vhost_time_jitter
(
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
);
virtual
int
on_reload_vhost_dvr
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_transcode
(
std
::
string
vhost
);
// for the tools callback
...
...
trunk/src/utest/srs_utest_reload.cpp
查看文件 @
51967af
...
...
@@ -266,6 +266,12 @@ int MockReloadHandler::on_reload_vhost_hls(string /*vhost*/)
return
ERROR_SUCCESS
;
}
int
MockReloadHandler
::
on_reload_vhost_hds
(
string
/*vhost*/
)
{
vhost_hls_reloaded
=
true
;
return
ERROR_SUCCESS
;
}
int
MockReloadHandler
::
on_reload_vhost_dvr
(
string
/*vhost*/
)
{
vhost_dvr_reloaded
=
true
;
...
...
trunk/src/utest/srs_utest_reload.hpp
查看文件 @
51967af
...
...
@@ -91,6 +91,7 @@ public:
virtual
int
on_reload_vhost_time_jitter
(
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
);
virtual
int
on_reload_vhost_dvr
(
std
::
string
vhost
);
virtual
int
on_reload_vhost_transcode
(
std
::
string
vhost
);
virtual
int
on_reload_ingest_removed
(
std
::
string
vhost
,
std
::
string
ingest_id
);
...
...
请
注册
或
登录
后发表评论