mirror of
https://github.com/aler9/gortsplib
synced 2025-10-08 08:30:06 +08:00
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:
14
pkg/rtptime/encoder_test.go
Normal file
14
pkg/rtptime/encoder_test.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user