Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include XR.SenderSSRC in its DestinationSSRC #169

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That function name/meaning is specifically for destination. Guess, for XR case, it is okay to include sender also, but wondering if there is a cleaner option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a naming issue, the DestinationSSRC used by pion to dispatch rtcp packets, the packet will be dropped if it doesn't include the SenderSSRC and report block doesn't contain a ssrc field.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thank you @cnderrauber

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")
}
}
2 changes: 1 addition & 1 deletion fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func FuzzUnmarshal(f *testing.F) {
f.Add([]byte{})

f.Fuzz(func(t *testing.T, data []byte) {
f.Fuzz(func(_ *testing.T, data []byte) {
packets, err := Unmarshal(data)
if err != nil {
return
Expand Down
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
Loading