Increase MAX_PAYLOAD by 3 bytes

1443 is the maximum payload size for H26X Fragmentation Units but
for generic frames there is no NAL + FU header meaning the 3 bytes
can be used for payload data
This commit is contained in:
Aaro Altonen 2021-02-13 03:43:24 +02:00
parent 5ad18e3284
commit b1ccd7f788
2 changed files with 13 additions and 4 deletions

View File

@ -31,9 +31,9 @@ typedef SSIZE_T ssize_t;
typedef int socket_t;
#endif
const int MAX_PACKET = 65536;
const int MAX_PAYLOAD = 1443;
const int PKT_MAX_DELAY = 100;
const int MAX_PACKET = 65536;
const int MAX_PAYLOAD = 1446;
const int PKT_MAX_DELAY = 100;
typedef enum RTP_ERROR {
RTP_MULTIPLE_PKTS_READY = 6, /* multiple packets can be queried from the layer */

View File

@ -16,7 +16,6 @@ uvg_rtp::rtp::rtp(rtp_format_t fmt):
wc_start_(0),
sent_pkts_(0),
timestamp_(INVALID_TS),
payload_size_(MAX_PAYLOAD),
delay_(PKT_MAX_DELAY)
{
seq_ = uvg_rtp::random::generate_32() & 0xffff;
@ -24,6 +23,7 @@ uvg_rtp::rtp::rtp(rtp_format_t fmt):
ssrc_ = uvg_rtp::random::generate_32();
set_payload(fmt);
set_payload_size(MAX_PAYLOAD);
}
uvg_rtp::rtp::~rtp()
@ -128,6 +128,15 @@ uint32_t uvg_rtp::rtp::get_clock_rate(void)
void uvg_rtp::rtp::set_payload_size(size_t payload_size)
{
switch (fmt_) {
case RTP_FORMAT_H264:
case RTP_FORMAT_H265:
case RTP_FORMAT_H266:
if (payload_size > 3)
payload_size -= 3;
break;
}
payload_size_ = payload_size;
}