| 1 | // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | /* |
| 5 | Package rtcp implements encoding and decoding of RTCP packets according to RFCs 3550 and 5506. |
| 6 | |
| 7 | RTCP is a sister protocol of the Real-time Transport Protocol (RTP). Its basic functionality |
| 8 | and packet structure is defined in RFC 3550. RTCP provides out-of-band statistics and control |
| 9 | information for an RTP session. It partners with RTP in the delivery and packaging of multimedia data, |
| 10 | but does not transport any media data itself. |
| 11 | |
| 12 | The primary function of RTCP is to provide feedback on the quality of service (QoS) |
| 13 | in media distribution by periodically sending statistics information such as transmitted octet |
| 14 | and packet counts, packet loss, packet delay variation, and round-trip delay time to participants |
| 15 | in a streaming multimedia session. An application may use this information to control quality of |
| 16 | service parameters, perhaps by limiting flow, or using a different codec. |
| 17 | |
| 18 | Decoding RTCP packets: |
| 19 | |
| 20 | pkts, err := rtcp.Unmarshal(rtcpData) |
| 21 | // ... |
| 22 | for _, pkt := range pkts { |
| 23 | switch p := pkt.(type) { |
| 24 | case *rtcp.CompoundPacket: |
| 25 | ... |
| 26 | case *rtcp.PictureLossIndication: |
| 27 | ... |
| 28 | default: |
| 29 | ... |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | Encoding RTCP packets: |
| 34 | |
| 35 | pkt := &rtcp.PictureLossIndication{ |
| 36 | SenderSSRC: senderSSRC, |
| 37 | MediaSSRC: mediaSSRC |
| 38 | } |
| 39 | pliData, err := pkt.Marshal() |
| 40 | // ... |
| 41 | */ |
| 42 | package rtcp |