mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00

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))
15 lines
203 B
Go
15 lines
203 B
Go
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)
|
|
}
|