mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
rtp*: correctly decode timestamp in case of an overflow (~13h)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user