fix timestamp encode error after some hours (#206)

previous formula was: uint32(a + uint32(b))
this formula overflows two times, while it should overflow once.
new formula is: uint32(uint64(a) + uint64(b))
This commit is contained in:
Alessandro Ros
2023-03-14 17:55:06 +01:00
committed by GitHub
parent bc248c8e1d
commit f0540b4eee
20 changed files with 119 additions and 83 deletions

View File

@@ -0,0 +1,14 @@
package rtptime
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestEncoder(t *testing.T) {
e := NewEncoder(90000, 12345)
ts := e.Encode(0)
require.Equal(t, uint32(12345), ts)
}