winlin

for bug #241, simplify the buffer, donot reset when chunk size change.

... ... @@ -200,25 +200,6 @@ void SrsFastBuffer::set_merge_read(bool v, int max_buffer, IMergeReadHandler* ha
}
#endif
void SrsFastBuffer::on_chunk_size(int32_t chunk_size)
{
if (nb_buffer >= chunk_size) {
return;
}
// limit the max buffer.
int buffer_size = srs_min(chunk_size, SRS_MR_SOCKET_BUFFER);
if (buffer_size != nb_buffer) {
reset_buffer(buffer_size);
}
}
int SrsFastBuffer::buffer_size()
{
return nb_buffer;
}
void SrsFastBuffer::reset_buffer(int size)
{
// remember the cap.
... ...
... ... @@ -163,17 +163,6 @@ public:
*/
virtual void set_merge_read(bool v, int max_buffer, IMergeReadHandler* handler);
#endif
public:
/**
* when chunk size changed, the buffer should change the buffer also.
* to keep the socket buffer size always greater than chunk size.
* @see https://github.com/winlinvip/simple-rtmp-server/issues/241
*/
virtual void on_chunk_size(int32_t chunk_size);
/**
* get the size of socket buffer to read.
*/
virtual int buffer_size();
private:
virtual void reset_buffer(int size);
};
... ...
... ... @@ -1708,11 +1708,8 @@ int SrsProtocol::on_recv_message(SrsMessage* msg)
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE);
}
int sock_buffer = in_buffer->buffer_size();
in_chunk_size = pkt->chunk_size;
in_buffer->on_chunk_size(pkt->chunk_size);
srs_trace("input chunk size to %d, sock buf %d=>%d",
pkt->chunk_size, sock_buffer, in_buffer->buffer_size());
srs_trace("input chunk size to %d", pkt->chunk_size);
break;
}
... ...