Skip to content

Commit

Permalink
Include XR.SenderSSRC in its DestinationSSRC
Browse files Browse the repository at this point in the history
Include XR.SenderSSRC in its DestinationSSRC
  • Loading branch information
cnderrauber committed Mar 1, 2024
1 parent f260c33 commit 7042528
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extended_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ func (x *ExtendedReport) Unmarshal(b []byte) error {

// DestinationSSRC returns an array of SSRC values that this packet refers to.
func (x *ExtendedReport) DestinationSSRC() []uint32 {
ssrc := make([]uint32, 0)
ssrc := make([]uint32, 0, len(x.Reports)+1)
ssrc = append(ssrc, x.SenderSSRC)
for _, p := range x.Reports {
ssrc = append(ssrc, p.DestinationSSRC()...)
}
Expand Down
10 changes: 10 additions & 0 deletions extended_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,14 @@ func TestDecode(t *testing.T) {
if p.String() != pktStringer.String() {
t.Errorf("(string compare) Decoded packet does not match expected packet")
}

var includeSenderSSRC bool
for _, ssrc := range p.DestinationSSRC() {
if ssrc == p.SenderSSRC {
includeSenderSSRC = true
}
}
if !includeSenderSSRC {
t.Errorf("DestinationSSRC does not include the SenderSSRC")
}
}
3 changes: 3 additions & 0 deletions packet_stringifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func TestPrint(t *testing.T) {
},
},
},
// nolint
"rtcp.ExtendedReport:\n" +
"\tSenderSSRC: 0x1020304\n" +
"\tReports:\n" +
Expand Down Expand Up @@ -246,6 +247,7 @@ func TestPrint(t *testing.T) {
},
},
},
// nolint
"rtcp.FullIntraRequest:\n" +
"\tSenderSSRC: 0\n" +
"\tMediaSSRC: 1271200948\n" +
Expand Down Expand Up @@ -312,6 +314,7 @@ func TestPrint(t *testing.T) {
SenderSSRC: 0x902f9e2e,
MediaSSRC: 0x902f9e2e,
},
// nolint
"rtcp.PictureLossIndication:\n" +
"\tSenderSSRC: 2419039790\n" +
"\tMediaSSRC: 2419039790\n",
Expand Down

0 comments on commit 7042528

Please sign in to comment.