for #319, the vhost scope config is enabled, chunk_size, tcp_nodelay and min_latency.
正在显示
5 个修改的文件
包含
311 行增加
和
296 行删除
| @@ -230,6 +230,71 @@ stream_caster { | @@ -230,6 +230,71 @@ stream_caster { | ||
| 230 | vhost __defaultVhost__ { | 230 | vhost __defaultVhost__ { |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | +# the vhost scope configs. | ||
| 234 | +vhost scope.vhost.srs.com { | ||
| 235 | + # whether the vhost is enabled. | ||
| 236 | + # if off, all request access denied. | ||
| 237 | + # default: on | ||
| 238 | + enabled off; | ||
| 239 | + | ||
| 240 | + # whether enable min delay mode for vhost. | ||
| 241 | + # for min latence mode: | ||
| 242 | + # 1. disable the publish.mr for vhost. | ||
| 243 | + # 2. use timeout for cond wait for consumer queue. | ||
| 244 | + # @see https://github.com/simple-rtmp-server/srs/issues/257 | ||
| 245 | + # default: off | ||
| 246 | + min_latency off; | ||
| 247 | + | ||
| 248 | + # whether enable the TCP_NODELAY | ||
| 249 | + # if on, set the nodelay of fd by setsockopt | ||
| 250 | + # default: off | ||
| 251 | + tcp_nodelay off; | ||
| 252 | + | ||
| 253 | + # the default chunk size is 128, max is 65536, | ||
| 254 | + # some client does not support chunk size change, | ||
| 255 | + # vhost chunk size will override the global value. | ||
| 256 | + # default: global chunk size. | ||
| 257 | + chunk_size 128; | ||
| 258 | +} | ||
| 259 | + | ||
| 260 | +# set the chunk size of vhost. | ||
| 261 | +vhost chunksize.srs.com { | ||
| 262 | + # @see scope.vhost.srs.com | ||
| 263 | + chunk_size 128; | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | +# the vhost disabled. | ||
| 267 | +vhost removed.srs.com { | ||
| 268 | + # @see scope.vhost.srs.com | ||
| 269 | + enabled off; | ||
| 270 | +} | ||
| 271 | + | ||
| 272 | + | ||
| 273 | + | ||
| 274 | + | ||
| 275 | + | ||
| 276 | + | ||
| 277 | + | ||
| 278 | + | ||
| 279 | + | ||
| 280 | + | ||
| 281 | + | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + | ||
| 285 | + | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + | ||
| 289 | + | ||
| 290 | + | ||
| 291 | + | ||
| 292 | + | ||
| 293 | + | ||
| 294 | + | ||
| 295 | + | ||
| 296 | + | ||
| 297 | + | ||
| 233 | # the vhost for antisuck. | 298 | # the vhost for antisuck. |
| 234 | vhost refer.anti_suck.com { | 299 | vhost refer.anti_suck.com { |
| 235 | # refer hotlink-denial. | 300 | # refer hotlink-denial. |
| @@ -280,30 +345,206 @@ vhost bandcheck.srs.com { | @@ -280,30 +345,206 @@ vhost bandcheck.srs.com { | ||
| 280 | } | 345 | } |
| 281 | } | 346 | } |
| 282 | 347 | ||
| 348 | +# the publish specified configs | ||
| 349 | +vhost publish.srs.com { | ||
| 350 | + # the config for FMLE/Flash publisher, which push RTMP to SRS. | ||
| 351 | + publish { | ||
| 352 | + # about MR, read https://github.com/simple-rtmp-server/srs/issues/241 | ||
| 353 | + # when enabled the mr, SRS will read as large as possible. | ||
| 354 | + # default: off | ||
| 355 | + mr off; | ||
| 356 | + # the latency in ms for MR(merged-read), | ||
| 357 | + # the performance+ when latency+, and memory+, | ||
| 358 | + # memory(buffer) = latency * kbps / 8 | ||
| 359 | + # for example, latency=500ms, kbps=3000kbps, each publish connection will consume | ||
| 360 | + # memory = 500 * 3000 / 8 = 187500B = 183KB | ||
| 361 | + # when there are 2500 publisher, the total memory of SRS atleast: | ||
| 362 | + # 183KB * 2500 = 446MB | ||
| 363 | + # the value recomment is [300, 2000] | ||
| 364 | + # default: 350 | ||
| 365 | + mr_latency 350; | ||
| 366 | + | ||
| 367 | + # the 1st packet timeout in ms for encoder. | ||
| 368 | + # default: 20000 | ||
| 369 | + firstpkt_timeout 20000; | ||
| 370 | + # the normal packet timeout in ms for encoder. | ||
| 371 | + # default: 5000 | ||
| 372 | + normal_timeout 7000; | ||
| 373 | + } | ||
| 374 | +} | ||
| 283 | 375 | ||
| 376 | +# the MR(merged-read) setting for publisher. | ||
| 377 | +# the MW(merged-write) settings for player. | ||
| 378 | +vhost mrw.srs.com { | ||
| 379 | + # @see scope.vhost.srs.com | ||
| 380 | + min_latency off; | ||
| 381 | + | ||
| 382 | + # set the MW(merged-write) latency in ms. | ||
| 383 | + # SRS always set mw on, so we just set the latency value. | ||
| 384 | + # the latency of stream >= mw_latency + mr_latency | ||
| 385 | + # the value recomment is [300, 1800] | ||
| 386 | + # default: 350 | ||
| 387 | + mw_latency 350; | ||
| 388 | + | ||
| 389 | + # @see publish.srs.com | ||
| 390 | + publish { | ||
| 391 | + mr on; | ||
| 392 | + mr_latenct 350; | ||
| 393 | + } | ||
| 394 | +} | ||
| 284 | 395 | ||
| 396 | +# the vhost for min delay, donot cache any stream. | ||
| 397 | +vhost min.delay.com { | ||
| 398 | + # @see vhost mrw.srs.com for detail. | ||
| 399 | + min_latency on; | ||
| 400 | + # @see scope.vhost.srs.com | ||
| 401 | + mw_latency 100; | ||
| 402 | + # whether cache the last gop. | ||
| 403 | + # if on, cache the last gop and dispatch to client, | ||
| 404 | + # to enabled fast startup for client, client play immediately. | ||
| 405 | + # if off, send the latest media data to client, | ||
| 406 | + # client need to wait for the next Iframe to decode and show the video. | ||
| 407 | + # set to off if requires min delay; | ||
| 408 | + # set to on if requires client fast startup. | ||
| 409 | + # default: on | ||
| 410 | + gop_cache off; | ||
| 411 | + # the max live queue length in seconds. | ||
| 412 | + # if the messages in the queue exceed the max length, | ||
| 413 | + # drop the old whole gop. | ||
| 414 | + # default: 30 | ||
| 415 | + queue_length 10; | ||
| 416 | + # @see scope.vhost.srs.com | ||
| 417 | + tcp_nodelay on; | ||
| 418 | + | ||
| 419 | + # @see publish.srs.com | ||
| 420 | + publish { | ||
| 421 | + mr off; | ||
| 422 | + } | ||
| 423 | +} | ||
| 285 | 424 | ||
| 425 | +# the vhost to control the stream delivery feature | ||
| 426 | +vhost stream.control.com { | ||
| 427 | + # @see vhost mrw.srs.com for detail. | ||
| 428 | + min_latency on; | ||
| 429 | + mw_latency 100; | ||
| 430 | + # @see vhost min.delay.com | ||
| 431 | + queue_length 10; | ||
| 432 | + tcp_nodelay on; | ||
| 433 | + # the minimal packets send interval in ms, | ||
| 434 | + # used to control the ndiff of stream by srs_rtmp_dump, | ||
| 435 | + # for example, some device can only accept some stream which | ||
| 436 | + # delivery packets in constant interval(not cbr). | ||
| 437 | + # @remark 0 to disable the minimal interval. | ||
| 438 | + # @remark >0 to make the srs to send message one by one. | ||
| 439 | + # @remark user can get the right packets interval in ms by srs_rtmp_dump. | ||
| 440 | + # default: 0 | ||
| 441 | + send_min_interval 10.0; | ||
| 442 | + # whether reduce the sequence header, | ||
| 443 | + # for some client which cannot got duplicated sequence header, | ||
| 444 | + # while the sequence header is not changed yet. | ||
| 445 | + # default: off | ||
| 446 | + reduce_sequence_header on; | ||
| 447 | + | ||
| 448 | + # @see publish.srs.com | ||
| 449 | + publish { | ||
| 450 | + mr off; | ||
| 451 | + firstpkt_timeout 20000; | ||
| 452 | + normal_timeout 7000; | ||
| 453 | + } | ||
| 454 | +} | ||
| 286 | 455 | ||
| 456 | +# the vhost which forward publish streams. | ||
| 457 | +vhost same.vhost.forward.srs.com { | ||
| 458 | + # forward all publish stream to the specified server. | ||
| 459 | + # this used to split/forward the current stream for cluster active-standby, | ||
| 460 | + # active-active for cdn to build high available fault tolerance system. | ||
| 461 | + # format: {ip}:{port} {ip_N}:{port_N} | ||
| 462 | + forward 127.0.0.1:1936 127.0.0.1:1937; | ||
| 463 | +} | ||
| 287 | 464 | ||
| 465 | +# the vhost for exec, fork process when publish stream. | ||
| 466 | +vhost exec.srs.com { | ||
| 467 | + # the exec used to fork process when got some event. | ||
| 468 | + exec { | ||
| 469 | + # whether enable the exec. | ||
| 470 | + # default: off. | ||
| 471 | + enabled off; | ||
| 472 | + # when publish stream, exec the process with variables: | ||
| 473 | + # [vhost] the input stream vhost. | ||
| 474 | + # [port] the intput stream port. | ||
| 475 | + # [app] the input stream app. | ||
| 476 | + # [stream] the input stream name. | ||
| 477 | + # [engine] the tanscode engine name. | ||
| 478 | + # other variables for exec only: | ||
| 479 | + # [url] the rtmp url which trigger the publish. | ||
| 480 | + # [tcUrl] the client request tcUrl. | ||
| 481 | + # [swfUrl] the client request swfUrl. | ||
| 482 | + # [pageUrl] the client request pageUrl. | ||
| 483 | + # @remark empty to ignore this exec. | ||
| 484 | + publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv; | ||
| 485 | + } | ||
| 486 | +} | ||
| 288 | 487 | ||
| 488 | +# the play specified configs | ||
| 489 | +vhost play.srs.com { | ||
| 490 | + # for play client, both RTMP and other stream clients, | ||
| 491 | + # for instance, the HTTP FLV stream clients. | ||
| 492 | + play { | ||
| 493 | + # about the stream monotonically increasing: | ||
| 494 | + # 1. video timestamp is monotonically increasing, | ||
| 495 | + # 2. audio timestamp is monotonically increasing, | ||
| 496 | + # 3. video and audio timestamp is interleaved/mixed monotonically increasing. | ||
| 497 | + # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format | ||
| 498 | + # however, some encoder cannot provides this feature, please set this to off to ignore time jitter. | ||
| 499 | + # the time jitter algorithm: | ||
| 500 | + # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing. | ||
| 501 | + # 2. zero, only ensure sttream start at zero, ignore timestamp jitter. | ||
| 502 | + # 3. off, disable the time jitter algorithm, like atc. | ||
| 503 | + # default: full | ||
| 504 | + time_jitter full; | ||
| 505 | + # whether use the interleaved/mixed algorithm to correct the timestamp. | ||
| 506 | + # if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase. | ||
| 507 | + # if off, use time_jitter to correct the timestamp if required. | ||
| 508 | + # default: off | ||
| 509 | + mix_correct off; | ||
| 289 | 510 | ||
| 511 | + # vhost for atc for hls/hds/rtmp backup. | ||
| 512 | + # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0. | ||
| 513 | + # when atc is on, server delivery rtmp stream by absolute time. | ||
| 514 | + # atc is used, for instance, encoder will copy stream to master and slave server, | ||
| 515 | + # server use atc to delivery stream to edge/client, where stream time from master/slave server | ||
| 516 | + # is always the same, client/tools can slice RTMP stream to HLS according to the same time, | ||
| 517 | + # if the time not the same, the HLS stream cannot slice to support system backup. | ||
| 518 | + # | ||
| 519 | + # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html | ||
| 520 | + # @see http://www.baidu.com/#wd=hds%20hls%20atc | ||
| 521 | + # | ||
| 522 | + # default: off | ||
| 523 | + atc off; | ||
| 524 | + # whether enable the auto atc, | ||
| 525 | + # if enabled, detect the bravo_atc="true" in onMetaData packet, | ||
| 526 | + # set atc to on if matched. | ||
| 527 | + # always ignore the onMetaData if atc_auto is off. | ||
| 528 | + # default: off | ||
| 529 | + atc_auto off; | ||
| 530 | + } | ||
| 531 | +} | ||
| 290 | 532 | ||
| 533 | +# vhost for time jitter | ||
| 534 | +vhost jitter.srs.com { | ||
| 535 | + # @see play.srs.com | ||
| 536 | + time_jitter full; | ||
| 537 | + # @see play.srs.com | ||
| 538 | + mix_correct off; | ||
| 539 | +} | ||
| 291 | 540 | ||
| 292 | - | ||
| 293 | - | ||
| 294 | - | ||
| 295 | - | ||
| 296 | - | ||
| 297 | - | ||
| 298 | - | ||
| 299 | - | ||
| 300 | - | ||
| 301 | - | ||
| 302 | - | ||
| 303 | - | ||
| 304 | - | ||
| 305 | - | ||
| 306 | - | 541 | +# vhost for atc. |
| 542 | +vhost atc.srs.com { | ||
| 543 | + # @see play.srs.com | ||
| 544 | + atc on; | ||
| 545 | + # @see play.srs.com | ||
| 546 | + atc_auto on; | ||
| 547 | +} | ||
| 307 | 548 | ||
| 308 | # the security to allow or deny clients. | 549 | # the security to allow or deny clients. |
| 309 | vhost security.srs.com { | 550 | vhost security.srs.com { |
| @@ -932,229 +1173,6 @@ vhost debug.srs.com { | @@ -932,229 +1173,6 @@ vhost debug.srs.com { | ||
| 932 | debug_srs_upnode on; | 1173 | debug_srs_upnode on; |
| 933 | } | 1174 | } |
| 934 | 1175 | ||
| 935 | -# the publish specified configs | ||
| 936 | -vhost publish.srs.com { | ||
| 937 | - # the config for FMLE/Flash publisher, which push RTMP to SRS. | ||
| 938 | - publish { | ||
| 939 | - # about MR, read https://github.com/simple-rtmp-server/srs/issues/241 | ||
| 940 | - # when enabled the mr, SRS will read as large as possible. | ||
| 941 | - # default: off | ||
| 942 | - mr off; | ||
| 943 | - # the latency in ms for MR(merged-read), | ||
| 944 | - # the performance+ when latency+, and memory+, | ||
| 945 | - # memory(buffer) = latency * kbps / 8 | ||
| 946 | - # for example, latency=500ms, kbps=3000kbps, each publish connection will consume | ||
| 947 | - # memory = 500 * 3000 / 8 = 187500B = 183KB | ||
| 948 | - # when there are 2500 publisher, the total memory of SRS atleast: | ||
| 949 | - # 183KB * 2500 = 446MB | ||
| 950 | - # the value recomment is [300, 2000] | ||
| 951 | - # default: 350 | ||
| 952 | - mr_latency 350; | ||
| 953 | - | ||
| 954 | - # the 1st packet timeout in ms for encoder. | ||
| 955 | - # default: 20000 | ||
| 956 | - firstpkt_timeout 20000; | ||
| 957 | - # the normal packet timeout in ms for encoder. | ||
| 958 | - # default: 5000 | ||
| 959 | - normal_timeout 7000; | ||
| 960 | - } | ||
| 961 | -} | ||
| 962 | - | ||
| 963 | -# the MR(merged-read) setting for publisher. | ||
| 964 | -# the MW(merged-write) settings for player. | ||
| 965 | -vhost mrw.srs.com { | ||
| 966 | - # whether enable min delay mode for vhost. | ||
| 967 | - # for min latence mode: | ||
| 968 | - # 1. disable the publish.mr for vhost. | ||
| 969 | - # 2. use timeout for cond wait for consumer queue. | ||
| 970 | - # @see https://github.com/simple-rtmp-server/srs/issues/257 | ||
| 971 | - # default: off | ||
| 972 | - min_latency off; | ||
| 973 | - # set the MW(merged-write) latency in ms. | ||
| 974 | - # SRS always set mw on, so we just set the latency value. | ||
| 975 | - # the latency of stream >= mw_latency + mr_latency | ||
| 976 | - # the value recomment is [300, 1800] | ||
| 977 | - # default: 350 | ||
| 978 | - mw_latency 350; | ||
| 979 | - | ||
| 980 | - # @see publish.srs.com | ||
| 981 | - publish { | ||
| 982 | - mr on; | ||
| 983 | - mr_latenct 350; | ||
| 984 | - } | ||
| 985 | -} | ||
| 986 | - | ||
| 987 | -# the vhost for min delay, donot cache any stream. | ||
| 988 | -vhost min.delay.com { | ||
| 989 | - # @see vhost mrw.srs.com for detail. | ||
| 990 | - min_latency on; | ||
| 991 | - mw_latency 100; | ||
| 992 | - # whether cache the last gop. | ||
| 993 | - # if on, cache the last gop and dispatch to client, | ||
| 994 | - # to enabled fast startup for client, client play immediately. | ||
| 995 | - # if off, send the latest media data to client, | ||
| 996 | - # client need to wait for the next Iframe to decode and show the video. | ||
| 997 | - # set to off if requires min delay; | ||
| 998 | - # set to on if requires client fast startup. | ||
| 999 | - # default: on | ||
| 1000 | - gop_cache off; | ||
| 1001 | - # the max live queue length in seconds. | ||
| 1002 | - # if the messages in the queue exceed the max length, | ||
| 1003 | - # drop the old whole gop. | ||
| 1004 | - # default: 30 | ||
| 1005 | - queue_length 10; | ||
| 1006 | - # whether enable the TCP_NODELAY | ||
| 1007 | - # if on, set the nodelay of fd by setsockopt | ||
| 1008 | - # default: off | ||
| 1009 | - tcp_nodelay on; | ||
| 1010 | - | ||
| 1011 | - # @see publish.srs.com | ||
| 1012 | - publish { | ||
| 1013 | - mr off; | ||
| 1014 | - } | ||
| 1015 | -} | ||
| 1016 | - | ||
| 1017 | -# the vhost to control the stream delivery feature | ||
| 1018 | -vhost stream.control.com { | ||
| 1019 | - # @see vhost mrw.srs.com for detail. | ||
| 1020 | - min_latency on; | ||
| 1021 | - mw_latency 100; | ||
| 1022 | - # @see vhost min.delay.com | ||
| 1023 | - queue_length 10; | ||
| 1024 | - tcp_nodelay on; | ||
| 1025 | - # the minimal packets send interval in ms, | ||
| 1026 | - # used to control the ndiff of stream by srs_rtmp_dump, | ||
| 1027 | - # for example, some device can only accept some stream which | ||
| 1028 | - # delivery packets in constant interval(not cbr). | ||
| 1029 | - # @remark 0 to disable the minimal interval. | ||
| 1030 | - # @remark >0 to make the srs to send message one by one. | ||
| 1031 | - # @remark user can get the right packets interval in ms by srs_rtmp_dump. | ||
| 1032 | - # default: 0 | ||
| 1033 | - send_min_interval 10.0; | ||
| 1034 | - # whether reduce the sequence header, | ||
| 1035 | - # for some client which cannot got duplicated sequence header, | ||
| 1036 | - # while the sequence header is not changed yet. | ||
| 1037 | - # default: off | ||
| 1038 | - reduce_sequence_header on; | ||
| 1039 | - | ||
| 1040 | - # @see publish.srs.com | ||
| 1041 | - publish { | ||
| 1042 | - mr off; | ||
| 1043 | - firstpkt_timeout 20000; | ||
| 1044 | - normal_timeout 7000; | ||
| 1045 | - } | ||
| 1046 | -} | ||
| 1047 | - | ||
| 1048 | -# the vhost which forward publish streams. | ||
| 1049 | -vhost same.vhost.forward.srs.com { | ||
| 1050 | - # forward all publish stream to the specified server. | ||
| 1051 | - # this used to split/forward the current stream for cluster active-standby, | ||
| 1052 | - # active-active for cdn to build high available fault tolerance system. | ||
| 1053 | - # format: {ip}:{port} {ip_N}:{port_N} | ||
| 1054 | - forward 127.0.0.1:1936 127.0.0.1:1937; | ||
| 1055 | -} | ||
| 1056 | - | ||
| 1057 | -# the vhost for exec, fork process when publish stream. | ||
| 1058 | -vhost exec.srs.com { | ||
| 1059 | - # the exec used to fork process when got some event. | ||
| 1060 | - exec { | ||
| 1061 | - # whether enable the exec. | ||
| 1062 | - # default: off. | ||
| 1063 | - enabled off; | ||
| 1064 | - # when publish stream, exec the process with variables: | ||
| 1065 | - # [vhost] the input stream vhost. | ||
| 1066 | - # [port] the intput stream port. | ||
| 1067 | - # [app] the input stream app. | ||
| 1068 | - # [stream] the input stream name. | ||
| 1069 | - # [engine] the tanscode engine name. | ||
| 1070 | - # other variables for exec only: | ||
| 1071 | - # [url] the rtmp url which trigger the publish. | ||
| 1072 | - # [tcUrl] the client request tcUrl. | ||
| 1073 | - # [swfUrl] the client request swfUrl. | ||
| 1074 | - # [pageUrl] the client request pageUrl. | ||
| 1075 | - # @remark empty to ignore this exec. | ||
| 1076 | - publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv; | ||
| 1077 | - } | ||
| 1078 | -} | ||
| 1079 | - | ||
| 1080 | -# set the chunk size of vhost. | ||
| 1081 | -vhost chunksize.srs.com { | ||
| 1082 | - # the default chunk size is 128, max is 65536, | ||
| 1083 | - # some client does not support chunk size change, | ||
| 1084 | - # vhost chunk size will override the global value. | ||
| 1085 | - # default: global chunk size. | ||
| 1086 | - chunk_size 128; | ||
| 1087 | -} | ||
| 1088 | - | ||
| 1089 | -# the play specified configs | ||
| 1090 | -vhost play.srs.com { | ||
| 1091 | - # for play client, both RTMP and other stream clients, | ||
| 1092 | - # for instance, the HTTP FLV stream clients. | ||
| 1093 | - play { | ||
| 1094 | - # about the stream monotonically increasing: | ||
| 1095 | - # 1. video timestamp is monotonically increasing, | ||
| 1096 | - # 2. audio timestamp is monotonically increasing, | ||
| 1097 | - # 3. video and audio timestamp is interleaved/mixed monotonically increasing. | ||
| 1098 | - # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format | ||
| 1099 | - # however, some encoder cannot provides this feature, please set this to off to ignore time jitter. | ||
| 1100 | - # the time jitter algorithm: | ||
| 1101 | - # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing. | ||
| 1102 | - # 2. zero, only ensure sttream start at zero, ignore timestamp jitter. | ||
| 1103 | - # 3. off, disable the time jitter algorithm, like atc. | ||
| 1104 | - # default: full | ||
| 1105 | - time_jitter full; | ||
| 1106 | - # whether use the interleaved/mixed algorithm to correct the timestamp. | ||
| 1107 | - # if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase. | ||
| 1108 | - # if off, use time_jitter to correct the timestamp if required. | ||
| 1109 | - # default: off | ||
| 1110 | - mix_correct off; | ||
| 1111 | - | ||
| 1112 | - # vhost for atc for hls/hds/rtmp backup. | ||
| 1113 | - # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0. | ||
| 1114 | - # when atc is on, server delivery rtmp stream by absolute time. | ||
| 1115 | - # atc is used, for instance, encoder will copy stream to master and slave server, | ||
| 1116 | - # server use atc to delivery stream to edge/client, where stream time from master/slave server | ||
| 1117 | - # is always the same, client/tools can slice RTMP stream to HLS according to the same time, | ||
| 1118 | - # if the time not the same, the HLS stream cannot slice to support system backup. | ||
| 1119 | - # | ||
| 1120 | - # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html | ||
| 1121 | - # @see http://www.baidu.com/#wd=hds%20hls%20atc | ||
| 1122 | - # | ||
| 1123 | - # default: off | ||
| 1124 | - atc off; | ||
| 1125 | - # whether enable the auto atc, | ||
| 1126 | - # if enabled, detect the bravo_atc="true" in onMetaData packet, | ||
| 1127 | - # set atc to on if matched. | ||
| 1128 | - # always ignore the onMetaData if atc_auto is off. | ||
| 1129 | - # default: off | ||
| 1130 | - atc_auto off; | ||
| 1131 | - } | ||
| 1132 | -} | ||
| 1133 | - | ||
| 1134 | -# vhost for time jitter | ||
| 1135 | -vhost jitter.srs.com { | ||
| 1136 | - # @see play.srs.com | ||
| 1137 | - time_jitter full; | ||
| 1138 | - # @see play.srs.com | ||
| 1139 | - mix_correct off; | ||
| 1140 | -} | ||
| 1141 | - | ||
| 1142 | -# vhost for atc. | ||
| 1143 | -vhost atc.srs.com { | ||
| 1144 | - # @see play.srs.com | ||
| 1145 | - atc on; | ||
| 1146 | - # @see play.srs.com | ||
| 1147 | - atc_auto on; | ||
| 1148 | -} | ||
| 1149 | - | ||
| 1150 | -# the vhost disabled. | ||
| 1151 | -vhost removed.srs.com { | ||
| 1152 | - # whether the vhost is enabled. | ||
| 1153 | - # if off, all request access denied. | ||
| 1154 | - # default: on | ||
| 1155 | - enabled off; | ||
| 1156 | -} | ||
| 1157 | - | ||
| 1158 | # the main comments for transcode | 1176 | # the main comments for transcode |
| 1159 | vhost example.transcode.srs.com { | 1177 | vhost example.transcode.srs.com { |
| 1160 | # the streaming transcode configs. | 1178 | # the streaming transcode configs. |
| @@ -47,9 +47,9 @@ vhost __defaultVhost__ { | @@ -47,9 +47,9 @@ vhost __defaultVhost__ { | ||
| 47 | } | 47 | } |
| 48 | vhost vhost.srs.com { | 48 | vhost vhost.srs.com { |
| 49 | enabled off; | 49 | enabled off; |
| 50 | - | ||
| 51 | chunk_size 128; | 50 | chunk_size 128; |
| 52 | tcp_nodelay on; | 51 | tcp_nodelay on; |
| 52 | + min_latency on; | ||
| 53 | 53 | ||
| 54 | # TODO | 54 | # TODO |
| 55 | cluster { | 55 | cluster { |
| @@ -74,10 +74,9 @@ vhost vhost.srs.com { | @@ -74,10 +74,9 @@ vhost vhost.srs.com { | ||
| 74 | atc on; | 74 | atc on; |
| 75 | atc_auto on; | 75 | atc_auto on; |
| 76 | 76 | ||
| 77 | - # TODO | ||
| 78 | - min_latency on; | ||
| 79 | mw_latency 100; | 77 | mw_latency 100; |
| 80 | - | 78 | + |
| 79 | + # TODO | ||
| 81 | gop_cache off; | 80 | gop_cache off; |
| 82 | queue_length 10; | 81 | queue_length 10; |
| 83 | 82 |
| @@ -5,12 +5,12 @@ | @@ -5,12 +5,12 @@ | ||
| 5 | listen 1935; | 5 | listen 1935; |
| 6 | max_connections 1000; | 6 | max_connections 1000; |
| 7 | vhost __defaultVhost__ { | 7 | vhost __defaultVhost__ { |
| 8 | - tcp_nodelay on; | 8 | + tcp_nodelay on |
| 9 | + min_latency on; | ||
| 9 | 10 | ||
| 10 | play { | 11 | play { |
| 11 | gop_cache off; | 12 | gop_cache off; |
| 12 | queue_length 10; | 13 | queue_length 10; |
| 13 | - min_latency on; | ||
| 14 | mw_latency 100; | 14 | mw_latency 100; |
| 15 | } | 15 | } |
| 16 | 16 |
| @@ -695,6 +695,43 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | @@ -695,6 +695,43 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | ||
| 695 | // ENABLED => ENABLED (modified) | 695 | // ENABLED => ENABLED (modified) |
| 696 | if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) { | 696 | if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) { |
| 697 | srs_trace("vhost %s maybe modified, reload its detail.", vhost.c_str()); | 697 | srs_trace("vhost %s maybe modified, reload its detail.", vhost.c_str()); |
| 698 | + | ||
| 699 | + // chunk_size, only one per vhost. | ||
| 700 | + if (!srs_directive_equals(new_vhost->get("chunk_size"), old_vhost->get("chunk_size"))) { | ||
| 701 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 702 | + ISrsReloadHandler* subscribe = *it; | ||
| 703 | + if ((ret = subscribe->on_reload_vhost_chunk_size(vhost)) != ERROR_SUCCESS) { | ||
| 704 | + srs_error("vhost %s notify subscribes chunk_size failed. ret=%d", vhost.c_str(), ret); | ||
| 705 | + return ret; | ||
| 706 | + } | ||
| 707 | + } | ||
| 708 | + srs_trace("vhost %s reload chunk_size success.", vhost.c_str()); | ||
| 709 | + } | ||
| 710 | + | ||
| 711 | + // tcp_nodelay, only one per vhost | ||
| 712 | + if (!srs_directive_equals(new_vhost->get("tcp_nodelay"), old_vhost->get("tcp_nodelay"))) { | ||
| 713 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 714 | + ISrsReloadHandler* subscribe = *it; | ||
| 715 | + if ((ret = subscribe->on_reload_vhost_tcp_nodelay(vhost)) != ERROR_SUCCESS) { | ||
| 716 | + srs_error("vhost %s notify subscribes tcp_nodelay failed. ret=%d", vhost.c_str(), ret); | ||
| 717 | + return ret; | ||
| 718 | + } | ||
| 719 | + } | ||
| 720 | + srs_trace("vhost %s reload tcp_nodelay success.", vhost.c_str()); | ||
| 721 | + } | ||
| 722 | + | ||
| 723 | + // min_latency, only one per vhost | ||
| 724 | + if (!srs_directive_equals(new_vhost->get("min_latency"), old_vhost->get("min_latency"))) { | ||
| 725 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 726 | + ISrsReloadHandler* subscribe = *it; | ||
| 727 | + if ((ret = subscribe->on_reload_vhost_realtime(vhost)) != ERROR_SUCCESS) { | ||
| 728 | + srs_error("vhost %s notify subscribes min_latency failed. ret=%d", vhost.c_str(), ret); | ||
| 729 | + return ret; | ||
| 730 | + } | ||
| 731 | + } | ||
| 732 | + srs_trace("vhost %s reload min_latency success.", vhost.c_str()); | ||
| 733 | + } | ||
| 734 | + | ||
| 698 | // gop_cache, only one per vhost | 735 | // gop_cache, only one per vhost |
| 699 | if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) { | 736 | if (!srs_directive_equals(new_vhost->get("gop_cache"), old_vhost->get("gop_cache"))) { |
| 700 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 737 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| @@ -804,18 +841,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | @@ -804,18 +841,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | ||
| 804 | srs_trace("vhost %s reload publish success.", vhost.c_str()); | 841 | srs_trace("vhost %s reload publish success.", vhost.c_str()); |
| 805 | } | 842 | } |
| 806 | 843 | ||
| 807 | - // chunk_size, only one per vhost. | ||
| 808 | - if (!srs_directive_equals(new_vhost->get("chunk_size"), old_vhost->get("chunk_size"))) { | ||
| 809 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 810 | - ISrsReloadHandler* subscribe = *it; | ||
| 811 | - if ((ret = subscribe->on_reload_vhost_chunk_size(vhost)) != ERROR_SUCCESS) { | ||
| 812 | - srs_error("vhost %s notify subscribes chunk_size failed. ret=%d", vhost.c_str(), ret); | ||
| 813 | - return ret; | ||
| 814 | - } | ||
| 815 | - } | ||
| 816 | - srs_trace("vhost %s reload chunk_size success.", vhost.c_str()); | ||
| 817 | - } | ||
| 818 | - | ||
| 819 | // mw, only one per vhost | 844 | // mw, only one per vhost |
| 820 | if (!srs_directive_equals(new_vhost->get("mw_latency"), old_vhost->get("mw_latency"))) { | 845 | if (!srs_directive_equals(new_vhost->get("mw_latency"), old_vhost->get("mw_latency"))) { |
| 821 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 846 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| @@ -840,30 +865,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | @@ -840,30 +865,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) | ||
| 840 | srs_trace("vhost %s reload smi success.", vhost.c_str()); | 865 | srs_trace("vhost %s reload smi success.", vhost.c_str()); |
| 841 | } | 866 | } |
| 842 | 867 | ||
| 843 | - // tcp_nodelay, only one per vhost | ||
| 844 | - if (!srs_directive_equals(new_vhost->get("tcp_nodelay"), old_vhost->get("tcp_nodelay"))) { | ||
| 845 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 846 | - ISrsReloadHandler* subscribe = *it; | ||
| 847 | - if ((ret = subscribe->on_reload_vhost_tcp_nodelay(vhost)) != ERROR_SUCCESS) { | ||
| 848 | - srs_error("vhost %s notify subscribes tcp_nodelay failed. ret=%d", vhost.c_str(), ret); | ||
| 849 | - return ret; | ||
| 850 | - } | ||
| 851 | - } | ||
| 852 | - srs_trace("vhost %s reload tcp_nodelay success.", vhost.c_str()); | ||
| 853 | - } | ||
| 854 | - | ||
| 855 | - // min_latency, only one per vhost | ||
| 856 | - if (!srs_directive_equals(new_vhost->get("min_latency"), old_vhost->get("min_latency"))) { | ||
| 857 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 858 | - ISrsReloadHandler* subscribe = *it; | ||
| 859 | - if ((ret = subscribe->on_reload_vhost_realtime(vhost)) != ERROR_SUCCESS) { | ||
| 860 | - srs_error("vhost %s notify subscribes min_latency failed. ret=%d", vhost.c_str(), ret); | ||
| 861 | - return ret; | ||
| 862 | - } | ||
| 863 | - } | ||
| 864 | - srs_trace("vhost %s reload min_latency success.", vhost.c_str()); | ||
| 865 | - } | ||
| 866 | - | ||
| 867 | // http_static, only one per vhost. | 868 | // http_static, only one per vhost. |
| 868 | if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) { | 869 | if (!srs_directive_equals(new_vhost->get("http_static"), old_vhost->get("http_static"))) { |
| 869 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 870 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| @@ -1696,10 +1697,19 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | @@ -1696,10 +1697,19 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | ||
| 1696 | 1697 | ||
| 1697 | obj->set("name", vhost->dumps_arg0_to_str()); | 1698 | obj->set("name", vhost->dumps_arg0_to_str()); |
| 1698 | 1699 | ||
| 1699 | - // enabled | 1700 | + // vhost scope configs. |
| 1700 | if ((dir = vhost->get("enabled")) != NULL) { | 1701 | if ((dir = vhost->get("enabled")) != NULL) { |
| 1701 | obj->set("enabled", dir->dumps_arg0_to_boolean()); | 1702 | obj->set("enabled", dir->dumps_arg0_to_boolean()); |
| 1702 | } | 1703 | } |
| 1704 | + if ((dir = vhost->get("chunk_size")) != NULL) { | ||
| 1705 | + obj->set("chunk_size", dir->dumps_arg0_to_number()); | ||
| 1706 | + } | ||
| 1707 | + if ((dir = vhost->get("min_latency")) != NULL) { | ||
| 1708 | + obj->set("min_latency", dir->dumps_arg0_to_boolean()); | ||
| 1709 | + } | ||
| 1710 | + if ((dir = vhost->get("tcp_nodelay")) != NULL) { | ||
| 1711 | + obj->set("tcp_nodelay", dir->dumps_arg0_to_boolean()); | ||
| 1712 | + } | ||
| 1703 | 1713 | ||
| 1704 | // edge. | 1714 | // edge. |
| 1705 | if ((dir = vhost->get("mode")) != NULL) { | 1715 | if ((dir = vhost->get("mode")) != NULL) { |
| @@ -1725,15 +1735,7 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | @@ -1725,15 +1735,7 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | ||
| 1725 | obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean()); | 1735 | obj->set("debug_srs_upnode", dir->dumps_arg0_to_boolean()); |
| 1726 | } | 1736 | } |
| 1727 | 1737 | ||
| 1728 | - // chunk_size | ||
| 1729 | - if ((dir = vhost->get("chunk_size")) != NULL) { | ||
| 1730 | - obj->set("chunk_size", dir->dumps_arg0_to_number()); | ||
| 1731 | - } | ||
| 1732 | - | ||
| 1733 | // mrw | 1738 | // mrw |
| 1734 | - if ((dir = vhost->get("min_latency")) != NULL) { | ||
| 1735 | - obj->set("min_latency", dir->dumps_arg0_to_boolean()); | ||
| 1736 | - } | ||
| 1737 | if ((dir = vhost->get("mw_latency")) != NULL) { | 1739 | if ((dir = vhost->get("mw_latency")) != NULL) { |
| 1738 | obj->set("mw_latency", dir->dumps_arg0_to_number()); | 1740 | obj->set("mw_latency", dir->dumps_arg0_to_number()); |
| 1739 | } | 1741 | } |
| @@ -1745,9 +1747,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | @@ -1745,9 +1747,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj) | ||
| 1745 | if ((dir = vhost->get("queue_length")) != NULL) { | 1747 | if ((dir = vhost->get("queue_length")) != NULL) { |
| 1746 | obj->set("queue_length", dir->dumps_arg0_to_number()); | 1748 | obj->set("queue_length", dir->dumps_arg0_to_number()); |
| 1747 | } | 1749 | } |
| 1748 | - if ((dir = vhost->get("tcp_nodelay")) != NULL) { | ||
| 1749 | - obj->set("tcp_nodelay", dir->dumps_arg0_to_boolean()); | ||
| 1750 | - } | ||
| 1751 | 1750 | ||
| 1752 | // stream control | 1751 | // stream control |
| 1753 | if ((dir = vhost->get("send_min_interval")) != NULL) { | 1752 | if ((dir = vhost->get("send_min_interval")) != NULL) { |
| @@ -2650,13 +2649,13 @@ int SrsConfig::check_config() | @@ -2650,13 +2649,13 @@ int SrsConfig::check_config() | ||
| 2650 | for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) { | 2649 | for (int i = 0; vhost && i < (int)vhost->directives.size(); i++) { |
| 2651 | SrsConfDirective* conf = vhost->at(i); | 2650 | SrsConfDirective* conf = vhost->at(i); |
| 2652 | string n = conf->name; | 2651 | string n = conf->name; |
| 2653 | - if (n != "enabled" && n != "chunk_size" | 2652 | + if (n != "enabled" && n != "chunk_size" && n != "min_latency" && n != "tcp_nodelay" |
| 2654 | && n != "mode" && n != "origin" && n != "token_traverse" && n != "vhost" | 2653 | && n != "mode" && n != "origin" && n != "token_traverse" && n != "vhost" |
| 2655 | && n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks" | 2654 | && n != "dvr" && n != "ingest" && n != "hls" && n != "http_hooks" |
| 2656 | && n != "gop_cache" && n != "queue_length" | 2655 | && n != "gop_cache" && n != "queue_length" |
| 2657 | && n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck" | 2656 | && n != "refer" && n != "forward" && n != "transcode" && n != "bandcheck" |
| 2658 | - && n != "debug_srs_upnode" && n != "play" && n != "publish" && n != "mw_latency" && n != "min_latency" | ||
| 2659 | - && n != "tcp_nodelay" && n != "send_min_interval" && n != "reduce_sequence_header" | 2657 | + && n != "debug_srs_upnode" && n != "play" && n != "publish" && n != "mw_latency" |
| 2658 | + && n != "send_min_interval" && n != "reduce_sequence_header" | ||
| 2660 | && n != "security" && n != "http_remux" | 2659 | && n != "security" && n != "http_remux" |
| 2661 | && n != "http_static" && n != "hds" && n != "exec" | 2660 | && n != "http_static" && n != "hds" && n != "exec" |
| 2662 | ) { | 2661 | ) { |
-
请 注册 或 登录 后发表评论