rtp*: correctly decode timestamp in case of an overflow (~13h)

This commit is contained in:
aler9
2021-12-09 20:27:11 +01:00
parent d7e1c7c8d3
commit 725e1b13a3
4 changed files with 92 additions and 17 deletions

View File

@@ -259,6 +259,35 @@ func TestDecode(t *testing.T) {
}
}
func TestDecodeTimestampOverflow(t *testing.T) {
d := NewDecoder()
var pts time.Duration
for _, ts := range []uint32{
4294877296,
90001,
3240090001,
565122706,
} {
pkt := rtp.Packet{
Header: rtp.Header{
Version: 2,
Marker: true,
PayloadType: 96,
SequenceNumber: 0x01,
Timestamp: ts,
SSRC: 0xba9da416,
},
Payload: []byte("\x00\x00"),
}
var err error
_, pts, err = d.Decode(&pkt)
require.NoError(t, err)
}
require.Equal(t, 15*60*60*time.Second+2*time.Second, pts)
}
func TestDecodePartOfFragmentedBeforeSingle(t *testing.T) {
d := NewDecoder()