mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #730, support config in/out ack size. 3.0.13
This commit is contained in:
parent
bbbc40f9c2
commit
1b175b1107
7 changed files with 86 additions and 6 deletions
|
@ -355,6 +355,12 @@ int64_t SrsProtocol::get_send_bytes()
|
|||
return skt->get_send_bytes();
|
||||
}
|
||||
|
||||
int SrsProtocol::set_in_window_ack_size(int ack_size)
|
||||
{
|
||||
in_ack_size.window = ack_size;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
int SrsProtocol::recv_message(SrsCommonMessage** pmsg)
|
||||
{
|
||||
*pmsg = NULL;
|
||||
|
@ -1620,7 +1626,7 @@ int SrsProtocol::response_acknowledgement_message()
|
|||
}
|
||||
|
||||
// ignore when delta bytes not exceed half of window(ack size).
|
||||
uint32_t delta = (uint32_t)(skt->get_recv_bytes() - in_ack_size.nb_recv_bytes);
|
||||
uint32_t delta = (uint32_t)(skt->get_recv_bytes() - in_ack_size.nb_recv_bytes)*100;
|
||||
if (delta < in_ack_size.window / 2) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -1635,7 +1641,6 @@ int SrsProtocol::response_acknowledgement_message()
|
|||
|
||||
SrsAcknowledgementPacket* pkt = new SrsAcknowledgementPacket();
|
||||
pkt->sequence_number = sequence_number;
|
||||
srs_warn("ack sequence=%#x", sequence_number);
|
||||
|
||||
// cache the message and use flush to send.
|
||||
if (!auto_response_when_recv) {
|
||||
|
@ -2548,6 +2553,11 @@ int SrsRtmpServer::set_window_ack_size(int ack_size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmpServer::set_in_window_ack_size(int ack_size)
|
||||
{
|
||||
return protocol->set_in_window_ack_size(ack_size);
|
||||
}
|
||||
|
||||
int SrsRtmpServer::set_peer_bandwidth(int bandwidth, int type)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
|
@ -329,6 +329,14 @@ public:
|
|||
*/
|
||||
virtual int64_t get_recv_bytes();
|
||||
virtual int64_t get_send_bytes();
|
||||
public:
|
||||
// Set the input default ack size. This is generally set by the message from peer,
|
||||
// but for some encoder, it never send the ack message while it default to a none zone size.
|
||||
// This will cause the encoder to block after publishing some messages to server,
|
||||
// because it wait for server to send acknowledge, but server default to 0 which means no need
|
||||
// to ack encoder. We can change the default input ack size. We will always response the
|
||||
// ack size whatever the encoder set or not.
|
||||
virtual int set_in_window_ack_size(int ack_size);
|
||||
public:
|
||||
/**
|
||||
* recv a RTMP message, which is bytes oriented.
|
||||
|
@ -928,9 +936,11 @@ public:
|
|||
*/
|
||||
virtual int connect_app(SrsRequest* req);
|
||||
/**
|
||||
* set ack size to client, client will send ack-size for each ack window
|
||||
* set output ack size to client, client will send ack-size for each ack window
|
||||
*/
|
||||
virtual int set_window_ack_size(int ack_size);
|
||||
// Set the default input ack size value.
|
||||
virtual int set_in_window_ack_size(int ack_size);
|
||||
/**
|
||||
* @type: The sender can mark this message hard (0), soft (1), or dynamic (2)
|
||||
* using the Limit type field.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue