mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #474, refine the hls publish, donot fetch from source when publish
This commit is contained in:
parent
44bcb4045f
commit
83a9ff9f5d
3 changed files with 18 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue