diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf index 232c1238e..6ae16e04c 100755 --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -4,8 +4,8 @@ listen 1935; # some client does not support chunk size change, # however, most clients supports it and it can improve # performance about 10%. -# default: 4096 -chunk_size 65000; +# default: 60000 +chunk_size 60000; # the logs dir. # if enabled ffmpeg, each stracoding stream will create a log file. # default: ./objs/logs @@ -26,7 +26,7 @@ vhost __defaultVhost__ { # for which cannot identify the required vhost. # for default demo. vhost demo.srs.com { - chunk_size 4096; + chunk_size 60000; enabled on; gop_cache on; queue_length 30; diff --git a/trunk/src/core/srs_core_config.hpp b/trunk/src/core/srs_core_config.hpp index 3cd693275..4bbe122eb 100644 --- a/trunk/src/core/srs_core_config.hpp +++ b/trunk/src/core/srs_core_config.hpp @@ -57,7 +57,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // the interval in seconds for bandwidth check #define SRS_CONF_DEFAULT_BANDWIDTH_LIMIT_KBPS 1000 -#define SRS_CONF_DEFAULT_CHUNK_SIZE 4096 +// the default chunk size for system. +#define SRS_CONF_DEFAULT_CHUNK_SIZE 60000 #define SRS_STAGE_PLAY_USER_INTERVAL_MS 1300 #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 1100 diff --git a/trunk/src/core/srs_core_rtmp.cpp b/trunk/src/core/srs_core_rtmp.cpp index 4164436d2..bf67fb9fc 100644 --- a/trunk/src/core/srs_core_rtmp.cpp +++ b/trunk/src/core/srs_core_rtmp.cpp @@ -391,12 +391,44 @@ int SrsRtmpClient::play(string stream, int stream_id) } } + // SetChunkSize + if (true) { + SrsCommonMessage* msg = new SrsCommonMessage(); + SrsSetChunkSizePacket* pkt = new SrsSetChunkSizePacket(); + + pkt->chunk_size = SRS_CONF_DEFAULT_CHUNK_SIZE; + msg->set_packet(pkt, 0); + + if ((ret = protocol->send_message(msg)) != ERROR_SUCCESS) { + srs_error("send set chunk size failed. " + "stream=%s, chunk_size=%d, ret=%d", + stream.c_str(), SRS_CONF_DEFAULT_CHUNK_SIZE, ret); + return ret; + } + } + return ret; } int SrsRtmpClient::publish(string stream, int stream_id) { int ret = ERROR_SUCCESS; + + // SetChunkSize + if (true) { + SrsCommonMessage* msg = new SrsCommonMessage(); + SrsSetChunkSizePacket* pkt = new SrsSetChunkSizePacket(); + + pkt->chunk_size = SRS_CONF_DEFAULT_CHUNK_SIZE; + msg->set_packet(pkt, 0); + + if ((ret = protocol->send_message(msg)) != ERROR_SUCCESS) { + srs_error("send set chunk size failed. " + "stream=%s, chunk_size=%d, ret=%d", + stream.c_str(), SRS_CONF_DEFAULT_CHUNK_SIZE, ret); + return ret; + } + } // publish(stream) if (true) {