mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge branch '4.0release' into merge/develop
This commit is contained in:
commit
72a48f6115
44 changed files with 141 additions and 1277 deletions
|
@ -75,7 +75,7 @@ public:
|
|||
/**
|
||||
* the reader for the protocol to read from whatever channel.
|
||||
*/
|
||||
class ISrsProtocolReader : virtual public ISrsReader, virtual public ISrsProtocolStatistic
|
||||
class ISrsProtocolReader : public ISrsReader, virtual public ISrsProtocolStatistic
|
||||
{
|
||||
public:
|
||||
ISrsProtocolReader();
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
/**
|
||||
* the writer for the protocol to write to whatever channel.
|
||||
*/
|
||||
class ISrsProtocolWriter : virtual public ISrsWriter, virtual public ISrsProtocolStatistic
|
||||
class ISrsProtocolWriter : public ISrsWriter, virtual public ISrsProtocolStatistic
|
||||
{
|
||||
public:
|
||||
ISrsProtocolWriter();
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
/**
|
||||
* The reader and writer.
|
||||
*/
|
||||
class ISrsProtocolReadWriter : virtual public ISrsProtocolReader, virtual public ISrsProtocolWriter
|
||||
class ISrsProtocolReadWriter : public ISrsProtocolReader, public ISrsProtocolWriter
|
||||
{
|
||||
public:
|
||||
ISrsProtocolReadWriter();
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
* user->set_io(kbps, kbps);
|
||||
* the server never know how many bytes already send/recv, for the connection maybe closed.
|
||||
*/
|
||||
class SrsKbps : virtual public ISrsProtocolStatistic, virtual public ISrsKbpsDelta
|
||||
class SrsKbps : public ISrsProtocolStatistic, public ISrsKbpsDelta
|
||||
{
|
||||
private:
|
||||
SrsKbpsSlice is;
|
||||
|
|
|
@ -217,14 +217,6 @@ srs_error_t SrsPacket::encode_packet(SrsBuffer* stream)
|
|||
return srs_error_new(ERROR_SYSTEM_PACKET_INVALID, "encode");
|
||||
}
|
||||
|
||||
ISrsProtocolPerf::ISrsProtocolPerf()
|
||||
{
|
||||
}
|
||||
|
||||
ISrsProtocolPerf::~ISrsProtocolPerf()
|
||||
{
|
||||
}
|
||||
|
||||
SrsProtocol::AckWindowSize::AckWindowSize()
|
||||
{
|
||||
window = 0;
|
||||
|
@ -264,7 +256,6 @@ SrsProtocol::SrsProtocol(ISrsProtocolReadWriter* io)
|
|||
}
|
||||
|
||||
out_c0c3_caches = new char[SRS_CONSTS_C0C3_HEADERS_MAX];
|
||||
perf = NULL;
|
||||
}
|
||||
|
||||
SrsProtocol::~SrsProtocol()
|
||||
|
@ -312,11 +303,6 @@ void SrsProtocol::set_auto_response(bool v)
|
|||
auto_response_when_recv = v;
|
||||
}
|
||||
|
||||
void SrsProtocol::set_perf(ISrsProtocolPerf* v)
|
||||
{
|
||||
perf = v;
|
||||
}
|
||||
|
||||
srs_error_t SrsProtocol::manual_response_flush()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -463,11 +449,6 @@ srs_error_t SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msg
|
|||
int c0c3_cache_index = 0;
|
||||
char* c0c3_cache = out_c0c3_caches + c0c3_cache_index;
|
||||
|
||||
// How many messages are merged in written.
|
||||
int nb_msgs_merged_written = 0;
|
||||
// How many bytes of messages are merged in written.
|
||||
int bytes_msgs_merged_written = 0;
|
||||
|
||||
// try to send use the c0c3 header cache,
|
||||
// if cache is consumed, try another loop.
|
||||
for (int i = 0; i < nb_msgs; i++) {
|
||||
|
@ -481,10 +462,6 @@ srs_error_t SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msg
|
|||
if (!msg->payload || msg->size <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Increase the perf stat data.
|
||||
nb_msgs_merged_written++;
|
||||
bytes_msgs_merged_written += msg->size;
|
||||
|
||||
// p set to current write position,
|
||||
// it's ok when payload is NULL and size is 0.
|
||||
|
@ -545,13 +522,6 @@ srs_error_t SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msg
|
|||
if ((err = do_iovs_send(out_iovs, iov_index)) != srs_success) {
|
||||
return srs_error_wrap(err, "send iovs");
|
||||
}
|
||||
|
||||
// Notify about perf stat.
|
||||
if (perf) {
|
||||
perf->perf_on_msgs(nb_msgs_merged_written);
|
||||
perf->perf_on_writev_iovs(iov_index);
|
||||
nb_msgs_merged_written = 0; bytes_msgs_merged_written = 0;
|
||||
}
|
||||
|
||||
// reset caches, while these cache ensure
|
||||
// atleast we can sendout a chunk.
|
||||
|
@ -575,13 +545,6 @@ srs_error_t SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msg
|
|||
return srs_error_wrap(err, "send iovs");
|
||||
}
|
||||
|
||||
// Notify about perf stat.
|
||||
if (perf) {
|
||||
perf->perf_on_msgs(nb_msgs_merged_written);
|
||||
perf->perf_on_writev_iovs(iov_index);
|
||||
nb_msgs_merged_written = 0; bytes_msgs_merged_written = 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
#else
|
||||
// try to send use the c0c3 header cache,
|
||||
|
@ -2257,11 +2220,6 @@ void SrsRtmpServer::set_auto_response(bool v)
|
|||
protocol->set_auto_response(v);
|
||||
}
|
||||
|
||||
void SrsRtmpServer::set_perf(ISrsProtocolPerf* v)
|
||||
{
|
||||
protocol->set_perf(v);
|
||||
}
|
||||
|
||||
#ifdef SRS_PERF_MERGED_READ
|
||||
void SrsRtmpServer::set_merge_read(bool v, IMergeReadHandler* handler)
|
||||
{
|
||||
|
|
|
@ -147,19 +147,6 @@ protected:
|
|||
virtual srs_error_t encode_packet(SrsBuffer* stream);
|
||||
};
|
||||
|
||||
// The performance statistic data collect.
|
||||
class ISrsProtocolPerf
|
||||
{
|
||||
public:
|
||||
ISrsProtocolPerf();
|
||||
virtual ~ISrsProtocolPerf();
|
||||
public:
|
||||
// Stat for packets merged written, nb_msgs is the number of RTMP messages,
|
||||
virtual void perf_on_msgs(int nb_msgs) = 0;
|
||||
// Stat for TCP writev, nb_iovs is the total number of iovec.
|
||||
virtual void perf_on_writev_iovs(int nb_iovs) = 0;
|
||||
};
|
||||
|
||||
// The protocol provides the rtmp-message-protocol services,
|
||||
// To recv RTMP message from RTMP chunk stream,
|
||||
// and to send out RTMP message over RTMP chunk stream.
|
||||
|
@ -181,8 +168,6 @@ private:
|
|||
private:
|
||||
// The underlayer socket object, send/recv bytes.
|
||||
ISrsProtocolReadWriter* skt;
|
||||
// The performance stat handler.
|
||||
ISrsProtocolPerf* perf;
|
||||
// The requests sent out, used to build the response.
|
||||
// key: transactionId
|
||||
// value: the request command name
|
||||
|
@ -242,8 +227,6 @@ public:
|
|||
// @param v, whether auto response message when recv message.
|
||||
// @see: https://github.com/ossrs/srs/issues/217
|
||||
virtual void set_auto_response(bool v);
|
||||
// Set the performance stat handler.
|
||||
virtual void set_perf(ISrsProtocolPerf* v);
|
||||
// Flush for manual response when the auto response is disabled
|
||||
// by set_auto_response(false), we default use auto response, so donot
|
||||
// need to call this api(the protocol sdk will auto send message).
|
||||
|
@ -654,8 +637,6 @@ public:
|
|||
// @param v, whether auto response message when recv message.
|
||||
// @see: https://github.com/ossrs/srs/issues/217
|
||||
virtual void set_auto_response(bool v);
|
||||
// Set the performance stat handler.
|
||||
virtual void set_perf(ISrsProtocolPerf* v);
|
||||
#ifdef SRS_PERF_MERGED_READ
|
||||
// To improve read performance, merge some packets then read,
|
||||
// When it on and read small bytes, we sleep to wait more data.,
|
||||
|
|
|
@ -46,7 +46,7 @@ class SrsTcpClient;
|
|||
#define SRS_HTTP_CLIENT_TIMEOUT (30 * SRS_UTIME_SECONDS)
|
||||
|
||||
// The SSL client over TCP transport.
|
||||
class SrsSslClient : virtual public ISrsReader, virtual public ISrsStreamWriter
|
||||
class SrsSslClient : public ISrsReader, public ISrsStreamWriter
|
||||
{
|
||||
private:
|
||||
SrsTcpClient* transport;
|
||||
|
|
|
@ -257,7 +257,7 @@ public:
|
|||
};
|
||||
|
||||
// Response reader use st socket.
|
||||
class SrsHttpResponseReader : virtual public ISrsHttpResponseReader
|
||||
class SrsHttpResponseReader : public ISrsHttpResponseReader
|
||||
{
|
||||
private:
|
||||
ISrsReader* skt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue