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

Signed versus unsigned #284

Closed
aboba opened this issue Jun 17, 2021 · 5 comments · Fixed by #440
Closed

Signed versus unsigned #284

aboba opened this issue Jun 17, 2021 · 5 comments · Fixed by #440
Assignees
Labels
editorial changes to wording, grammar, etc that don't modify the intended behavior

Comments

@aboba
Copy link
Collaborator

aboba commented Jun 17, 2021

is timestamp really intended to be a signed long long? Typically, timestamps are unsigned.

Had the same question about decodeQueueSize and encodeQueueSize. Those can't be negative, right?

@aboba aboba changed the title Why is timestamp signed? Signed versus unsigned Jun 17, 2021
@wolenetz
Copy link
Member

In various container formats, negative frame timestamps can sometimes be useful to indicate stream cropping or decoder preroll. For example, in WebM: https://bugs.chromium.org/p/chromium/issues/detail?id=271794#c14.

@sandersdan
Copy link
Contributor

timestamp is signed because timestamps have an arbitrary origin and can therefore be negative. Typically they start at zero, but even then it's common for some intermediate timestamps to be negative (eg. negative DTS with zero PTS). It seemed that forcing non-negative here would make those situations unnecessarily complex for apps to handle.

duration is unsigned because a negative value there isn't well defined. There are reasonable interpretations available but nothing I am aware of that simplifies API usage.

Queue sizes can't be negative. They were originally modelled after the Streams API which can have negative queue space available, but differ enough now that there is no reason for them to be signed still.

@dalecurtis
Copy link
Contributor

signed timestamps were resolved here #122 (comment)

@aboba
Copy link
Collaborator Author

aboba commented Jun 21, 2021

@sandersdan Thanks! Would it make sense to provide a PR to make the queue sizes unsigned?

@chcunningham
Copy link
Collaborator

Editors call: WebAudio and WebRTC seem to use unsigned for these types of counts. SGTM

@chcunningham chcunningham self-assigned this Aug 18, 2021
@chcunningham chcunningham added the editorial changes to wording, grammar, etc that don't modify the intended behavior label Nov 17, 2021
chcunningham added a commit that referenced this issue Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial changes to wording, grammar, etc that don't modify the intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants