From a3dcc3f9179cc4420b0c16c3e669a26bc2858353 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Fri, 1 Mar 2024 15:29:28 +0800 Subject: [PATCH] Include XR.SenderSSRC in its DestinationSSRC Include XR.SenderSSRC in its DestinationSSRC --- extended_report.go | 3 ++- extended_report_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/extended_report.go b/extended_report.go index db7ca41..0f9ee2c 100644 --- a/extended_report.go +++ b/extended_report.go @@ -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()...) } diff --git a/extended_report_test.go b/extended_report_test.go index df77184..1004a21 100644 --- a/extended_report_test.go +++ b/extended_report_test.go @@ -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") + } }