winlin

refine config default values of srs, prepare to move each default values to functions.

@@ -55,11 +55,98 @@ using namespace _srs_internal; @@ -55,11 +55,98 @@ using namespace _srs_internal;
55 #define SRS_CONF_PERFER_FALSE(conf_arg) conf_arg == "on" 55 #define SRS_CONF_PERFER_FALSE(conf_arg) conf_arg == "on"
56 #define SRS_CONF_PERFER_TRUE(conf_arg) conf_arg != "off" 56 #define SRS_CONF_PERFER_TRUE(conf_arg) conf_arg != "off"
57 57
  58 +///////////////////////////////////////////////////////////
  59 +// default consts values
  60 +///////////////////////////////////////////////////////////
  61 +#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid"
  62 +#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log"
  63 +#define SRS_CONF_DEFAULT_LOG_LEVEL "trace"
  64 +#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console"
  65 +#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf"
  66 +#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs"
  67 +#define SRS_CONF_DEFAULT_UTC_TIME false
  68 +
  69 +#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 1000
  70 +#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
  71 +#define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8"
  72 +#define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts"
  73 +#define SRS_CONF_DEFAULT_HLS_TS_FLOOR false
  74 +#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10
  75 +#define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5
  76 +#define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0
  77 +#define SRS_CONF_DEFAULT_HLS_WINDOW 60
  78 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore"
  79 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect"
  80 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue"
  81 +#define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE
  82 +#define SRS_CONF_DEFAULT_HLS_STORAGE "disk"
  83 +#define SRS_CONF_DEFAULT_HLS_MOUNT "[vhost]/[app]/[stream].m3u8"
  84 +#define SRS_CONF_DEFAULT_HLS_ACODEC "aac"
  85 +#define SRS_CONF_DEFAULT_HLS_VCODEC "h264"
  86 +#define SRS_CONF_DEFAULT_HLS_CLEANUP true
  87 +#define SRS_CONF_DEFAULT_HLS_WAIT_KEYFRAME true
  88 +#define SRS_CONF_DEFAULT_HLS_NB_NOTIFY 64
  89 +#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html/[app]/[stream].[timestamp].flv"
  90 +#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"
  91 +#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment"
  92 +#define SRS_CONF_DEFAULT_DVR_PLAN_APPEND "append"
  93 +#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION
  94 +#define SRS_CONF_DEFAULT_DVR_DURATION 30
  95 +#define SRS_CONF_DEFAULT_TIME_JITTER "full"
  96 +#define SRS_CONF_DEFAULT_ATC_AUTO true
  97 +#define SRS_CONF_DEFAULT_MIX_CORRECT false
  98 +// in seconds, the paused queue length.
  99 +#define SRS_CONF_DEFAULT_PAUSED_LENGTH 10
  100 +// the interval in seconds for bandwidth check
  101 +#define SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL 30
  102 +// the interval in seconds for bandwidth check
  103 +#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000
  104 +
  105 +#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/"
  106 +#define SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT "[vhost]/[app]/[stream].flv"
  107 +#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH
  108 +#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 0
  109 +
  110 +#define SRS_CONF_DEFAULT_HTTP_STREAM_PORT "8080"
  111 +#define SRS_CONF_DEFAULT_HTTP_API_PORT "1985"
  112 +#define SRS_CONF_DEFAULT_HTTP_API_CROSSDOMAIN true
  113 +
  114 +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false
  115 +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9
  116 +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers"
  117 +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false
  118 +
  119 +#define SRS_CONF_DEFAULT_SECURITY_ENABLED false
  120 +
  121 +#define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false
  122 +#define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp"
  123 +#define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp"
  124 +#define SRS_CONF_DEFAULT_STREAM_CASTER_FLV "flv"
  125 +
  126 +#define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0
  127 +
  128 +#define SRS_CONF_DEFAULT_PITHY_PRINT_MS 10000
  129 +
  130 +#define SRS_CONF_DEFAULT_INGEST_TYPE_FILE "file"
  131 +#define SRS_CONF_DEFAULT_INGEST_TYPE_STREAM "stream"
  132 +
  133 +#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv"
  134 +#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv"
  135 +
  136 +#define SRS_CONF_DEFAULT_EDGE_MODE false
  137 +#define SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE false
  138 +#define SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST "[vhost]"
  139 +
  140 +// hds default value
  141 +#define SRS_CONF_DEFAULT_HDS_PATH "./objs/nginx/html"
  142 +#define SRS_CONF_DEFAULT_HDS_WINDOW (60)
  143 +#define SRS_CONF_DEFAULT_HDS_FRAGMENT (10)
  144 +
