sip/audio/rtcp library

Minimal RFC 3550 RTCP packet codec — pure Dart.

Implements just enough for an audio call:

  • SR (Sender Report, PT=200)
  • RR (Receiver Report, PT=201)
  • SDES(Source Description PT=202) — CNAME only
  • BYE (Goodbye, PT=203)

Packets are length-prefixed in 32-bit words (length = words - 1) per §6.4.1, and compound packets concatenate one report (SR/RR) followed by SDES, terminated with BYE on shutdown (§6.1).

Classes

GoodBye
BYE packet (PT=203).
ReceiverReport
Receiver Report (PT=201).
ReportBlock
One row of an SR/RR report block (§6.4.1).
RtcpBye
RtcpPacket
One element of a parsed compound RTCP datagram.
RtcpRr
RtcpSdes
RtcpSr
RtcpUnknown
SdesChunk
Single SDES chunk: an SSRC plus a list of items (we only emit CNAME).
SenderReport
Sender Report (PT=200).
SourceDescription
SDES packet (PT=202) carrying one chunk (CNAME).

Constants

rtcpPtBye → const int
rtcpPtRr → const int
rtcpPtSdes → const int
rtcpPtSr → const int
rtcpVersion → const int
sdesCname → const int

Functions

ntpMiddle32(int ntpSeconds, int ntpFraction) int
Middle 32 bits of an NTP timestamp (used in SR and the LSR field of RR).
parseRtcp(Uint8List data) List<RtcpPacket>
Parse a (possibly compound) RTCP datagram. Returns an empty list if the buffer is malformed.
unixMicrosToNtp(int microsSinceEpoch) → ({int fraction, int seconds})
Convert a Unix timestamp (microseconds) to NTP (seconds, fraction) for SR.