Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTP timestamp doesn't wrap around on ARM CPU #274

Closed
Dylan-Ying opened this issue May 8, 2023 · 2 comments · Fixed by #277
Closed

RTP timestamp doesn't wrap around on ARM CPU #274

Dylan-Ying opened this issue May 8, 2023 · 2 comments · Fixed by #277
Labels
bug Something isn't working

Comments

@Dylan-Ying
Copy link

func TestEncoder(t *testing.T) {
	e := NewEncoder(90000, 12345)

	ts := e.Encode(0)
	require.Equal(t, uint32(12345), ts)

	e = NewEncoder(90000, 0xffffffff)
	ts = e.Encode(1000000000)
	require.Equal(t, uint32(89999), ts)
}

Test succeeds on x86 CPU, but fails on ARM CPU

--- FAIL: TestEncoder (0.00s)
encoder_test.go:18:
Error Trace: encoder_test.go:18
Error: Not equal:
expected: 0x15f8f
actual : 0xffffffff
Test: TestEncoder
FAIL

The reason seems to be that float64 to uint32 doesn't wrap around on ARM CPU
float64 to uint64 and then to uint32 can pass the test: uint32(uint64(float64(a)))

@aler9
Copy link
Member

aler9 commented May 8, 2023

Thanks for reporting the issue, it has been fixed.

Copy link

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants