set default max payload size to 1450 (#811)

this is to support SRTP more easily.
This commit is contained in:
Alessandro Ros
2025-06-29 12:51:54 +02:00
committed by GitHub
parent 33a87b2270
commit bee7cc4d6b
29 changed files with 651 additions and 680 deletions

View File

@@ -417,6 +417,18 @@ var cases = []struct {
0x94, 0x52, 0xd1, 0x40, 0x09, 0x45, 0x2d, 0x14,
0x00, 0x94, 0x52, 0xd1, 0x40, 0x05, 0x14, 0xb4,
0x94, 0x0c, 0x28, 0xa2, 0x8a, 0x04, 0x14, 0x51,
},
},
{
Header: rtp.Header{
Version: 2,
Marker: true,
PayloadType: 26,
SequenceNumber: 17646,
SSRC: 0x9dbb7812,
},
Payload: []byte{
0x00, 0x00, 0x03, 0x5c, 0x01, 0xff, 0xf0, 0x87,
0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51,
0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x52,
0xd1, 0x40, 0xc4, 0xa2, 0x96, 0x8a, 0x04, 0x25,
@@ -474,37 +486,25 @@ var cases = []struct {
0x49, 0xf2, 0x7f, 0xe5, 0xb5, 0x62, 0x5a, 0x5f,
0xcb, 0x6b, 0xfe, 0xa3, 0xfe, 0x5a, 0xd1, 0xe5,
0x45, 0xff, 0x00, 0x2c, 0x29, 0x0f, 0xd9, 0x97,
0xff, 0x00, 0xb6, 0x65,
},
},
{
Header: rtp.Header{
Version: 2,
Marker: true,
PayloadType: 26,
SequenceNumber: 17646,
SSRC: 0x9dbb7812,
},
Payload: []byte{
0x00, 0x00, 0x05, 0x28, 0x01, 0xff, 0xf0, 0x87,
0xba, 0x82, 0x5f, 0xb7, 0x4d, 0xe6, 0xcd, 0xff,
0x00, 0x2c, 0xe2, 0xae, 0xa7, 0x49, 0xd5, 0x3f,
0xe2, 0x9a, 0xf3, 0xa7, 0xff, 0x00, 0x5d, 0x15,
0x70, 0xb4, 0x43, 0xfb, 0xdf, 0xf5, 0xf3, 0x4b,
0xff, 0x00, 0x5c, 0xe8, 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 0xcd, 0xbf, 0xf3,
0xb5, 0x49, 0xbc, 0xdf, 0x2b, 0xfe, 0x59, 0xd3,
0x27, 0xd9, 0x9a, 0x30, 0xdd, 0x7d, 0xab, 0x5e,
0xfb, 0x1d, 0x8c, 0xde, 0x55, 0x9c, 0xb2, 0x79,
0x95, 0xd3, 0x6a, 0x3a, 0xa7, 0xd9, 0x75, 0xdb,
0x5b, 0x39, 0xff, 0x00, 0xd4, 0xcb, 0xff, 0x00,
0x2d, 0x2b, 0xcf, 0xbe, 0xdf, 0xe5, 0x6a, 0xdf,
0x6c, 0x83, 0xfe, 0x59, 0x54, 0xda, 0xb6, 0xb3,
0x2e, 0xb3, 0x7f, 0xe7, 0x7f, 0xaa, 0xff, 0xff,
0xd9,
},
},
},
@@ -517,6 +517,7 @@ func TestEncode(t *testing.T) {
e := &Encoder{
SSRC: uint32Ptr(0x9dbb7812),
InitialSequenceNumber: uint16Ptr(0x44ed),
PayloadMaxSize: 1000,
}
err := e.Init()
require.NoError(t, err)
@@ -527,3 +528,11 @@ func TestEncode(t *testing.T) {
})
}
}
func TestEncodeRandomInitialState(t *testing.T) {
e := &Encoder{}
err := e.Init()
require.NoError(t, err)
require.NotEqual(t, nil, e.SSRC)
require.NotEqual(t, nil, e.InitialSequenceNumber)
}