Skip to content

Commit b26a618

Browse files
committedMar 1, 2024·
Include XR.SenderSSRC in its DestinationSSRC
Include XR.SenderSSRC in its DestinationSSRC
1 parent f260c33 commit b26a618

4 files changed

+16
-2
lines changed
 

‎extended_report.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ func (x *ExtendedReport) Unmarshal(b []byte) error {
646646

647647
// DestinationSSRC returns an array of SSRC values that this packet refers to.
648648
func (x *ExtendedReport) DestinationSSRC() []uint32 {
649-
ssrc := make([]uint32, 0)
649+
ssrc := make([]uint32, 0, len(x.Reports)+1)
650+
ssrc = append(ssrc, x.SenderSSRC)
650651
for _, p := range x.Reports {
651652
ssrc = append(ssrc, p.DestinationSSRC()...)
652653
}

‎extended_report_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,14 @@ func TestDecode(t *testing.T) {
272272
if p.String() != pktStringer.String() {
273273
t.Errorf("(string compare) Decoded packet does not match expected packet")
274274
}
275+
276+
var includeSenderSSRC bool
277+
for _, ssrc := range p.DestinationSSRC() {
278+
if ssrc == p.SenderSSRC {
279+
includeSenderSSRC = true
280+
}
281+
}
282+
if !includeSenderSSRC {
283+
t.Errorf("DestinationSSRC does not include the SenderSSRC")
284+
}
275285
}

‎fuzz_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func FuzzUnmarshal(f *testing.F) {
1111
f.Add([]byte{})
1212

13-
f.Fuzz(func(t *testing.T, data []byte) {
13+
f.Fuzz(func(_ *testing.T, data []byte) {
1414
packets, err := Unmarshal(data)
1515
if err != nil {
1616
return

‎packet_stringifier_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func TestPrint(t *testing.T) {
117117
},
118118
},
119119
},
120+
// nolint
120121
"rtcp.ExtendedReport:\n" +
121122
"\tSenderSSRC: 0x1020304\n" +
122123
"\tReports:\n" +
@@ -246,6 +247,7 @@ func TestPrint(t *testing.T) {
246247
},
247248
},
248249
},
250+
// nolint
249251
"rtcp.FullIntraRequest:\n" +
250252
"\tSenderSSRC: 0\n" +
251253
"\tMediaSSRC: 1271200948\n" +
@@ -312,6 +314,7 @@ func TestPrint(t *testing.T) {
312314
SenderSSRC: 0x902f9e2e,
313315
MediaSSRC: 0x902f9e2e,
314316
},
317+
// nolint
315318
"rtcp.PictureLossIndication:\n" +
316319
"\tSenderSSRC: 2419039790\n" +
317320
"\tMediaSSRC: 2419039790\n",

0 commit comments

Comments
 (0)
Please sign in to comment.