rtptimedec: increase threshold of negative differences

This commit is contained in:
aler9
2022-10-26 16:53:27 +02:00
parent 7d8e3cf5bc
commit 87e9036976
2 changed files with 20 additions and 20 deletions

View File

@@ -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)