Skip to content

Commit

Permalink
[core] Fixed wrong limitation on SRTO_FC option. (#1899)
Browse files Browse the repository at this point in the history
Fixed documentation.
  • Loading branch information
ethouris authored Mar 30, 2021
1 parent e328bec commit 50c8355
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/API/API-socket-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ Possible values are those defined in `SRT_EPOLL_OPT` enum (a combination of
| ----------------- | ----- | -------- | --------- | ------ | -------- | ------ | --- | ------ |
| `SRTO_FC` | | pre | `int32_t` | pkts | 25600 | 32.. | RW | GSD |

Flight Flag Size (maximum number of bytes that can be sent without
Flight Flag Size (maximum number of packets that can be sent without
being acknowledged)

[Return to list](#list-of-options)
Expand Down
9 changes: 4 additions & 5 deletions srtcore/socketconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct CSrtConfig: CSrtMuxerConfig
static const uint32_t COMM_DEF_STABILITY_TIMEOUT_US = 80 * 1000;

// Mimimum recv flight flag size is 32 packets
static const int DEF_MAX_FLIGHT_PKT = 32;
static const int DEF_MIN_FLIGHT_PKT = 32;
static const size_t MAX_SID_LENGTH = 512;
static const size_t MAX_PFILTER_LENGTH = 64;
static const size_t MAX_CONG_LENGTH = 16;
Expand Down Expand Up @@ -418,7 +418,7 @@ struct CSrtConfigSetter<SRTO_FC>
if (fc < 1)
throw CUDTException(MJ_NOTSUP, MN_INVAL);

co.iFlightFlagSize = std::min(fc, +co.DEF_MAX_FLIGHT_PKT);
co.iFlightFlagSize = std::max(fc, +co.DEF_MIN_FLIGHT_PKT);
}
};

Expand Down Expand Up @@ -447,11 +447,10 @@ struct CSrtConfigSetter<SRTO_RCVBUF>
// Mimimum recv buffer size is 32 packets
const int mssin_size = co.iMSS - CPacket::UDP_HDR_SIZE;

// XXX This magic 32 deserves some constant
if (val > mssin_size * co.DEF_MAX_FLIGHT_PKT)
if (val > mssin_size * co.DEF_MIN_FLIGHT_PKT)
co.iRcvBufSize = val / mssin_size;
else
co.iRcvBufSize = co.DEF_MAX_FLIGHT_PKT;
co.iRcvBufSize = co.DEF_MIN_FLIGHT_PKT;

// recv buffer MUST not be greater than FC size
if (co.iRcvBufSize > co.iFlightFlagSize)
Expand Down

0 comments on commit 50c8355

Please sign in to comment.