1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix bug for bug #241, default to 32k for socket buffer.

This commit is contained in:
winlin 2014-12-04 18:35:50 +08:00
parent 5589b13d2e
commit f1192a8302
4 changed files with 11 additions and 9 deletions

View file

@ -539,6 +539,7 @@ public:
* get the mr sleep time in ms for vhost. * get the mr sleep time in ms for vhost.
* @param vhost, the vhost to get the mr sleep time. * @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); virtual int get_mr_sleep_ms(std::string vhost);
private: private:
/** /**

View file

@ -33,6 +33,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using namespace std; using namespace std;
// the max small bytes to group
#define SRS_MR_SMALL_BYTES 4096
ISrsMessageHandler::ISrsMessageHandler() ISrsMessageHandler::ISrsMessageHandler()
{ {
} }
@ -390,8 +393,8 @@ void SrsPublishRecvThread::update_buffer(bool mr_enabled, int sleep_ms)
// TODO: FIXME: refine it. // TODO: FIXME: refine it.
#ifdef SRS_PERF_MERGED_READ #ifdef SRS_PERF_MERGED_READ
// previous enabled mr, update the buffer. // update the buffer.
if (mr && mr_sleep != sleep_ms) { if (true) {
// the underlayer api will set to SRS_MR_SOCKET_BUFFER bytes. // the underlayer api will set to SRS_MR_SOCKET_BUFFER bytes.
// 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536, // 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536,
// 128KB=131072, 256KB=262144, 512KB=524288 // 128KB=131072, 256KB=262144, 512KB=524288

View file

@ -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). * That is, the latency is 120ms(the sleep time).
*/ */
// to enable merged read. // to enable merged read.
#undef SRS_PERF_MERGED_READ #define SRS_PERF_MERGED_READ
// the max sleep time in ms
#define SRS_MR_MAX_SLEEP_MS 800
/** /**
* the send cache time in ms. * the send cache time in ms.

View file

@ -28,10 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#include <srs_core_performance.hpp> #include <srs_core_performance.hpp>
// the max small bytes to group
#define SRS_MR_SMALL_BYTES 4096
// the default recv buffer size // the default recv buffer size
#define SRS_DEFAULT_RECV_BUFFER_SIZE 8192 #define SRS_DEFAULT_RECV_BUFFER_SIZE 32768
// the max header size, // the max header size,
// @see SrsProtocol::read_message_header(). // @see SrsProtocol::read_message_header().
@ -111,7 +109,9 @@ void SrsFastBuffer::set_buffer(int buffer_size)
int cap = end - p; int cap = end - p;
char* buf = new char[buffer_size]; char* buf = new char[buffer_size];
memcpy(buf, buffer, nb_buffer); if (cap > 0) {
memcpy(buf, buffer, nb_buffer);
}
srs_freep(buffer); srs_freep(buffer);
buffer = buf; buffer = buf;