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

Rounding direction for AudioData.duration #726

Open
padenot opened this issue Oct 3, 2023 · 1 comment
Open

Rounding direction for AudioData.duration #726

padenot opened this issue Oct 3, 2023 · 1 comment

Comments

@padenot
Copy link
Collaborator

padenot commented Oct 3, 2023

See https://w3c.github.io/webcodecs/#ref-for-dom-audiodata-duration%E2%91%A1

Does this round or floor or ceil? If I follow Chromium's code correctly, it simply casts the double to an integer, resulting in a generally floored value. I think this is fine (it's bound to be losing precision anyway), but maybe we should spec it.

@sandersdan
Copy link
Contributor

This is a fair point; we went with an integer time representation because that was the most straightforward to guarantee round-tripping timestamps to whatever storage format an implementation is using. It's an oddball format, so we had better be making the most of it.

I agree that it probably doesn't matter which way we go, both flooring and rounding should be straightforward for implementations to compute exactly.

I have a slight preference for round since it is a bit more accurate, but truncation may be what people expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants