common: Reduce the default MTU size by 8 bytes
This helps account for various protocols that add an extra 8 bytes on top of sent UDP traffic.
This commit is contained in:
parent
72fda3892f
commit
72224ce909
|
@ -104,7 +104,7 @@ stream->configure_ctx(RCC_PKT_MAX_DELAY, 150);
|
|||
| RCC_PKT_MAX_DELAY | How many milliseconds is each frame waited until they're dropped (for fragmented frames only) | 500 ms | Receiver |
|
||||
| RCC_DYN_PAYLOAD_TYPE | Override uvgRTP's default payload number used in RTP headers | Format-specific, see [util.hh](/include/uvgrtp/util.hh) | Both |
|
||||
| RCC_CLOCK_RATE | Override uvgRTP's default clock rate used to calculate RTP timestamps | Format-specific, see [RFC 3551](https://www.rfc-editor.org/rfc/rfc3551#section-6) | Sender |
|
||||
| RCC_MTU_SIZE | Set the Maximum Transmission Unit (MTU) value. uvgRTP assumes the repsence of UDP header (8 bytes) and IP header (20 bytes for IPv4) and substract those from the value. | 1500 bytes | Both |
|
||||
| RCC_MTU_SIZE | Set the Maximum Transmission Unit (MTU) value. uvgRTP assumes the presence of UDP header (8 bytes) and IP header (20 bytes for IPv4). Those are substracted those from the given value. | 1492 bytes | Both |
|
||||
| RCC_FPS_ENUMERATOR | Set the fps used with RCE_FRAMERATE and RCE_FRAGMENT_PACING. | 30 | Sender |
|
||||
| RCC_FPS_DENOMINATOR | Use this in combination with RCC_FPS_ENUMERATOR if you need fractional fps values | 1 | Sender |
|
||||
|
||||
|
@ -154,7 +154,7 @@ The second way of handling key-management of SRTP is to do it outside uvgRTP. To
|
|||
|
||||
## MTU size
|
||||
|
||||
The default MTU size of uvgRTP has been set to 1500. uvgRTP assumes the presence of an UDP header and IP header in addition an RTP header which are taken into account when fragmenting frames. If your application is expected to work through tunneling such as VPN which adds additional headers on top of packets, you should lower the MTU size to avoid unnecessary IP level fragmentation. Some networks also allow for a higher MTU size in which case you can increase this.
|
||||
The default MTU size of uvgRTP has been set to 1492 to account for 8 bytes of unknown overhead. uvgRTP assumes the presence of an UDP header and IP header in addition an RTP header which are taken into account when fragmenting frames. If your application is expected to work through tunneling such as VPN which adds additional headers on top of packets, you may need to lower the MTU size to avoid IP level fragmentation. Some networks also allow for a higher MTU size in which case you can increase this.
|
||||
|
||||
## Trouble receiving burst of packets?
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace uvgrtp {
|
|||
* \brief Send data to remote participant with a custom timestamp
|
||||
*
|
||||
* \details If so specified either by the selected media format and/or given
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1500 bytes,
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes,
|
||||
* or to any other size defined by the application using ::RCC_MTU_SIZE
|
||||
*
|
||||
* The frame is automatically reconstructed by the receiver if all fragments have been
|
||||
|
@ -120,7 +120,7 @@ namespace uvgrtp {
|
|||
* \brief Send data to remote participant with a custom timestamp
|
||||
*
|
||||
* \details If so specified either by the selected media format and/or given
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1500 bytes,
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes,
|
||||
* or to any other size defined by the application using ::RCC_MTU_SIZE
|
||||
*
|
||||
* The frame is automatically reconstructed by the receiver if all fragments have been
|
||||
|
@ -144,7 +144,7 @@ namespace uvgrtp {
|
|||
* \brief Send data to remote participant with a custom timestamp
|
||||
*
|
||||
* \details If so specified either by the selected media format and/or given
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1500 bytes,
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes,
|
||||
* or to any other size defined by the application using ::RCC_MTU_SIZE
|
||||
*
|
||||
* The frame is automatically reconstructed by the receiver if all fragments have been
|
||||
|
@ -175,7 +175,7 @@ namespace uvgrtp {
|
|||
* \brief Send data to remote participant with a custom timestamp
|
||||
*
|
||||
* \details If so specified either by the selected media format and/or given
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1500 bytes,
|
||||
* ::RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes,
|
||||
* or to any other size defined by the application using ::RCC_MTU_SIZE
|
||||
*
|
||||
* The frame is automatically reconstructed by the receiver if all fragments have been
|
||||
|
|
|
@ -24,8 +24,9 @@ namespace uvgrtp {
|
|||
constexpr uint8_t UDP_HDR_SIZE = 8;
|
||||
constexpr uint8_t RTP_HDR_SIZE = 12;
|
||||
|
||||
// the default MTU size for ethernet, can be adjusted with rcc flags
|
||||
constexpr uint16_t DEFAULT_MTU_SIZE = 1500;
|
||||
/* the default MTU size for ethernet, can be adjusted with rcc flags.
|
||||
* The default is assumed to be 1500 minus 8 bytes reserved for additional protocol headers- */
|
||||
constexpr uint16_t DEFAULT_MTU_SIZE = 1492;
|
||||
|
||||
constexpr uint16_t MAX_IPV4_PAYLOAD = DEFAULT_MTU_SIZE - IPV4_HDR_SIZE - UDP_HDR_SIZE;
|
||||
constexpr uint16_t MAX_IPV6_PAYLOAD = DEFAULT_MTU_SIZE - IPV6_HDR_SIZE - UDP_HDR_SIZE;
|
||||
|
@ -225,7 +226,7 @@ enum RTP_CTX_ENABLE_FLAGS {
|
|||
arrived. Does not work if the dependencies are not in monotonic order. */
|
||||
RCE_H26X_DEPENDENCY_ENFORCEMENT = 1 << 7,
|
||||
|
||||
/** Fragment frames into RTP packets of MTU size (1500 bytes).
|
||||
/** Fragment frames into RTP packets of MTU size (1492 bytes).
|
||||
*
|
||||
* Some RTP profiles define fragmentation by setting the marker bit indicating the
|
||||
* last fragment of the frame. You can enable this functionality using this flag at
|
||||
|
@ -332,10 +333,10 @@ enum RTP_CTX_CONFIGURATION_FLAGS {
|
|||
|
||||
/** Set a maximum value for the Ethernet frame size assumed by uvgRTP.
|
||||
*
|
||||
* Default is 1500, from this Ethernet, IPv4 and UDP, and RTP headers
|
||||
* are removed from this, giving a payload size of 1446 bytes
|
||||
* Default is 1492, from this IPv4 and UDP, and RTP headers
|
||||
* are removed, giving a payload size of 1452 bytes.
|
||||
*
|
||||
* If application wishes to use small UDP datagrams for some reason,
|
||||
* If application wishes to use small UDP datagram,
|
||||
* it can set MTU size to, for example, 500 bytes or if it wishes
|
||||
* to use jumbo frames, it can set the MTU size to 9000 bytes */
|
||||
RCC_MTU_SIZE = 7,
|
||||
|
|
|
@ -247,11 +247,6 @@ rtp_error_t uvgrtp::frame_queue::enqueue_message(buf_vec& buffers)
|
|||
total += buffer.first;
|
||||
}
|
||||
|
||||
if (total > 1500)
|
||||
{
|
||||
UVG_LOG_DEBUG("Encryption needs to keep its FU division!");
|
||||
}
|
||||
|
||||
uint8_t* mem = new uint8_t[total];
|
||||
uint8_t* ptr = mem;
|
||||
|
||||
|
|
|
@ -59,10 +59,7 @@ namespace uvgrtp {
|
|||
/* Use custom timestamp for the outgoing RTP packets */
|
||||
uint64_t timestamp_;
|
||||
|
||||
/* What is the maximum size of the payload available for this RTP instance
|
||||
*
|
||||
* By default, the value is set to 1443
|
||||
* (maximum amount of payload bytes when MTU is 1500) */
|
||||
/* What is the maximum size of the payload available for this RTP instance */
|
||||
size_t payload_size_;
|
||||
|
||||
/* What is the maximum delay allowed for each frame
|
||||
|
|
Loading…
Reference in New Issue