58 // '\n' 145 // '\n'
59 -#define SRS_LF (char)0x0a 146 +#define SRS_LF (char)SRS_CONSTS_LF
60 147
61 // '\r' 148 // '\r'
62 -#define SRS_CR (char)0x0d 149 +#define SRS_CR (char)SRS_CONSTS_CR
63 150
64 bool is_common_space(char ch) 151 bool is_common_space(char ch)
65 { 152 {
@@ -4284,3 +4371,37 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b) @@ -4284,3 +4371,37 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b)
4284 return true; 4371 return true;
4285 } 4372 }
4286 4373
  4374 +bool srs_config_hls_is_on_error_ignore(string strategy)
  4375 +{
  4376 + return strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE;
  4377 +}
  4378 +
  4379 +bool srs_config_hls_is_on_error_continue(string strategy)
  4380 +{
  4381 + return strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE;
  4382 +}
  4383 +
  4384 +bool srs_config_ingest_is_file(string type)
  4385 +{
  4386 + return type == SRS_CONF_DEFAULT_INGEST_TYPE_FILE;
  4387 +}
  4388 +
  4389 +bool srs_config_ingest_is_stream(string type)
  4390 +{
  4391 + return type == SRS_CONF_DEFAULT_INGEST_TYPE_STREAM;
  4392 +}
  4393 +
  4394 +bool srs_config_dvr_is_plan_segment(string plan)
  4395 +{
  4396 + return plan == SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT;
  4397 +}
  4398 +
  4399 +bool srs_config_dvr_is_plan_session(string plan)
  4400 +{
  4401 + return plan == SRS_CONF_DEFAULT_DVR_PLAN_SESSION;
  4402 +}
  4403 +
  4404 +bool srs_config_dvr_is_plan_append(string plan)
  4405 +{
  4406 + return plan == SRS_CONF_DEFAULT_DVR_PLAN_APPEND;
  4407 +}
