winlin

refine the config

@@ -1257,120 +1257,118 @@ int SrsConfig::check_config() @@ -1257,120 +1257,118 @@ int SrsConfig::check_config()
1257 } 1257 }
1258 } 1258 }
1259 } 1259 }
1260 - if (true) {  
1261 - for (int i = 0; i < (int)vhosts.size(); i++) {  
1262 - SrsConfDirective* conf = vhosts[i];  
1263 - for (int i = 0; conf && i < (int)conf->directives.size(); i++) {  
1264 - SrsConfDirective* conf0 = conf->at(i);  
1265 - string n = conf0->name;  
1266 - if (n != "enabled" && n != "chunk_size"  
1267 - && n != "mode" && n != "origin" && n != "token_traverse"  
1268 - && n != "dvr" && n != "ingest" && n != "http" && n != "hls" && n != "http_hooks"  
1269 - && n != "gop_cache" && n != "queue_length"  
1270 - && n != "refer" && n != "refer_publish" && n != "refer_play"  
1271 - && n != "forward" && n != "transcode" && n != "bandcheck"  
1272 - && n != "time_jitter"  
1273 - && n != "atc" && n != "atc_auto"  
1274 - ) {  
1275 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1276 - srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);  
1277 - return ret; 1260 + for (int i = 0; i < (int)vhosts.size(); i++) {
  1261 + SrsConfDirective* conf = vhosts[i];
  1262 + for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
  1263 + SrsConfDirective* conf0 = conf->at(i);
  1264 + string n = conf0->name;
  1265 + if (n != "enabled" && n != "chunk_size"
  1266 + && n != "mode" && n != "origin" && n != "token_traverse"
  1267 + && n != "dvr" && n != "ingest" && n != "http" && n != "hls" && n != "http_hooks"
  1268 + && n != "gop_cache" && n != "queue_length"
  1269 + && n != "refer" && n != "refer_publish" && n != "refer_play"
  1270 + && n != "forward" && n != "transcode" && n != "bandcheck"
  1271 + && n != "time_jitter"
  1272 + && n != "atc" && n != "atc_auto"
  1273 + ) {
  1274 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1275 + srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
  1276 + return ret;
  1277 + }
  1278 + // for each sub directives of vhost.
  1279 + if (n == "dvr") {
  1280 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1281 + string m = conf0->at(j)->name.c_str();
  1282 + if (m != "enabled" && m != "dvr_path" && m != "dvr_plan"
  1283 + && m != "dvr_duration" && m != "time_jitter"
  1284 + ) {
  1285 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1286 + srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);
  1287 + return ret;
  1288 + }
1278 } 1289 }
1279 - // for each sub directives of vhost.  
1280 - if (n == "dvr") {  
1281 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1282 - string m = conf0->at(j)->name.c_str();  
1283 - if (m != "enabled" && m != "dvr_path" && m != "dvr_plan"  
1284 - && m != "dvr_duration" && m != "time_jitter"  
1285 - ) {  
1286 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1287 - srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);  
1288 - return ret;  
1289 - } 1290 + } else if (n == "ingest") {
  1291 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1292 + string m = conf0->at(j)->name.c_str();
  1293 + if (m != "enabled" && m != "input" && m != "ffmpeg"
  1294 + && m != "engine"
  1295 + ) {
  1296 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1297 + srs_error("unsupported vhost ingest directive %s, ret=%d", m.c_str(), ret);
  1298 + return ret;
1290 } 1299 }
1291 - } else if (n == "ingest") {  
1292 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1293 - string m = conf0->at(j)->name.c_str();  
1294 - if (m != "enabled" && m != "input" && m != "ffmpeg"  
1295 - && m != "engine"  
1296 - ) {  
1297 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1298 - srs_error("unsupported vhost ingest directive %s, ret=%d", m.c_str(), ret);  
1299 - return ret;  
1300 - } 1300 + }
  1301 + } else if (n == "http") {
  1302 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1303 + string m = conf0->at(j)->name.c_str();
  1304 + if (m != "enabled" && m != "mount" && m != "dir") {
  1305 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1306 + srs_error("unsupported vhost http directive %s, ret=%d", m.c_str(), ret);
  1307 + return ret;
1301 } 1308 }
1302 - } else if (n == "http") {  
1303 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1304 - string m = conf0->at(j)->name.c_str();  
1305 - if (m != "enabled" && m != "mount" && m != "dir") {  
1306 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1307 - srs_error("unsupported vhost http directive %s, ret=%d", m.c_str(), ret);  
1308 - return ret;  
1309 - } 1309 + }
  1310 + } else if (n == "hls") {
  1311 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1312 + string m = conf0->at(j)->name.c_str();
  1313 + if (m != "enabled" && m != "hls_path" && m != "hls_fragment" && m != "hls_window") {
  1314 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1315 + srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret);
  1316 + return ret;
1310 } 1317 }
1311 - } else if (n == "hls") {  
1312 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1313 - string m = conf0->at(j)->name.c_str();  
1314 - if (m != "enabled" && m != "hls_path" && m != "hls_fragment" && m != "hls_window") {  
1315 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1316 - srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret);  
1317 - return ret;  
1318 - } 1318 + }
  1319 + } else if (n == "http_hooks") {
  1320 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1321 + string m = conf0->at(j)->name.c_str();
  1322 + if (m != "enabled" && m != "on_connect" && m != "on_close" && m != "on_publish"
  1323 + && m != "on_unpublish" && m != "on_play" && m != "on_stop" && m != "on_dvr_hss_reap_flv"
  1324 + ) {
  1325 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1326 + srs_error("unsupported vhost http_hooks directive %s, ret=%d", m.c_str(), ret);
  1327 + return ret;
1319 } 1328 }
1320 - } else if (n == "http_hooks") {  
1321 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1322 - string m = conf0->at(j)->name.c_str();  
1323 - if (m != "enabled" && m != "on_connect" && m != "on_close" && m != "on_publish"  
1324 - && m != "on_unpublish" && m != "on_play" && m != "on_stop" && m != "on_dvr_hss_reap_flv"  
1325 - ) {  
1326 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1327 - srs_error("unsupported vhost http_hooks directive %s, ret=%d", m.c_str(), ret);  
1328 - return ret;  
1329 - } 1329 + }
  1330 + } else if (n == "forward") {
  1331 + // TODO: FIXME: implements it.
  1332 + /*for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1333 + string m = conf0->at(j)->name.c_str();
  1334 + if (m != "enabled" && m != "vhost" && m != "refer") {
  1335 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1336 + srs_error("unsupported vhost forward directive %s, ret=%d", m.c_str(), ret);
  1337 + return ret;
1330 } 1338 }
1331 - } else if (n == "forward") {  
1332 - // TODO: FIXME: implements it.  
1333 - /*for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1334 - string m = conf0->at(j)->name.c_str();  
1335 - if (m != "enabled" && m != "vhost" && m != "refer") {  
1336 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1337 - srs_error("unsupported vhost forward directive %s, ret=%d", m.c_str(), ret);  
1338 - return ret;  
1339 - }  
1340 - }*/  
1341 - } else if (n == "transcode") {  
1342 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1343 - SrsConfDirective* conf1 = conf0->at(j);  
1344 - string m = conf1->name.c_str();  
1345 - if (m != "enabled" && m != "ffmpeg" && m != "engine") {  
1346 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1347 - srs_error("unsupported vhost transcode directive %s, ret=%d", m.c_str(), ret);  
1348 - return ret;  
1349 - }  
1350 - if (m == "engine") {  
1351 - for (int k = 0; k < (int)conf1->directives.size(); k++) {  
1352 - string e = conf1->at(k)->name;  
1353 - if (e != "enabled" && e != "vfilter" && e != "vcodec"  
1354 - && e != "vbitrate" && e != "vfps" && e != "vwidth" && e != "vheight"  
1355 - && e != "vthreads" && e != "vprofile" && e != "vpreset" && e != "vparams"  
1356 - && e != "acodec" && e != "abitrate" && e != "asample_rate" && e != "achannels"  
1357 - && e != "aparams" && e != "output"  
1358 - ) {  
1359 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1360 - srs_error("unsupported vhost transcode engine directive %s, ret=%d", e.c_str(), ret);  
1361 - return ret;  
1362 - } 1339 + }*/
  1340 + } else if (n == "transcode") {
  1341 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1342 + SrsConfDirective* conf1 = conf0->at(j);
  1343 + string m = conf1->name.c_str();
  1344 + if (m != "enabled" && m != "ffmpeg" && m != "engine") {
  1345 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1346 + srs_error("unsupported vhost transcode directive %s, ret=%d", m.c_str(), ret);
  1347 + return ret;
  1348 + }
  1349 + if (m == "engine") {
  1350 + for (int k = 0; k < (int)conf1->directives.size(); k++) {
  1351 + string e = conf1->at(k)->name;
  1352 + if (e != "enabled" && e != "vfilter" && e != "vcodec"
  1353 + && e != "vbitrate" && e != "vfps" && e != "vwidth" && e != "vheight"
  1354 + && e != "vthreads" && e != "vprofile" && e != "vpreset" && e != "vparams"
  1355 + && e != "acodec" && e != "abitrate" && e != "asample_rate" && e != "achannels"
  1356 + && e != "aparams" && e != "output"
  1357 + ) {
  1358 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1359 + srs_error("unsupported vhost transcode engine directive %s, ret=%d", e.c_str(), ret);
  1360 + return ret;
1363 } 1361 }
1364 } 1362 }
1365 } 1363 }
1366 - } else if (n == "bandcheck") {  
1367 - for (int j = 0; j < (int)conf0->directives.size(); j++) {  
1368 - string m = conf0->at(j)->name.c_str();  
1369 - if (m != "enabled" && m != "key" && m != "interval" && m != "limit_kbps") {  
1370 - ret = ERROR_SYSTEM_CONFIG_INVALID;  
1371 - srs_error("unsupported vhost bandcheck directive %s, ret=%d", m.c_str(), ret);  
1372 - return ret;  
1373 - } 1364 + }
  1365 + } else if (n == "bandcheck") {
  1366 + for (int j = 0; j < (int)conf0->directives.size(); j++) {
  1367 + string m = conf0->at(j)->name.c_str();
  1368 + if (m != "enabled" && m != "key" && m != "interval" && m != "limit_kbps") {
  1369 + ret = ERROR_SYSTEM_CONFIG_INVALID;
  1370 + srs_error("unsupported vhost bandcheck directive %s, ret=%d", m.c_str(), ret);
  1371 + return ret;
1374 } 1372 }
1375 } 1373 }
1376 } 1374 }
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "169" 34 +#define VERSION_REVISION "170"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"