| 1 | // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | package rtcpscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ |
| 5 | |
| 6 | import ( |
| 7 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 8 | ) |
| 9 | |
| 10 | // The ExtendedReport packet is an Implementation of RTCP Extended |
| 11 | // Reports defined in RFC 3611. It is used to convey detailed |
| 12 | // information about an RTP stream. Each packet contains one or |
| 13 | // more report blocks, each of which conveys a different kind of |
| 14 | // information. |
| 15 | // |
| 16 | // 0 1 2 3 |
| 17 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 18 | // |
| 19 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 20 | // |V=2|P|reserved | PT=XR=207 | length | |
| 21 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 22 | // | SSRC | |
| 23 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 24 | // : report blocks : |
| 25 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 26 | // . |
| 27 | type ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport# struct { |
| 28 | SenderSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#SenderSSRC. uint32 `fmt:"0x%X"` |
| 29 | Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports. []ReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock# |
| 30 | } |
| 31 | |
| 32 | // ReportBlock represents a single report within an ExtendedReport |
| 33 | // packet. |
| 34 | type ReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock# interface { |
| 35 | DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#DestinationSSRC.() []uint32 |
| 36 | setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#setupBlockHeader.() |
| 37 | unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#unpackBlockHeader.() |
| 38 | } |
| 39 | |
| 40 | // TypeSpecificField as described in RFC 3611 section 4.5. In typical |
| 41 | // cases, users of ExtendedReports shouldn't need to access this, |
| 42 | // and should instead use the corresponding fields in the actual |
| 43 | // report blocks themselves. |
| 44 | type TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField# uint8 |
| 45 | |
| 46 | // XRHeader defines the common fields that must appear at the start |
| 47 | // of each report block. In typical cases, users of ExtendedReports |
| 48 | // shouldn't need to access this. For locally-constructed report |
| 49 | // blocks, these values will not be accurate until the corresponding |
| 50 | // packet is marshaled. |
| 51 | type XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader# struct { |
| 52 | BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. BlockTypeTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BlockTypeType# |
| 53 | TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField# `fmt:"0x%X"` |
| 54 | BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. uint16 |
| 55 | } |
| 56 | |
| 57 | // BlockTypeType specifies the type of report in a report block. |
| 58 | type BlockTypeTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BlockTypeType# uint8 |
| 59 | |
| 60 | // Extended Report block types from RFC 3611. |
| 61 | const ( |
| 62 | LossRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlockType. = 1 // RFC 3611, section 4.1 |
| 63 | DuplicateRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlockType. = 2 // RFC 3611, section 4.2 |
| 64 | PacketReceiptTimesReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlockType. = 3 // RFC 3611, section 4.3 |
| 65 | ReceiverReferenceTimeReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlockType. = 4 // RFC 3611, section 4.4 |
| 66 | DLRRReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlockType. = 5 // RFC 3611, section 4.5 |
| 67 | StatisticsSummaryReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlockType. = 6 // RFC 3611, section 4.6 |
| 68 | VoIPMetricsReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlockType. = 7 // RFC 3611, section 4.7 |
| 69 | ) |
| 70 | |
| 71 | // String converts the Extended report block types into readable strings. |
| 72 | func (t BlockTypeTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BlockTypeType#) Stringscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BlockTypeType#String().() string { |
| 73 | switch t { |
| 74 | case LossRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlockType.: |
| 75 | return "LossRLEReportBlockType" |
| 76 | case DuplicateRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlockType.: |
| 77 | return "DuplicateRLEReportBlockType" |
| 78 | case PacketReceiptTimesReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlockType.: |
| 79 | return "PacketReceiptTimesReportBlockType" |
| 80 | case ReceiverReferenceTimeReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlockType.: |
| 81 | return "ReceiverReferenceTimeReportBlockType" |
| 82 | case DLRRReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlockType.: |
| 83 | return "DLRRReportBlockType" |
| 84 | case StatisticsSummaryReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlockType.: |
| 85 | return "StatisticsSummaryReportBlockType" |
| 86 | case VoIPMetricsReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlockType.: |
| 87 | return "VoIPMetricsReportBlockType" |
| 88 | } |
| 89 | |
| 90 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("invalid value %d", t) |
| 91 | } |
| 92 | |
| 93 | // rleReportBlock defines the common structure used by both |
| 94 | // Loss RLE report blocks (RFC 3611 §4.1) and Duplicate RLE |
| 95 | // report blocks (RFC 3611 §4.2). |
| 96 | // |
| 97 | // 0 1 2 3 |
| 98 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 99 | // |
| 100 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 101 | // | BT = 1 or 2 | rsvd. | T | block length | |
| 102 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 103 | // | SSRC of source | |
| 104 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 105 | // | begin_seq | end_seq | |
| 106 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 107 | // | chunk 1 | chunk 2 | |
| 108 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 109 | // : ... : |
| 110 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 111 | // | chunk n-1 | chunk n | |
| 112 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 113 | // . |
| 114 | type rleReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock# struct { |
| 115 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader. |
| 116 | Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#T. uint8 `encoding:"omit"` |
| 117 | SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#SSRC. uint32 `fmt:"0x%X"` |
| 118 | BeginSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#BeginSeq. uint16 |
| 119 | EndSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#EndSeq. uint16 |
| 120 | Chunksscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#Chunks. []Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk# |
| 121 | } |
| 122 | |
| 123 | // Chunk as defined in RFC 3611, section 4.1. These represent information |
| 124 | // about packet losses and packet duplication. They have three representations: |
| 125 | // |
| 126 | // Run Length Chunk: |
| 127 | // |
| 128 | // 0 1 |
| 129 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
| 130 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 131 | // |C|R| run length | |
| 132 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 133 | // |
| 134 | // Bit Vector Chunk: |
| 135 | // |
| 136 | // 0 1 |
| 137 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
| 138 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 139 | // |C| bit vector | |
| 140 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 141 | // |
| 142 | // Terminating Null Chunk: |
| 143 | // |
| 144 | // 0 1 |
| 145 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
| 146 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 147 | // |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0| |
| 148 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 149 | type Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk# uint16 |
| 150 | |
| 151 | // LossRLEReportBlock is used to report information about packet |
| 152 | // losses, as described in RFC 3611, section 4.1. |
| 153 | type LossRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock# rleReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock# |
| 154 | |
| 155 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 156 | func (b *LossRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#DestinationSSRC().() []uint32 { |
| 157 | return []uint32{b.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#SSRC.} |
| 158 | } |
| 159 | |
| 160 | func (b *LossRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#setupBlockHeader().() { |
| 161 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = LossRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlockType. |
| 162 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField#(b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#T. & 0x0F) |
| 163 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 164 | } |
| 165 | |
| 166 | func (b *LossRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#unpackBlockHeader().() { |
| 167 | b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#T. = uint8(b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.) & 0x0F |
| 168 | } |
| 169 | |
| 170 | // DuplicateRLEReportBlock is used to report information about packet |
| 171 | // duplication, as described in RFC 3611, section 4.1. |
| 172 | type DuplicateRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock# rleReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock# |
| 173 | |
| 174 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 175 | func (b *DuplicateRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#DestinationSSRC().() []uint32 { |
| 176 | return []uint32{b.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#SSRC.} |
| 177 | } |
| 178 | |
| 179 | func (b *DuplicateRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#setupBlockHeader().() { |
| 180 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = DuplicateRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlockType. |
| 181 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField#(b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#T. & 0x0F) |
| 182 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 183 | } |
| 184 | |
| 185 | func (b *DuplicateRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#unpackBlockHeader().() { |
| 186 | b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#T. = uint8(b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/rleReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.) & 0x0F |
| 187 | } |
| 188 | |
| 189 | // ChunkType enumerates the three kinds of chunks described in RFC 3611 section 4.1. |
| 190 | type ChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ChunkType# uint8 |
| 191 | |
| 192 | // These are the valid values that ChunkType can assume. |
| 193 | const ( |
| 194 | RunLengthChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/RunLengthChunkType. = 0 |
| 195 | BitVectorChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BitVectorChunkType. = 1 |
| 196 | TerminatingNullChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TerminatingNullChunkType. = 2 |
| 197 | ) |
| 198 | |
| 199 | func (c Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#) Stringscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#String().() string { |
| 200 | switch c.Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Type().() { |
| 201 | case RunLengthChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/RunLengthChunkType.: |
| 202 | runType, _ := c.RunTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#RunType().() |
| 203 | |
| 204 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("[RunLength type=%d, length=%d]", runType, c.Valuescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Value().()) |
| 205 | case BitVectorChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BitVectorChunkType.: |
| 206 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("[BitVector 0b%015b]", c.Valuescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Value().()) |
| 207 | case TerminatingNullChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TerminatingNullChunkType.: |
| 208 | return "[TerminatingNull]" |
| 209 | } |
| 210 | |
| 211 | return fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("[0x%X]", uint16(c)) |
| 212 | } |
| 213 | |
| 214 | // Type returns the ChunkType that this Chunk represents. |
| 215 | func (c Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#) Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Type().() ChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ChunkType# { |
| 216 | if c == 0 { |
| 217 | return TerminatingNullChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TerminatingNullChunkType. |
| 218 | } |
| 219 | |
| 220 | return ChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ChunkType#(c >> 15) //nolint:gosec // G115 |
| 221 | } |
| 222 | |
| 223 | // RunType returns the RunType that this Chunk represents. It is |
| 224 | // only valid if ChunkType is RunLengthChunkType. |
| 225 | func (c Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#) RunTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#RunType().() (uint, error) { |
| 226 | if c.Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Type().() != RunLengthChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/RunLengthChunkType. { |
| 227 | return 0, errWrongChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/errWrongChunkType. |
| 228 | } |
| 229 | |
| 230 | return uint((c >> 14) & 0x01), nil |
| 231 | } |
| 232 | |
| 233 | // Value returns the value represented in this Chunk. |
| 234 | func (c Chunkscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#) Valuescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Value().() uint { |
| 235 | switch c.Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Chunk#Type().() { |
| 236 | case RunLengthChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/RunLengthChunkType.: |
| 237 | return uint(c & 0x3FFF) |
| 238 | case BitVectorChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/BitVectorChunkType.: |
| 239 | return uint(c & 0x7FFF) |
| 240 | case TerminatingNullChunkTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TerminatingNullChunkType.: |
| 241 | return 0 |
| 242 | } |
| 243 | |
| 244 | return uint(c) |
| 245 | } |
| 246 | |
| 247 | // PacketReceiptTimesReportBlock represents a Packet Receipt Times |
| 248 | // report block, as described in RFC 3611 section 4.3. |
| 249 | // |
| 250 | // 0 1 2 3 |
| 251 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 252 | // |
| 253 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 254 | // | BT=3 | rsvd. | T | block length | |
| 255 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 256 | // | SSRC of source | |
| 257 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 258 | // | begin_seq | end_seq | |
| 259 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 260 | // | Receipt time of packet begin_seq | |
| 261 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 262 | // | Receipt time of packet (begin_seq + 1) mod 65536 | |
| 263 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 264 | // : ... : |
| 265 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 266 | // | Receipt time of packet (end_seq - 1) mod 65536 | |
| 267 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 268 | // . |
| 269 | type PacketReceiptTimesReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock# struct { |
| 270 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#XRHeader. |
| 271 | Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#T. uint8 `encoding:"omit"` |
| 272 | SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#SSRC. uint32 `fmt:"0x%X"` |
| 273 | BeginSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#BeginSeq. uint16 |
| 274 | EndSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#EndSeq. uint16 |
| 275 | ReceiptTimescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#ReceiptTime. []uint32 |
| 276 | } |
| 277 | |
| 278 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 279 | func (b *PacketReceiptTimesReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#DestinationSSRC().() []uint32 { |
| 280 | return []uint32{b.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#SSRC.} |
| 281 | } |
| 282 | |
| 283 | func (b *PacketReceiptTimesReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#setupBlockHeader().() { |
| 284 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = PacketReceiptTimesReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlockType. |
| 285 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField#(b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#T. & 0x0F) |
| 286 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 287 | } |
| 288 | |
| 289 | func (b *PacketReceiptTimesReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#unpackBlockHeader().() { |
| 290 | b.Tscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#T. = uint8(b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.) & 0x0F |
| 291 | } |
| 292 | |
| 293 | // ReceiverReferenceTimeReportBlock encodes a Receiver Reference Time |
| 294 | // report block as described in RFC 3611 section 4.4. |
| 295 | // |
| 296 | // 0 1 2 3 |
| 297 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 298 | // |
| 299 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 300 | // | BT=4 | reserved | block length = 2 | |
| 301 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 302 | // | NTP timestamp, most significant word | |
| 303 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 304 | // | NTP timestamp, least significant word | |
| 305 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 306 | // . |
| 307 | type ReceiverReferenceTimeReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock# struct { |
| 308 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#XRHeader. |
| 309 | NTPTimestampscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#NTPTimestamp. uint64 |
| 310 | } |
| 311 | |
| 312 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 313 | func (b *ReceiverReferenceTimeReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#DestinationSSRC().() []uint32 { |
| 314 | return []uint32{} |
| 315 | } |
| 316 | |
| 317 | func (b *ReceiverReferenceTimeReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#setupBlockHeader().() { |
| 318 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = ReceiverReferenceTimeReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlockType. |
| 319 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = 0 |
| 320 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 321 | } |
| 322 | |
| 323 | func (b *ReceiverReferenceTimeReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#unpackBlockHeader().() { |
| 324 | } |
| 325 | |
| 326 | // DLRRReportBlock encodes a DLRR Report Block as described in |
| 327 | // RFC 3611 section 4.5. |
| 328 | // |
| 329 | // 0 1 2 3 |
| 330 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 331 | // |
| 332 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 333 | // | BT=5 | reserved | block length | |
| 334 | // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
| 335 | // | SSRC_1 (SSRC of first receiver) | sub- |
| 336 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block |
| 337 | // | last RR (LRR) | 1 |
| 338 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 339 | // | delay since last RR (DLRR) | |
| 340 | // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
| 341 | // | SSRC_2 (SSRC of second receiver) | sub- |
| 342 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block |
| 343 | // : ... : 2 |
| 344 | // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
| 345 | // . |
| 346 | type DLRRReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock# struct { |
| 347 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#XRHeader. |
| 348 | Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#Reports. []DLRRReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport# |
| 349 | } |
| 350 | |
| 351 | // DLRRReport encodes a single report inside a DLRRReportBlock. |
| 352 | type DLRRReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport# struct { |
| 353 | SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport#SSRC. uint32 `fmt:"0x%X"` |
| 354 | LastRRscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport#LastRR. uint32 |
| 355 | DLRRscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport#DLRR. uint32 |
| 356 | } |
| 357 | |
| 358 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 359 | func (b *DLRRReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#DestinationSSRC().() []uint32 { |
| 360 | ssrc := make([]uint32, len(b.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#Reports.)) |
| 361 | for i, r := range b.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#Reports. { |
| 362 | ssrc[i] = r.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReport#SSRC. |
| 363 | } |
| 364 | |
| 365 | return ssrc |
| 366 | } |
| 367 | |
| 368 | func (b *DLRRReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#setupBlockHeader().() { |
| 369 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = DLRRReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlockType. |
| 370 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = 0 |
| 371 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 372 | } |
| 373 | |
| 374 | func (b *DLRRReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#unpackBlockHeader().() { |
| 375 | } |
| 376 | |
| 377 | // StatisticsSummaryReportBlock encodes a Statistics Summary Report |
| 378 | // Block as described in RFC 3611, section 4.6. |
| 379 | // |
| 380 | // 0 1 2 3 |
| 381 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 382 | // |
| 383 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 384 | // | BT=6 |L|D|J|ToH|rsvd.| block length = 9 | |
| 385 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 386 | // | SSRC of source | |
| 387 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 388 | // | begin_seq | end_seq | |
| 389 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 390 | // | lost_packets | |
| 391 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 392 | // | dup_packets | |
| 393 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 394 | // | min_jitter | |
| 395 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 396 | // | max_jitter | |
| 397 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 398 | // | mean_jitter | |
| 399 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 400 | // | dev_jitter | |
| 401 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 402 | // | min_ttl_or_hl | max_ttl_or_hl |mean_ttl_or_hl | dev_ttl_or_hl | |
| 403 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 404 | // . |
| 405 | type StatisticsSummaryReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock# struct { |
| 406 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader. |
| 407 | LossReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#LossReports. bool `encoding:"omit"` |
| 408 | DuplicateReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DuplicateReports. bool `encoding:"omit"` |
| 409 | JitterReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#JitterReports. bool `encoding:"omit"` |
| 410 | TTLorHopLimitscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#TTLorHopLimit. TTLorHopLimitTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TTLorHopLimitType# `encoding:"omit"` |
| 411 | SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#SSRC. uint32 `fmt:"0x%X"` |
| 412 | BeginSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#BeginSeq. uint16 |
| 413 | EndSeqscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#EndSeq. uint16 |
| 414 | LostPacketsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#LostPackets. uint32 |
| 415 | DupPacketsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DupPackets. uint32 |
| 416 | MinJitterscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MinJitter. uint32 |
| 417 | MaxJitterscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MaxJitter. uint32 |
| 418 | MeanJitterscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MeanJitter. uint32 |
| 419 | DevJitterscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DevJitter. uint32 |
| 420 | MinTTLOrHLscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MinTTLOrHL. uint8 |
| 421 | MaxTTLOrHLscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MaxTTLOrHL. uint8 |
| 422 | MeanTTLOrHLscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#MeanTTLOrHL. uint8 |
| 423 | DevTTLOrHLscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DevTTLOrHL. uint8 |
| 424 | } |
| 425 | |
| 426 | // TTLorHopLimitType encodes values for the ToH field in |
| 427 | // a StatisticsSummaryReportBlock. |
| 428 | type TTLorHopLimitTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TTLorHopLimitType# uint8 |
| 429 | |
| 430 | // Values for TTLorHopLimitType. |
| 431 | const ( |
| 432 | ToHMissingscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHMissing. = 0 |
| 433 | ToHIPv4scip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHIPv4. = 1 |
| 434 | ToHIPv6scip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHIPv6. = 2 |
| 435 | ) |
| 436 | |
| 437 | func (t TTLorHopLimitTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TTLorHopLimitType#) Stringscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TTLorHopLimitType#String().() string { |
| 438 | switch t { |
| 439 | case ToHMissingscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHMissing.: |
| 440 | return "[ToH Missing]" |
| 441 | case ToHIPv4scip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHIPv4.: |
| 442 | return "[ToH = IPv4]" |
| 443 | case ToHIPv6scip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ToHIPv6.: |
| 444 | return "[ToH = IPv6]" |
| 445 | } |
| 446 | |
| 447 | return "[ToH Flag is Invalid]" |
| 448 | } |
| 449 | |
| 450 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 451 | func (b *StatisticsSummaryReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DestinationSSRC().() []uint32 { |
| 452 | return []uint32{b.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#SSRC.} |
| 453 | } |
| 454 | |
| 455 | func (b *StatisticsSummaryReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#setupBlockHeader().() { |
| 456 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = StatisticsSummaryReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlockType. |
| 457 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = 0x00 |
| 458 | if b.LossReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#LossReports. { |
| 459 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. |= 0x80 |
| 460 | } |
| 461 | if b.DuplicateReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DuplicateReports. { |
| 462 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. |= 0x40 |
| 463 | } |
| 464 | if b.JitterReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#JitterReports. { |
| 465 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. |= 0x20 |
| 466 | } |
| 467 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. |= TypeSpecificFieldscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeSpecificField#((b.TTLorHopLimitscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#TTLorHopLimit. & 0x03) << 3) |
| 468 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 469 | } |
| 470 | |
| 471 | func (b *StatisticsSummaryReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#unpackBlockHeader().() { |
| 472 | b.LossReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#LossReports. = b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.&0x80 != 0 |
| 473 | b.DuplicateReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#DuplicateReports. = b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.&0x40 != 0 |
| 474 | b.JitterReportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#JitterReports. = b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific.&0x20 != 0 |
| 475 | b.TTLorHopLimitscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#TTLorHopLimit. = TTLorHopLimitTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TTLorHopLimitType#((b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. & 0x18) >> 3) |
| 476 | } |
| 477 | |
| 478 | // VoIPMetricsReportBlock encodes a VoIP Metrics Report Block as described |
| 479 | // in RFC 3611, section 4.7. |
| 480 | // |
| 481 | // 0 1 2 3 |
| 482 | // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 483 | // |
| 484 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 485 | // | BT=7 | reserved | block length = 8 | |
| 486 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 487 | // | SSRC of source | |
| 488 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 489 | // | loss rate | discard rate | burst density | gap density | |
| 490 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 491 | // | burst duration | gap duration | |
| 492 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 493 | // | round trip delay | end system delay | |
| 494 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 495 | // | signal level | noise level | RERL | Gmin | |
| 496 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 497 | // | R factor | ext. R factor | MOS-LQ | MOS-CQ | |
| 498 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 499 | // | RX config | reserved | JB nominal | |
| 500 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 501 | // | JB maximum | JB abs max | |
| 502 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 503 | // . |
| 504 | type VoIPMetricsReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock# struct { |
| 505 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#XRHeader. |
| 506 | SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#SSRC. uint32 `fmt:"0x%X"` |
| 507 | LossRatescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#LossRate. uint8 |
| 508 | DiscardRatescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#DiscardRate. uint8 |
| 509 | BurstDensityscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#BurstDensity. uint8 |
| 510 | GapDensityscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#GapDensity. uint8 |
| 511 | BurstDurationscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#BurstDuration. uint16 |
| 512 | GapDurationscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#GapDuration. uint16 |
| 513 | RoundTripDelayscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#RoundTripDelay. uint16 |
| 514 | EndSystemDelayscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#EndSystemDelay. uint16 |
| 515 | SignalLevelscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#SignalLevel. uint8 |
| 516 | NoiseLevelscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#NoiseLevel. uint8 |
| 517 | RERLscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#RERL. uint8 |
| 518 | Gminscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#Gmin. uint8 |
| 519 | RFactorscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#RFactor. uint8 |
| 520 | ExtRFactorscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#ExtRFactor. uint8 |
| 521 | MOSLQscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#MOSLQ. uint8 |
| 522 | MOSCQscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#MOSCQ. uint8 |
| 523 | RXConfigscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#RXConfig. uint8 |
| 524 | _ uint8 |
| 525 | JBNominalscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#JBNominal. uint16 |
| 526 | JBMaximumscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#JBMaximum. uint16 |
| 527 | JBAbsMaxscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#JBAbsMax. uint16 |
| 528 | } |
| 529 | |
| 530 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 531 | func (b *VoIPMetricsReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#DestinationSSRC().() []uint32 { |
| 532 | return []uint32{b.SSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#SSRC.} |
| 533 | } |
| 534 | |
| 535 | func (b *VoIPMetricsReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#setupBlockHeader().() { |
| 536 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#XRHeader..BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. = VoIPMetricsReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlockType. |
| 537 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#XRHeader..TypeSpecificscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#TypeSpecific. = 0 |
| 538 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 539 | } |
| 540 | |
| 541 | func (b *VoIPMetricsReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#unpackBlockHeader().() { |
| 542 | } |
| 543 | |
| 544 | // UnknownReportBlock is used to store bytes for any report block |
| 545 | // that has an unknown Report Block Type. |
| 546 | type UnknownReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock# struct { |
| 547 | XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#XRHeader. |
| 548 | Bytesscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#Bytes. []byte |
| 549 | } |
| 550 | |
| 551 | // DestinationSSRC returns an array of SSRC values that this report block refers to. |
| 552 | func (b *UnknownReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#DestinationSSRC().() []uint32 { |
| 553 | return []uint32{} |
| 554 | } |
| 555 | |
| 556 | func (b *UnknownReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#) setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#setupBlockHeader().() { |
| 557 | b.XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#XRHeader..BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength. = uint16(wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(b)/4 - 1) //nolint:gosec // G115 |
| 558 | } |
| 559 | |
| 560 | func (b *UnknownReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#) unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#unpackBlockHeader().() { |
| 561 | } |
| 562 | |
| 563 | // MarshalSize returns the size of the packet once marshaled. |
| 564 | func (x ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#) MarshalSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#MarshalSize().() int { |
| 565 | return wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(x) |
| 566 | } |
| 567 | |
| 568 | // Marshal encodes the ExtendedReport in binary. |
| 569 | func (x ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#) Marshalscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Marshal().() ([]byte, error) { |
| 570 | for _, p := range x.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports. { |
| 571 | p.setupBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#setupBlockHeader.() |
| 572 | } |
| 573 | |
| 574 | length := wireSizescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/wireSize().(x) |
| 575 | |
| 576 | // RTCP Header |
| 577 | header := Headerscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#{ |
| 578 | Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#Type.: TypeExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeExtendedReport., |
| 579 | Lengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#Length.: uint16(length / 4), //nolint:gosec // G115 |
| 580 | } |
| 581 | headerBuffer, err := header.Marshalscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#Marshal().() |
| 582 | if err != nil { |
| 583 | return []byte{}, err |
| 584 | } |
| 585 | length += len(headerBuffer) |
| 586 | |
| 587 | rawPacket := make([]byte, length) |
| 588 | buffer := packetBufferscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#{bytesscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#bytes.: rawPacket} |
| 589 | |
| 590 | err = buffer.writescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#write().(headerBuffer) |
| 591 | if err != nil { |
| 592 | return []byte{}, err |
| 593 | } |
| 594 | err = buffer.writescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#write().(x) |
| 595 | if err != nil { |
| 596 | return []byte{}, err |
| 597 | } |
| 598 | |
| 599 | return rawPacket, nil |
| 600 | } |
| 601 | |
| 602 | // Unmarshal decodes the ExtendedReport from binary. |
| 603 | // |
| 604 | //nolint:cyclop |
| 605 | func (x *ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#) Unmarshalscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Unmarshal().(b []byte) error { |
| 606 | var header Headerscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header# |
| 607 | if err := header.Unmarshalscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#Unmarshal().(b); err != nil { |
| 608 | return err |
| 609 | } |
| 610 | if header.Typescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/Header#Type. != TypeExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/TypeExtendedReport. { |
| 611 | return errWrongTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/errWrongType. |
| 612 | } |
| 613 | |
| 614 | buffer := packetBufferscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#{bytesscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#bytes.: b[headerLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/headerLength.:]} |
| 615 | err := buffer.readscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#read().(&x.SenderSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#SenderSSRC.) |
| 616 | if err != nil { |
| 617 | return err |
| 618 | } |
| 619 | |
| 620 | for len(buffer.bytesscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#bytes.) > 0 { |
| 621 | var block ReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock# |
| 622 | |
| 623 | headerBuffer := buffer |
| 624 | xrHeader := XRHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#{} |
| 625 | err = headerBuffer.readscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#read().(&xrHeader) |
| 626 | if err != nil { |
| 627 | return err |
| 628 | } |
| 629 | |
| 630 | switch xrHeader.BlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockType. { |
| 631 | case LossRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlockType.: |
| 632 | block = new(LossRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/LossRLEReportBlock#) |
| 633 | case DuplicateRLEReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlockType.: |
| 634 | block = new(DuplicateRLEReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DuplicateRLEReportBlock#) |
| 635 | case PacketReceiptTimesReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlockType.: |
| 636 | block = new(PacketReceiptTimesReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/PacketReceiptTimesReportBlock#) |
| 637 | case ReceiverReferenceTimeReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlockType.: |
| 638 | block = new(ReceiverReferenceTimeReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReceiverReferenceTimeReportBlock#) |
| 639 | case DLRRReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlockType.: |
| 640 | block = new(DLRRReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/DLRRReportBlock#) |
| 641 | case StatisticsSummaryReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlockType.: |
| 642 | block = new(StatisticsSummaryReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/StatisticsSummaryReportBlock#) |
| 643 | case VoIPMetricsReportBlockTypescip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlockType.: |
| 644 | block = new(VoIPMetricsReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/VoIPMetricsReportBlock#) |
| 645 | default: |
| 646 | block = new(UnknownReportBlockscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/UnknownReportBlock#) |
| 647 | } |
| 648 | |
| 649 | // We need to limit the amount of data available to |
| 650 | // this block to the actual length of the block |
| 651 | blockLength := (int(xrHeader.BlockLengthscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/XRHeader#BlockLength.) + 1) * 4 |
| 652 | blockBuffer := buffer.splitscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#split().(blockLength) |
| 653 | err = blockBuffer.readscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/packetBuffer#read().(block) |
| 654 | if err != nil { |
| 655 | return err |
| 656 | } |
| 657 | block.unpackBlockHeaderscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#unpackBlockHeader.() |
| 658 | x.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports. = append(x.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports., block) |
| 659 | } |
| 660 | |
| 661 | return nil |
| 662 | } |
| 663 | |
| 664 | // DestinationSSRC returns an array of SSRC values that this packet refers to. |
| 665 | func (x *ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#) DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#DestinationSSRC().() []uint32 { |
| 666 | ssrc := make([]uint32, 0, len(x.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports.)+1) |
| 667 | ssrc = append(ssrc, x.SenderSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#SenderSSRC.) |
| 668 | for _, p := range x.Reportsscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#Reports. { |
| 669 | ssrc = append(ssrc, p.DestinationSSRCscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ReportBlock#DestinationSSRC.()...) |
| 670 | } |
| 671 | |
| 672 | return ssrc |
| 673 | } |
| 674 | |
| 675 | func (x *ExtendedReportscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#) Stringscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/ExtendedReport#String().() string { |
| 676 | return stringifyscip-go gomod github.com/pion/rtcp . `github.com/pion/rtcp`/stringify().(x) |
| 677 | } |