mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 15:46:51 +08:00
rtptimedec: increase threshold of negative differences
This commit is contained in:
@@ -30,13 +30,13 @@ func TestNegativeDiff(t *testing.T) {
|
||||
func TestOverflow(t *testing.T) {
|
||||
d := New(90000)
|
||||
|
||||
i := uint32(4294877296)
|
||||
i := uint32(0xFFFFFFFF - 90000 + 1)
|
||||
secs := time.Duration(0)
|
||||
pts := d.Decode(i)
|
||||
require.Equal(t, time.Duration(0), pts)
|
||||
|
||||
const stride = 150
|
||||
lim := uint32(uint64(4294967296 - (stride * 90000)))
|
||||
const stride = 1500
|
||||
lim := uint32(uint64(0xFFFFFFFF + 1 - (stride * 90000)))
|
||||
|
||||
for n := 0; n < 100; n++ {
|
||||
// overflow
|
||||
@@ -59,19 +59,19 @@ func TestOverflow(t *testing.T) {
|
||||
func TestOverflowAndBack(t *testing.T) {
|
||||
d := New(90000)
|
||||
|
||||
pts := d.Decode(4294877296)
|
||||
pts := d.Decode(0xFFFFFFFF - 90000 + 1)
|
||||
require.Equal(t, time.Duration(0), pts)
|
||||
|
||||
pts = d.Decode(90000)
|
||||
require.Equal(t, 2*time.Second, pts)
|
||||
|
||||
pts = d.Decode(4294877296)
|
||||
pts = d.Decode(0xFFFFFFFF - 90000 + 1)
|
||||
require.Equal(t, time.Duration(0), pts)
|
||||
|
||||
pts = d.Decode(4294877296 - 90000)
|
||||
pts = d.Decode(0xFFFFFFFF - 90000 + 1 - 90000)
|
||||
require.Equal(t, -1*time.Second, pts)
|
||||
|
||||
pts = d.Decode(4294877296)
|
||||
pts = d.Decode(0xFFFFFFFF - 90000 + 1)
|
||||
require.Equal(t, time.Duration(0), pts)
|
||||
|
||||
pts = d.Decode(90000)
|
||||
|
Reference in New Issue
Block a user