janus: renamed US_RTP_DATAGRAM_SIZE -> US_RTP_TOTAL_SIZE

This commit is contained in:
Maxim Devaev 2026-02-12 19:27:00 +02:00
parent c730981827
commit e013356cf0
4 changed files with 7 additions and 7 deletions

View File

@ -279,7 +279,7 @@ static void *_acap_thread(void *arg) {
if (_get_acap_hz(&hz) < 0 || acap->pcm_hz != hz) { if (_get_acap_hz(&hz) < 0 || acap->pcm_hz != hz) {
goto close_acap; goto close_acap;
} }
uz size = US_RTP_DATAGRAM_SIZE - US_RTP_HEADER_SIZE; uz size = US_RTP_TOTAL_SIZE - US_RTP_HEADER_SIZE;
u8 data[size]; u8 data[size];
u64 pts; u64 pts;
const int result = us_acap_get_encoded(acap, data, &size, &pts); const int result = us_acap_get_encoded(acap, data, &size, &pts);

View File

@ -26,9 +26,9 @@
// https://stackoverflow.com/questions/47635545/why-webrtc-chose-rtp-max-packet-size-to-1200-bytes // https://stackoverflow.com/questions/47635545/why-webrtc-chose-rtp-max-packet-size-to-1200-bytes
#define US_RTP_DATAGRAM_SIZE 1200 #define US_RTP_TOTAL_SIZE 1200
#define US_RTP_HEADER_SIZE 12 #define US_RTP_HEADER_SIZE 12
#define US_RTP_PAYLOAD_SIZE (US_RTP_DATAGRAM_SIZE - US_RTP_HEADER_SIZE) #define US_RTP_PAYLOAD_SIZE (US_RTP_TOTAL_SIZE - US_RTP_HEADER_SIZE)
#define US_RTP_H264_PAYLOAD 96 #define US_RTP_H264_PAYLOAD 96
#define US_RTP_OPUS_PAYLOAD 111 #define US_RTP_OPUS_PAYLOAD 111
@ -43,7 +43,7 @@ typedef struct {
u32 ssrc; u32 ssrc;
u16 seq; u16 seq;
u8 datagram[US_RTP_DATAGRAM_SIZE]; u8 datagram[US_RTP_TOTAL_SIZE];
uz used; uz used;
bool first_of_frame; bool first_of_frame;

View File

@ -45,7 +45,7 @@ void us_rtpa_destroy(us_rtpa_s *rtpa) {
} }
void us_rtpa_wrap(us_rtpa_s *rtpa, const u8 *data, uz size, u32 pts) { void us_rtpa_wrap(us_rtpa_s *rtpa, const u8 *data, uz size, u32 pts) {
if (size + US_RTP_HEADER_SIZE <= US_RTP_DATAGRAM_SIZE) { if (size + US_RTP_HEADER_SIZE <= US_RTP_TOTAL_SIZE) {
us_rtp_write_header(rtpa->rtp, pts, false); us_rtp_write_header(rtpa->rtp, pts, false);
memcpy(rtpa->rtp->datagram + US_RTP_HEADER_SIZE, data, size); memcpy(rtpa->rtp->datagram + US_RTP_HEADER_SIZE, data, size);
rtpa->rtp->used = size + US_RTP_HEADER_SIZE; rtpa->rtp->used = size + US_RTP_HEADER_SIZE;

View File

@ -116,7 +116,7 @@ void _rtpv_process_nalu(us_rtpv_s *rtpv, const u8 *data, uz size, u32 pts, bool
rtpv->rtp->last_of_frame = m_lof; \ rtpv->rtp->last_of_frame = m_lof; \
} }
if (size + US_RTP_HEADER_SIZE <= US_RTP_DATAGRAM_SIZE) { if (size + US_RTP_HEADER_SIZE <= US_RTP_TOTAL_SIZE) {
us_rtp_write_header(rtpv->rtp, pts, marked); us_rtp_write_header(rtpv->rtp, pts, marked);
memcpy(dg + US_RTP_HEADER_SIZE, data, size); memcpy(dg + US_RTP_HEADER_SIZE, data, size);
rtpv->rtp->used = size + US_RTP_HEADER_SIZE; rtpv->rtp->used = size + US_RTP_HEADER_SIZE;
@ -137,7 +137,7 @@ void _rtpv_process_nalu(us_rtpv_s *rtpv, const u8 *data, uz size, u32 pts, bool
bool first = true; bool first = true;
while (remaining > 0) { while (remaining > 0) {
sz frag_size = US_RTP_DATAGRAM_SIZE - fu_overhead; sz frag_size = US_RTP_TOTAL_SIZE - fu_overhead;
const bool last = (remaining <= frag_size); const bool last = (remaining <= frag_size);
if (last) { if (last) {
frag_size = remaining; frag_size = remaining;