diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index 34315406c..1ec0e2411 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -539,6 +539,7 @@ public: * get the mr sleep time in ms for vhost. * @param vhost, the vhost to get the mr sleep time. */ + // TODO: FIXME: add utest for mr config. virtual int get_mr_sleep_ms(std::string vhost); private: /** diff --git a/trunk/src/app/srs_app_recv_thread.cpp b/trunk/src/app/srs_app_recv_thread.cpp index 0226090c2..578bc842e 100644 --- a/trunk/src/app/srs_app_recv_thread.cpp +++ b/trunk/src/app/srs_app_recv_thread.cpp @@ -33,6 +33,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using namespace std; +// the max small bytes to group +#define SRS_MR_SMALL_BYTES 4096 + ISrsMessageHandler::ISrsMessageHandler() { } @@ -390,8 +393,8 @@ void SrsPublishRecvThread::update_buffer(bool mr_enabled, int sleep_ms) // TODO: FIXME: refine it. #ifdef SRS_PERF_MERGED_READ - // previous enabled mr, update the buffer. - if (mr && mr_sleep != sleep_ms) { + // update the buffer. + if (true) { // the underlayer api will set to SRS_MR_SOCKET_BUFFER bytes. // 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536, // 128KB=131072, 256KB=262144, 512KB=524288 diff --git a/trunk/src/core/srs_core_performance.hpp b/trunk/src/core/srs_core_performance.hpp index 29abcbbb7..6407ae8df 100644 --- a/trunk/src/core/srs_core_performance.hpp +++ b/trunk/src/core/srs_core_performance.hpp @@ -56,9 +56,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * That is, the latency is 120ms(the sleep time). */ // to enable merged read. -#undef SRS_PERF_MERGED_READ -// the max sleep time in ms -#define SRS_MR_MAX_SLEEP_MS 800 +#define SRS_PERF_MERGED_READ /** * the send cache time in ms. diff --git a/trunk/src/rtmp/srs_protocol_buffer.cpp b/trunk/src/rtmp/srs_protocol_buffer.cpp index 4a8234dba..ab0cc7bbd 100644 --- a/trunk/src/rtmp/srs_protocol_buffer.cpp +++ b/trunk/src/rtmp/srs_protocol_buffer.cpp @@ -28,10 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -// the max small bytes to group -#define SRS_MR_SMALL_BYTES 4096 // the default recv buffer size -#define SRS_DEFAULT_RECV_BUFFER_SIZE 8192 +#define SRS_DEFAULT_RECV_BUFFER_SIZE 32768 // the max header size, // @see SrsProtocol::read_message_header(). @@ -111,7 +109,9 @@ void SrsFastBuffer::set_buffer(int buffer_size) int cap = end - p; char* buf = new char[buffer_size]; - memcpy(buf, buffer, nb_buffer); + if (cap > 0) { + memcpy(buf, buffer, nb_buffer); + } srs_freep(buffer); buffer = buf;