Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtp: send all RTCP packets as compound packets #1222

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

maximilianfridrich
Copy link
Contributor

@maximilianfridrich maximilianfridrich commented Dec 2, 2024

According to RFC 3550 section 6.1 all RTCP packets MUST be sent as compound packets:

   Thus, all RTCP packets MUST be sent in a compound packet of at least
   two individual packets, with the following format:
   ...
   SR or RR:  The first RTCP packet in the compound packet MUST
      always be a report packet to facilitate header validation as
      described in Appendix A.2.  This is true even if no data has been
      sent or received, in which case an empty RR MUST be sent, and even
      if the only other RTCP packet in the compound packet is a BYE.
   ...
   SDES:  An SDES packet containing a CNAME item MUST be included
      in each compound RTCP packet, except as noted in Section 9.1.

With this change, RTCP packets sent with rtcp_quick_send are now sent as compound packets and thereby RFC compliant.

According to RFC 3550 section 6.1 this is a MUST.
@maximilianfridrich
Copy link
Contributor Author

maximilianfridrich commented Dec 2, 2024

PS: Some UAs enforce this strictly (e.g. Asterisk) by implementing the algorithm provided by RFC 3550 Appendix A:

      u_int32 len;        /* length of compound RTCP packet in words */
      rtcp_t *r;          /* RTCP header */
      rtcp_t *end;        /* end of compound RTCP packet */

      if ((*(u_int16 *)r & RTCP_VALID_MASK) != RTCP_VALID_VALUE) {
          /* something wrong with packet format */
      }
      end = (rtcp_t *)((u_int32 *)r + len);

      do r = (rtcp_t *)((u_int32 *)r + r->common.length + 1);
      while (r < end && r->common.version == 2);

      if (r != end) {
          /* something wrong with packet format */
      }

@sreimers sreimers merged commit 8628ea8 into baresip:main Dec 3, 2024
38 checks passed
@maximilianfridrich maximilianfridrich deleted the rtcp_fix branch December 3, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants