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

Fixes issues with EXTINF duration conversion to microseconds #9576

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

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:

#EXTINF:4.004 -> Segment.durationUs of 4003999

This matters because the first sample (which is the IDR) for a segment will be discarded following a seek because of the logic in the SampleQueue:

    buffer.timeUs = timesUs[relativeReadIndex];
    if (buffer.timeUs < startTimeUs) {
      buffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
    }

This fixes issue #9575 and includes a test case to show it.

I would suggest using this for the partial segments as well, as we are not using LL-HLS yet this does not affect us. If you agree I'm happy to add it to the pull request.

The EXT-X-START offset too, although this is probably not as critical.

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:

`#EXTINF:4.004`  -> `Segment.durationUs` of 4003999

This matters because the first sample (which is the IDR) for a segment will be discarded following a seek because of the logic in the `SampleQueue`:

````java
    buffer.timeUs = timesUs[relativeReadIndex];
    if (buffer.timeUs < startTimeUs) {
      buffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
    }
````
@google-cla google-cla bot added the cla: yes label Oct 19, 2021
@tonihei tonihei self-assigned this Oct 22, 2021
@tonihei tonihei merged commit f238439 into google:dev-v2 Nov 1, 2021
@stevemayhew stevemayhew deleted the p-fix-duration-round branch November 2, 2021 00:43
tonihei added a commit that referenced this pull request Nov 4, 2021
@google google locked and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants