winlin

chunk size default to 60000, high performance. set chunk size when forward

@@ -4,8 +4,8 @@ listen 1935; @@ -4,8 +4,8 @@ listen 1935;
4 # some client does not support chunk size change, 4 # some client does not support chunk size change,
5 # however, most clients supports it and it can improve 5 # however, most clients supports it and it can improve
6 # performance about 10%. 6 # performance about 10%.
7 -# default: 4096  
8 -chunk_size 65000; 7 +# default: 60000
  8 +chunk_size 60000;
9 # the logs dir. 9 # the logs dir.
10 # if enabled ffmpeg, each stracoding stream will create a log file. 10 # if enabled ffmpeg, each stracoding stream will create a log file.
11 # default: ./objs/logs 11 # default: ./objs/logs
@@ -26,7 +26,7 @@ vhost __defaultVhost__ { @@ -26,7 +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 + chunk_size 60000;
30 enabled on; 30 enabled on;
31 gop_cache on; 31 gop_cache on;
32 queue_length 30; 32 queue_length 30;
@@ -57,7 +57,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -57,7 +57,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
57 // the interval in seconds for bandwidth check 57 // the interval in seconds for bandwidth check
58 #define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000 58 #define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000
59 59
60 -#define SRS_CONF_DEFAULT_CHUNK_SIZE 4096 60 +// the default chunk size for system.
  61 +#define SRS_CONF_DEFAULT_CHUNK_SIZE 60000
61 62
62 #define SRS_STAGE_PLAY_USER_INTERVAL_MS 1300 63 #define SRS_STAGE_PLAY_USER_INTERVAL_MS 1300
63 #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 1100 64 #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 1100
@@ -391,12 +391,44 @@ int SrsRtmpClient::play(string stream, int stream_id) @@ -391,12 +391,44 @@ int SrsRtmpClient::play(string stream, int stream_id)
391 } 391 }
392 } 392 }
393 393
  394 + // SetChunkSize
  395 + if (true) {
  396 + SrsCommonMessage* msg = new SrsCommonMessage();
  397 + SrsSetChunkSizePacket* pkt = new SrsSetChunkSizePacket();
  398 +
  399 + pkt->chunk_size = SRS_CONF_DEFAULT_CHUNK_SIZE;
  400 + msg->set_packet(pkt, 0);
  401 +
  402 + if ((ret = protocol->send_message(msg)) != ERROR_SUCCESS) {
  403 + srs_error("send set chunk size failed. "
  404 + "stream=%s, chunk_size=%d, ret=%d",
  405 + stream.c_str(), SRS_CONF_DEFAULT_CHUNK_SIZE, ret);
  406 + return ret;
  407 + }
  408 + }
  409 +
394 return ret; 410 return ret;
395 } 411 }
396 412
397 int SrsRtmpClient::publish(string stream, int stream_id) 413 int SrsRtmpClient::publish(string stream, int stream_id)
398 { 414 {
399 int ret = ERROR_SUCCESS; 415 int ret = ERROR_SUCCESS;
  416 +
  417 + // SetChunkSize
  418 + if (true) {
  419 + SrsCommonMessage* msg = new SrsCommonMessage();
  420 + SrsSetChunkSizePacket* pkt = new SrsSetChunkSizePacket();
  421 +
  422 + pkt->chunk_size = SRS_CONF_DEFAULT_CHUNK_SIZE;
  423 + msg->set_packet(pkt, 0);
  424 +
  425 + if ((ret = protocol->send_message(msg)) != ERROR_SUCCESS) {
  426 + srs_error("send set chunk size failed. "
  427 + "stream=%s, chunk_size=%d, ret=%d",
  428 + stream.c_str(), SRS_CONF_DEFAULT_CHUNK_SIZE, ret);
  429 + return ret;
  430 + }
  431 + }
400 432
401 // publish(stream) 433 // publish(stream)
402 if (true) { 434 if (true) {