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 15:49:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83a9ff9f5dfe3f5fb933838cd5a147e2e5273916
83a9ff9f
1 parent
44bcb404
for #474, refine the hls publish, donot fetch from source when publish
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
18 行增加
和
13 行删除
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_hls.cpp
查看文件 @
83a9ff9
...
...
@@ -1252,7 +1252,7 @@ int SrsHls::initialize(SrsSource* s, ISrsHlsHandler* h)
return
ret
;
}
int
SrsHls
::
on_publish
(
SrsRequest
*
req
)
int
SrsHls
::
on_publish
(
SrsRequest
*
req
,
bool
fetch_sequence_header
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1282,12 +1282,16 @@ int SrsHls::on_publish(SrsRequest* req)
// ok, the hls can be dispose, or need to be dispose.
hls_can_dispose
=
true
;
// notice the source to get the cached sequence header.
// 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.
if
((
ret
=
source
->
on_hls_start
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"callback source hls start failed. ret=%d"
,
ret
);
return
ret
;
// when publish, don't need to fetch sequence header, which is old and maybe corrupt.
// when reload, we must fetch the sequence header from source cache.
if
(
fetch_sequence_header
)
{
// notice the source to get the cached sequence header.
// 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.
if
((
ret
=
source
->
on_hls_start
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"callback source hls start failed. ret=%d"
,
ret
);
return
ret
;
}
}
return
ret
;
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
83a9ff9
...
...
@@ -424,10 +424,11 @@ public:
*/
virtual
int
initialize
(
SrsSource
*
s
,
ISrsHlsHandler
*
h
);
/**
* publish stream event, continue to write the m3u8,
* for the muxer object not destroyed.
*/
virtual
int
on_publish
(
SrsRequest
*
req
);
* publish stream event, continue to write the m3u8,
* for the muxer object not destroyed.
* @param fetch_sequence_header whether fetch sequence from source.
*/
virtual
int
on_publish
(
SrsRequest
*
req
,
bool
fetch_sequence_header
);
/**
* the unpublish event, only close the muxer, donot destroy the
* muxer, for when we continue to publish, the m3u8 will continue.
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
83a9ff9
...
...
@@ -1180,7 +1180,7 @@ int SrsSource::on_reload_vhost_hls(string vhost)
#ifdef SRS_AUTO_HLS
hls
->
on_unpublish
();
if
((
ret
=
hls
->
on_publish
(
_req
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
hls
->
on_publish
(
_req
,
true
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hls publish failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -2039,7 +2039,7 @@ int SrsSource::on_publish()
// TODO: FIXME: use initialize to set req.
#ifdef SRS_AUTO_HLS
if
((
ret
=
hls
->
on_publish
(
_req
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
hls
->
on_publish
(
_req
,
false
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"start hls failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论