Skip to content
Closed
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
2 changes: 1 addition & 1 deletion extended_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (b *UnknownReportBlock) unpackBlockHeader() {

// MarshalSize returns the size of the packet once marshaled.
func (x ExtendedReport) MarshalSize() int {
return wireSize(x)
return headerLength + wireSize(x)
}

// Marshal encodes the ExtendedReport in binary.
Expand Down
19 changes: 19 additions & 0 deletions extended_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,22 @@ func TestDecode(t *testing.T) {
}
assert.True(t, includeSenderSSRC, "DestinationSSRC does not include the SenderSSRC")
}

func TestExtendedReportMarshalSize(t *testing.T) {
packet := testPacket()
rawPacket, err := packet.Marshal()
assert.NoError(t, err)
assert.Equal(t, len(rawPacket), packet.MarshalSize())

compound := CompoundPacket{
&SenderReport{SSRC: 1},
&SourceDescription{Chunks: []SourceDescriptionChunk{{
Source: 1,
Items: []SourceDescriptionItem{{Type: SDESCNAME, Text: "cname"}},
}}},
packet,
}
rawCompound, err := compound.Marshal()
assert.NoError(t, err)
assert.Equal(t, len(rawCompound), compound.MarshalSize())
}