正在显示
4 个修改的文件
包含
41 行增加
和
8 行删除
@@ -26,6 +26,7 @@ vhost __defaultVhost__ { | @@ -26,6 +26,7 @@ vhost __defaultVhost__ { | ||
26 | # for which cannot identify the required vhost. | 26 | # for which cannot identify the required vhost. |
27 | # for default demo. | 27 | # for default demo. |
28 | vhost demo.srs.com { | 28 | vhost demo.srs.com { |
29 | + chunk_size 4096; | ||
29 | enabled on; | 30 | enabled on; |
30 | gop_cache on; | 31 | gop_cache on; |
31 | queue_length 30; | 32 | queue_length 30; |
@@ -138,6 +139,7 @@ vhost players_pub { | @@ -138,6 +139,7 @@ vhost players_pub { | ||
138 | hls_window 30; | 139 | hls_window 30; |
139 | } | 140 | } |
140 | } | 141 | } |
142 | + | ||
141 | # for development | 143 | # for development |
142 | vhost dev { | 144 | vhost dev { |
143 | enabled on; | 145 | enabled on; |
@@ -198,6 +200,15 @@ vhost dev { | @@ -198,6 +200,15 @@ vhost dev { | ||
198 | } | 200 | } |
199 | } | 201 | } |
200 | 202 | ||
203 | +# set the chunk size of vhost. | ||
204 | +vhost chunksize.vhost.com { | ||
205 | + # the default chunk size is 128, max is 65536, | ||
206 | + # some client does not support chunk size change, | ||
207 | + # vhost chunk size will override the global value. | ||
208 | + # default: global chunk size. | ||
209 | + chunk_size 128; | ||
210 | +} | ||
211 | + | ||
201 | # the http hook callback vhost, srs will invoke the hooks for specified events. | 212 | # the http hook callback vhost, srs will invoke the hooks for specified events. |
202 | vhost hooks.callback.vhost.com { | 213 | vhost hooks.callback.vhost.com { |
203 | http_hooks { | 214 | http_hooks { |
@@ -289,6 +300,7 @@ vhost hooks.callback.vhost.com { | @@ -289,6 +300,7 @@ vhost hooks.callback.vhost.com { | ||
289 | on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; | 300 | on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; |
290 | } | 301 | } |
291 | } | 302 | } |
303 | + | ||
292 | # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction | 304 | # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction |
293 | vhost mirror.transcode.vhost.com { | 305 | vhost mirror.transcode.vhost.com { |
294 | transcode { | 306 | transcode { |
@@ -668,6 +680,7 @@ vhost stream.transcode.vhost.com { | @@ -668,6 +680,7 @@ vhost stream.transcode.vhost.com { | ||
668 | } | 680 | } |
669 | } | 681 | } |
670 | } | 682 | } |
683 | + | ||
671 | # the vhost which forward publish streams. | 684 | # the vhost which forward publish streams. |
672 | vhost same.vhost.forward.vhost.com { | 685 | vhost same.vhost.forward.vhost.com { |
673 | # forward all publish stream to the specified server. | 686 | # forward all publish stream to the specified server. |
@@ -683,6 +696,7 @@ vhost same.vhost.forward.vhost.com { | @@ -683,6 +696,7 @@ vhost same.vhost.forward.vhost.com { | ||
683 | vhost change.vhost.forward.vhost.com { | 696 | vhost change.vhost.forward.vhost.com { |
684 | forward 127.0.0.1:1936?vhost=forward2.vhost.com 127.0.0.1:1937?vhost=forward3.vhost.com; | 697 | forward 127.0.0.1:1936?vhost=forward2.vhost.com 127.0.0.1:1937?vhost=forward3.vhost.com; |
685 | } | 698 | } |
699 | + | ||
686 | # the vhost disabled. | 700 | # the vhost disabled. |
687 | vhost removed.vhost.com { | 701 | vhost removed.vhost.com { |
688 | # whether the vhost is enabled. | 702 | # whether the vhost is enabled. |
@@ -690,6 +704,7 @@ vhost removed.vhost.com { | @@ -690,6 +704,7 @@ vhost removed.vhost.com { | ||
690 | # default: on | 704 | # default: on |
691 | enabled off; | 705 | enabled off; |
692 | } | 706 | } |
707 | + | ||
693 | # the vhost with hls specified. | 708 | # the vhost with hls specified. |
694 | vhost with-hls.vhost.com { | 709 | vhost with-hls.vhost.com { |
695 | hls { | 710 | hls { |
@@ -726,6 +741,7 @@ vhost no-hls.vhost.com { | @@ -726,6 +741,7 @@ vhost no-hls.vhost.com { | ||
726 | enabled off; | 741 | enabled off; |
727 | } | 742 | } |
728 | } | 743 | } |
744 | + | ||
729 | # the vhost for min delay, donot cache any stream. | 745 | # the vhost for min delay, donot cache any stream. |
730 | vhost min.delay.com { | 746 | vhost min.delay.com { |
731 | # whether cache the last gop. | 747 | # whether cache the last gop. |
@@ -743,6 +759,7 @@ vhost min.delay.com { | @@ -743,6 +759,7 @@ vhost min.delay.com { | ||
743 | # default: 30 | 759 | # default: 30 |
744 | queue_length 10; | 760 | queue_length 10; |
745 | } | 761 | } |
762 | + | ||
746 | # the vhost for antisuck. | 763 | # the vhost for antisuck. |
747 | vhost refer.anti_suck.com { | 764 | vhost refer.anti_suck.com { |
748 | # the common refer for play and publish. | 765 | # the common refer for play and publish. |
@@ -761,6 +778,7 @@ vhost refer.anti_suck.com { | @@ -761,6 +778,7 @@ vhost refer.anti_suck.com { | ||
761 | # default: not specified. | 778 | # default: not specified. |
762 | refer_play github.com github.io; | 779 | refer_play github.com github.io; |
763 | } | 780 | } |
781 | + | ||
764 | # config for the pithy print, | 782 | # config for the pithy print, |
765 | # which always print constant message specified by interval, | 783 | # which always print constant message specified by interval, |
766 | # whatever the clients in concurrency. | 784 | # whatever the clients in concurrency. |
@@ -173,7 +173,7 @@ int SrsClient::service_cycle() | @@ -173,7 +173,7 @@ int SrsClient::service_cycle() | ||
173 | req->strip(); | 173 | req->strip(); |
174 | srs_trace("identify client success. type=%d, stream_name=%s", type, req->stream.c_str()); | 174 | srs_trace("identify client success. type=%d, stream_name=%s", type, req->stream.c_str()); |
175 | 175 | ||
176 | - int chunk_size = config->get_chunk_size(); | 176 | + int chunk_size = config->get_chunk_size(req->vhost); |
177 | if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) { | 177 | if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) { |
178 | srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret); | 178 | srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret); |
179 | return ret; | 179 | return ret; |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | The MIT License (MIT) | 2 | The MIT License (MIT) |
3 | 3 | ||
4 | Copyright (c) 2013 winlin | 4 | Copyright (c) 2013 winlin |
5 | +Copyright (c) 2013 wenjiegit | ||
5 | 6 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
7 | this software and associated documentation files (the "Software"), to deal in | 8 | this software and associated documentation files (the "Software"), to deal in |
@@ -1442,14 +1443,27 @@ SrsConfDirective* SrsConfig::get_listen() | @@ -1442,14 +1443,27 @@ SrsConfDirective* SrsConfig::get_listen() | ||
1442 | return root->get("listen"); | 1443 | return root->get("listen"); |
1443 | } | 1444 | } |
1444 | 1445 | ||
1445 | -int SrsConfig::get_chunk_size() | 1446 | +int SrsConfig::get_chunk_size(const std::string &vhost) |
1446 | { | 1447 | { |
1447 | - SrsConfDirective* conf = root->get("chunk_size"); | ||
1448 | - if (!conf) { | 1448 | + SrsConfDirective* conf = get_vhost(vhost); |
1449 | + | ||
1450 | + if (!conf) { | ||
1449 | return SRS_CONF_DEFAULT_CHUNK_SIZE; | 1451 | return SRS_CONF_DEFAULT_CHUNK_SIZE; |
1450 | - } | ||
1451 | - | ||
1452 | - return ::atoi(conf->arg0().c_str()); | 1452 | + } |
1453 | + | ||
1454 | + conf = conf->get("chunk_size"); | ||
1455 | + if (!conf) { | ||
1456 | + // vhost does not specify the chunk size, | ||
1457 | + // use the global instead. | ||
1458 | + conf = root->get("chunk_size"); | ||
1459 | + if (!conf) { | ||
1460 | + return SRS_CONF_DEFAULT_CHUNK_SIZE; | ||
1461 | + } | ||
1462 | + | ||
1463 | + return ::atoi(conf->arg0().c_str()); | ||
1464 | + } | ||
1465 | + | ||
1466 | + return ::atoi(conf->arg0().c_str()); | ||
1453 | } | 1467 | } |
1454 | 1468 | ||
1455 | int SrsConfig::get_pithy_print_publish() | 1469 | int SrsConfig::get_pithy_print_publish() |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | The MIT License (MIT) | 2 | The MIT License (MIT) |
3 | 3 | ||
4 | Copyright (c) 2013 winlin | 4 | Copyright (c) 2013 winlin |
5 | +Copyright (c) 2013 wenjiegit | ||
5 | 6 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
7 | this software and associated documentation files (the "Software"), to deal in | 8 | this software and associated documentation files (the "Software"), to deal in |
@@ -162,7 +163,7 @@ public: | @@ -162,7 +163,7 @@ public: | ||
162 | virtual SrsConfDirective* get_refer_play(std::string vhost); | 163 | virtual SrsConfDirective* get_refer_play(std::string vhost); |
163 | virtual SrsConfDirective* get_refer_publish(std::string vhost); | 164 | virtual SrsConfDirective* get_refer_publish(std::string vhost); |
164 | virtual SrsConfDirective* get_listen(); | 165 | virtual SrsConfDirective* get_listen(); |
165 | - virtual int get_chunk_size(); | 166 | + virtual int get_chunk_size(const std::string& vhost); |
166 | virtual int get_pithy_print_publish(); | 167 | virtual int get_pithy_print_publish(); |
167 | virtual int get_pithy_print_forwarder(); | 168 | virtual int get_pithy_print_forwarder(); |
168 | virtual int get_pithy_print_encoder(); | 169 | virtual int get_pithy_print_encoder(); |
-
请 注册 或 登录 后发表评论