@@ -34,93 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -34,93 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 34
35 #include <srs_app_reload.hpp> 35 #include <srs_app_reload.hpp>
36 36
37 -///////////////////////////////////////////////////////////  
38 -// default consts values  
39 -///////////////////////////////////////////////////////////  
40 -#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid"  
41 -#define SRS_CONF_DEFAULT_LOG_FILE "./objs/srs.log"  
42 -#define SRS_CONF_DEFAULT_LOG_LEVEL "trace"  
43 -#define SRS_CONF_DEFAULT_LOG_TANK_CONSOLE "console"  
44 -#define SRS_CONF_DEFAULT_COFNIG_FILE "conf/srs.conf"  
45 -#define SRS_CONF_DEFAULT_FF_LOG_DIR "./objs"  
46 -#define SRS_CONF_DEFAULT_UTC_TIME false  
47 -  
48 -#define SRS_CONF_DEFAULT_MAX_CONNECTIONS 1000  
49 -#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"  
50 -#define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8"  
51 -#define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts"  
52 -#define SRS_CONF_DEFAULT_HLS_TS_FLOOR false  
53 -#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10  
54 -#define SRS_CONF_DEFAULT_HLS_TD_RATIO 1.5  
55 -#define SRS_CONF_DEFAULT_HLS_AOF_RATIO 2.0  
56 -#define SRS_CONF_DEFAULT_HLS_WINDOW 60  
57 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE "ignore"  
58 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect"  
59 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue"  
60 -#define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE  
61 -#define SRS_CONF_DEFAULT_HLS_STORAGE "disk"  
62 -#define SRS_CONF_DEFAULT_HLS_MOUNT "[vhost]/[app]/[stream].m3u8"  
63 -#define SRS_CONF_DEFAULT_HLS_ACODEC "aac"  
64 -#define SRS_CONF_DEFAULT_HLS_VCODEC "h264"  
65 -#define SRS_CONF_DEFAULT_HLS_CLEANUP true  
66 -#define SRS_CONF_DEFAULT_HLS_WAIT_KEYFRAME true  
67 -#define SRS_CONF_DEFAULT_HLS_NB_NOTIFY 64  
68 -#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html/[app]/[stream].[timestamp].flv"  
69 -#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"  
70 -#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment"  
71 -#define SRS_CONF_DEFAULT_DVR_PLAN_APPEND "append"  
72 -#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION  
73 -#define SRS_CONF_DEFAULT_DVR_DURATION 30  
74 -#define SRS_CONF_DEFAULT_TIME_JITTER "full"  
75 -#define SRS_CONF_DEFAULT_ATC_AUTO true  
76 -#define SRS_CONF_DEFAULT_MIX_CORRECT false  
77 -// in seconds, the paused queue length.  
78 -#define SRS_CONF_DEFAULT_PAUSED_LENGTH 10  
79 -// the interval in seconds for bandwidth check  
80 -#define SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL 30  
81 -// the interval in seconds for bandwidth check  
82 -#define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000  
83 -  
84 -#define SRS_CONF_DEFAULT_HTTP_MOUNT "[vhost]/"  
85 -#define SRS_CONF_DEFAULT_HTTP_REMUX_MOUNT "[vhost]/[app]/[stream].flv"  
86 -#define SRS_CONF_DEFAULT_HTTP_DIR SRS_CONF_DEFAULT_HLS_PATH  
87 -#define SRS_CONF_DEFAULT_HTTP_AUDIO_FAST_CACHE 0  
88 -  
89 -#define SRS_CONF_DEFAULT_HTTP_STREAM_PORT "8080"  
90 -#define SRS_CONF_DEFAULT_HTTP_API_PORT "1985"  
91 -#define SRS_CONF_DEFAULT_HTTP_API_CROSSDOMAIN true  
92 -  
93 -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false  
94 -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9  
95 -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://"SRS_CONSTS_LOCALHOST":8085/api/v1/servers"  
96 -#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false  
97 -  
98 -#define SRS_CONF_DEFAULT_SECURITY_ENABLED false  
99 -  
100 -#define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false  
101 -#define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp"  
102 -#define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp"  
103 -#define SRS_CONF_DEFAULT_STREAM_CASTER_FLV "flv"  
104 -  
105 -#define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0  
106 -  
107 -#define SRS_CONF_DEFAULT_PITHY_PRINT_MS 10000  
108 -  
109 -#define SRS_CONF_DEFAULT_INGEST_TYPE_FILE "file"  
110 -#define SRS_CONF_DEFAULT_INGEST_TYPE_STREAM "stream"  
111 -  
112 -#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv"  
113 -#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv"  
114 -  
115 -#define SRS_CONF_DEFAULT_EDGE_MODE false  
116 -#define SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE false  
117 -#define SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST "[vhost]"  
118 -  
119 -// hds default value  
120 -#define SRS_CONF_DEFAULT_HDS_PATH "./objs/nginx/html"  
121 -#define SRS_CONF_DEFAULT_HDS_WINDOW (60)  
122 -#define SRS_CONF_DEFAULT_HDS_FRAGMENT (10)  
123 -  
124 namespace _srs_internal 37 namespace _srs_internal
125 { 38 {
126 class SrsConfigBuffer; 39 class SrsConfigBuffer;
@@ -1218,7 +1131,18 @@ namespace _srs_internal @@ -1218,7 +1131,18 @@ namespace _srs_internal
1218 /** 1131 /**
1219 * deep compare directive. 1132 * deep compare directive.
1220 */ 1133 */
1221 -bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b); 1134 +extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
  1135 +
  1136 +/**
  1137 + * helper utilities, used for compare the consts values.
  1138 + */
  1139 +extern bool srs_config_hls_is_on_error_ignore(std::string strategy);
  1140 +extern bool srs_config_hls_is_on_error_continue(std::string strategy);
  1141 +extern bool srs_config_ingest_is_file(std::string type);
  1142 +extern bool srs_config_ingest_is_stream(std::string type);
  1143 +extern bool srs_config_dvr_is_plan_segment(std::string plan);
  1144 +extern bool srs_config_dvr_is_plan_session(std::string plan);
  1145 +extern bool srs_config_dvr_is_plan_append(std::string plan);
1222 1146
1223 // global config 1147 // global config
1224 extern SrsConfig* _srs_config; 1148 extern SrsConfig* _srs_config;
@@ -639,11 +639,11 @@ int SrsDvrPlan::on_reap_segment() @@ -639,11 +639,11 @@ int SrsDvrPlan::on_reap_segment()
639 SrsDvrPlan* SrsDvrPlan::create_plan(string vhost) 639 SrsDvrPlan* SrsDvrPlan::create_plan(string vhost)
640 { 640 {
641 std::string plan = _srs_config->get_dvr_plan(vhost); 641 std::string plan = _srs_config->get_dvr_plan(vhost);
642 - if (plan == SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT) { 642 + if (srs_config_dvr_is_plan_segment(plan)) {
643 return new SrsDvrSegmentPlan(); 643 return new SrsDvrSegmentPlan();
644 - } else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_SESSION) { 644 + } else if (srs_config_dvr_is_plan_session(plan)) {
645 return new SrsDvrSessionPlan(); 645 return new SrsDvrSessionPlan();
646 - } else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_APPEND) { 646 + } else if (srs_config_dvr_is_plan_append(plan)) {
647 return new SrsDvrAppendPlan(); 647 return new SrsDvrAppendPlan();
648 } else { 648 } else {
649 srs_error("invalid dvr plan=%s, vhost=%s", plan.c_str(), vhost.c_str()); 649 srs_error("invalid dvr plan=%s, vhost=%s", plan.c_str(), vhost.c_str());
@@ -369,7 +369,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S @@ -369,7 +369,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
369 return ret; 369 return ret;
370 } 370 }
371 371
372 - if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_FILE) { 372 + if (srs_config_ingest_is_file(input_type)) {
373 std::string input_url = _srs_config->get_ingest_input_url(ingest); 373 std::string input_url = _srs_config->get_ingest_input_url(ingest);
374 if (input_url.empty()) { 374 if (input_url.empty()) {
375 ret = ERROR_ENCODER_NO_INPUT; 375 ret = ERROR_ENCODER_NO_INPUT;
@@ -383,7 +383,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S @@ -383,7 +383,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
383 if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { 383 if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) {
384 return ret; 384 return ret;
385 } 385 }
386 - } else if (input_type == SRS_CONF_DEFAULT_INGEST_TYPE_STREAM) { 386 + } else if (srs_config_ingest_is_stream(input_type)) {
387 std::string input_url = _srs_config->get_ingest_input_url(ingest); 387 std::string input_url = _srs_config->get_ingest_input_url(ingest);
388 if (input_url.empty()) { 388 if (input_url.empty()) {
389 ret = ERROR_ENCODER_NO_INPUT; 389 ret = ERROR_ENCODER_NO_INPUT;
@@ -1522,7 +1522,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) @@ -1522,7 +1522,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
1522 // apply the error strategy for hls. 1522 // apply the error strategy for hls.
1523 // @see https://github.com/simple-rtmp-server/srs/issues/264 1523 // @see https://github.com/simple-rtmp-server/srs/issues/264
1524 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost); 1524 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost);
1525 - if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE) { 1525 + if (srs_config_hls_is_on_error_ignore(hls_error_strategy)) {
1526 srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); 1526 srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret);
1527 1527
1528 // unpublish, ignore ret. 1528 // unpublish, ignore ret.
@@ -1530,7 +1530,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg) @@ -1530,7 +1530,7 @@ int SrsSource::on_audio_imp(SrsSharedPtrMessage* msg)
1530 1530
1531 // ignore. 1531 // ignore.
1532 ret = ERROR_SUCCESS; 1532 ret = ERROR_SUCCESS;
1533 - } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) { 1533 + } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
1534 // compare the sequence header with audio, continue when it's actually an sequence header. 1534 // compare the sequence header with audio, continue when it's actually an sequence header.
1535 if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_audio && cache_sh_audio->size == msg->size) { 1535 if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_audio && cache_sh_audio->size == msg->size) {
1536 srs_warn("the audio is actually a sequence header, ignore this packet."); 1536 srs_warn("the audio is actually a sequence header, ignore this packet.");
@@ -1726,7 +1726,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) @@ -1726,7 +1726,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1726 // apply the error strategy for hls. 1726 // apply the error strategy for hls.
1727 // @see https://github.com/simple-rtmp-server/srs/issues/264 1727 // @see https://github.com/simple-rtmp-server/srs/issues/264
1728 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost); 1728 std::string hls_error_strategy = _srs_config->get_hls_on_error(_req->vhost);
1729 - if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE) { 1729 + if (srs_config_hls_is_on_error_ignore(hls_error_strategy)) {
1730 srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); 1730 srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret);
1731 1731
1732 // unpublish, ignore ret. 1732 // unpublish, ignore ret.
@@ -1734,7 +1734,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg) @@ -1734,7 +1734,7 @@ int SrsSource::on_video_imp(SrsSharedPtrMessage* msg)
1734 1734
1735 // ignore. 1735 // ignore.
1736 ret = ERROR_SUCCESS; 1736 ret = ERROR_SUCCESS;
1737 - } else if (hls_error_strategy == SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE) { 1737 + } else if (srs_config_hls_is_on_error_continue(hls_error_strategy)) {
1738 // compare the sequence header with video, continue when it's actually an sequence header. 1738 // compare the sequence header with video, continue when it's actually an sequence header.
1739 if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg->size) { 1739 if (ret == ERROR_HLS_DECODE_ERROR && cache_sh_video && cache_sh_video->size == msg->size) {
1740 srs_warn("the video is actually a sequence header, ignore this packet."); 1740 srs_warn("the video is actually a sequence header, ignore this packet.");