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:
parent
5589b13d2e
commit
f1192a8302
4 changed files with 11 additions and 9 deletions
|
@ -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:
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -28,10 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_core_performance.hpp>
|
||||
|
||||
// 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];
|
||||
if (cap > 0) {
|
||||
memcpy(buf, buffer, nb_buffer);
|
||||
}
|
||||
srs_freep(buffer);
|
||||
|
||||
buffer = buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue