Debian Codegraph @

raw_packet.go

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
2 // SPDX-License-Identifier: MIT
3
4 package rtcp
5
6 import "fmt"
7
8 // RawPacket represents an unparsed RTCP packet. It's returned by Unmarshal when
9 // a packet with an unknown type is encountered.
10 type RawPacket []byte
11
12 // Marshal encodes the packet in binary.
13 func (r RawPacket) Marshal() ([]byte, error) {
14 return r, nil
15 }
16
17 // Unmarshal decodes the packet from binary.
18 func (r *RawPacket) Unmarshal(b []byte) error {
19 if len(b) < (headerLength) {
20 return errPacketTooShort
21 }
22 *r = b
23
24 var h Header
25
26 return h.Unmarshal(b)
27 }
28
29 // Header returns the Header associated with this packet.
30 func (r RawPacket) Header() Header {
31 var h Header
32 if err := h.Unmarshal(r); err != nil {
33 return Header{}
34 }
35
36 return h
37 }
38
39 // DestinationSSRC returns an array of SSRC values that this packet refers to.
40 func (r *RawPacket) DestinationSSRC() []uint32 {
41 return []uint32{}
42 }
43
44 func (r RawPacket) String() string {
45 out := fmt.Sprintf("RawPacket: %v", ([]byte)(r))
46
47 return out
48 }
49
50 // MarshalSize returns the size of the packet once marshaled.
51 func (r RawPacket) MarshalSize() int {
52 return len(r)
53 }