mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
merge from srs2.
This commit is contained in:
commit
0ab64ccd2a
3 changed files with 25 additions and 7 deletions
|
@ -928,12 +928,12 @@ vhost with-hls.srs.com {
|
|||
# default: 60
|
||||
hls_window 60;
|
||||
# the error strategy. canbe:
|
||||
# ignore, when error ignore and disable hls.
|
||||
# disconnect, when error disconnect the publish connection.
|
||||
# continue, when error ignore and continue output hls.
|
||||
# ignore, disable the hls.
|
||||
# disconnect, require encoder republish.
|
||||
# continue, ignore failed try to continue output hls.
|
||||
# @see https://github.com/ossrs/srs/issues/264
|
||||
# default: ignore
|
||||
hls_on_error ignore;
|
||||
# default: continue
|
||||
hls_on_error continue;
|
||||
# the hls storage: disk, ram or both.
|
||||
# disk, to write hls m3u8/ts to disk.
|
||||
# ram, serve m3u8/ts in memory, which use embeded http server to delivery.
|
||||
|
|
|
@ -6002,7 +6002,8 @@ double SrsConfig::get_hls_window(string vhost)
|
|||
|
||||
string SrsConfig::get_hls_on_error(string vhost)
|
||||
{
|
||||
static string DEFAULT = "ignore";
|
||||
// try to ignore the error.
|
||||
static string DEFAULT = "continue";
|
||||
|
||||
SrsConfDirective* conf = get_hls(vhost);
|
||||
if (!conf) {
|
||||
|
|
|
@ -1770,6 +1770,23 @@ int SrsSource::on_video(SrsCommonMessage* shared_video)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool srs_hls_can_continue(int ret, SrsSharedPtrMessage* sh, SrsSharedPtrMessage* video)
|
||||
{
|
||||
// only continue for decode error.
|
||||
if (ret != ERROR_HLS_DECODE_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// when video size equals to sequence header,
|
||||
// the video actually maybe a sequence header,
|
||||
// continue to make ffmpeg happy.
|
||||
if (sh && sh->size == video->size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -1834,7 +1851,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
|
|||
ret = ERROR_SUCCESS;
|
||||
} else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
|
||||
// compare the sequence header with video, continue when it's actually an sequence header.
|
||||
if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg->size) {
|
||||
if (srs_hls_can_continue(ret, cache_sh_video, msg)) {
|
||||
srs_warn("the video is actually a sequence header, ignore this packet.");
|
||||
ret = ERROR_SUCCESS;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue