MCPcopy Create free account
hub / github.com/pion/rtp / TestRFC8285OneByteMultipleExtensions

Function TestRFC8285OneByteMultipleExtensions

packet_test.go:275–325  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

273}
274
275func TestRFC8285OneByteMultipleExtensions(t *testing.T) {
276 // 0 1 2 3
277 // 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
278 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
279 // | 0xBE | 0xDE | length=3 |
280 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
281 // | ID=1 | L=0 | data | ID=2 | L=1 | data...
282 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
283 // ...data | ID=3 | L=3 | data...
284 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
285 // ...data |
286 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
287 rawPkt := []byte{
288 0x90, 0xe0, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64,
289 0x27, 0x82, 0xBE, 0xDE, 0x00, 0x03, 0x10, 0xAA, 0x21, 0xBB,
290 0xBB, 0x33, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x00,
291 // Payload
292 0x98, 0x36, 0xbe, 0x88, 0x9e,
293 }
294
295 p := &Packet{
296 Header: Header{
297 Marker: true,
298 Extension: true,
299 ExtensionProfile: 0xBEDE,
300 Extensions: []Extension{
301 {1, []byte{
302 0xAA,
303 }},
304 {2, []byte{
305 0xBB, 0xBB,
306 }},
307 {3, []byte{
308 0xCC, 0xCC, 0xCC, 0xCC,
309 }},
310 },
311 Version: 2,
312 PayloadType: 96,
313 SequenceNumber: 27023,
314 Timestamp: 3653407706,
315 SSRC: 476325762,
316 CSRC: []uint32{},
317 },
318 Payload: rawPkt[28:],
319 }
320
321 dstData, _ := p.Marshal()
322 if !bytes.Equal(dstData, rawPkt) {
323 t.Errorf("Marshal failed raw \nMarshaled:\n%s\nrawPkt:\n%s", hex.Dump(dstData), hex.Dump(rawPkt))
324 }
325}
326
327func TestRFC8285TwoByteExtension(t *testing.T) {
328 p := &Packet{}

Callers

nothing calls this directly

Calls 1

MarshalMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…