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

Double to long int microseconds fails in HLS #9575

Closed
stevemayhew opened this issue Oct 19, 2021 · 1 comment
Closed

Double to long int microseconds fails in HLS #9575

stevemayhew opened this issue Oct 19, 2021 · 1 comment
Assignees
Labels

Comments

@stevemayhew
Copy link
Contributor

The HLS Parser converts from a string decimal duration in seconds into long microseconds. Because the conversion passes through a java double type it can result in representation errors.

For example, durations like:

  #EXTINF:4.004,

or

  #EXTINF:2.002,

will come out to less then 2,002,000 microseconds if converted to double and multiplied by C.MICROS_PER_SECOND

Easy fix is to use the BigDecimal class in Java, which avoids all of this.

@stevemayhew stevemayhew changed the title Double to long int answer is wrong in HLS Double to long int microseconds fails in HLS Oct 19, 2021
@tonihei
Copy link
Collaborator

tonihei commented Oct 22, 2021

Thanks for reporting and providing a fix. We will merge the PR.

@tonihei tonihei self-assigned this Oct 22, 2021
@tonihei tonihei closed this as completed Nov 2, 2021
@google google locked and limited conversation to collaborators Jan 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants