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

fix: use a separate ProgramDateTime mapping to player time per timeline #1063

Merged

Conversation

gesinger
Copy link
Contributor

@gesinger gesinger commented Feb 8, 2021

Description

Previously, the ProgramDateTime would map to time 0 at the start of playback, and that mapping would be used for the rest of playback.

However, in the case of a discontinuity, ProgramDateTime can jump (as in, can be a larger difference in time than a single segment duration, e.g., if the encoder went down for a period of time). Because the ProgramDateTime to player time mapping never changed, this led to seeking errors.

This fix uses a mapping of ProgramDateTime to player time per timeline, allowing those "jumps" in time on discontinuities.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

…nd of a timeline

Previously, when the end of a timeline was reached (i.e., the last
segment in a given timeline was appended), `endTimeline` would be
called, but the loader would not wait for the event to finish. This
lead to issues where segment information came back after a segment is
considered done with processing, and segment information could be
dropped. This fix waits for the `endedtimeline` message from the
transmuxer before it considers the transmux complete.
Previously, the ProgramDateTime would map to time 0 at the start of
playback, and that mapping would be used for the rest of playback. In
case of a discontinuity though, ProgramDateTime can jump (as in, can be
a larger difference in time than a single segment). This led to errors
while seeking. This change uses a mapping per timeline, allowing those
"jumps" in time on discontinuities.
@@ -161,7 +167,7 @@ export default class SyncController extends videojs.EventTarget {
// ...for synching across variants
this.timelines = [];
this.discontinuities = [];
this.datetimeToDisplayTime = null;
this.timelineToDatetimeMappings = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if segment.timeline is a number, should this just be an array?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the timelines contiguous or would there be a danger of a sparse array? Just thinking that maybe it'll be easier to have it be an array since you could just .length it, but if a segment.timeline could have values like, 0, 1, 100, then it won't work since the length would then be 101.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly: originally had it as an array, but it can be sparse so changed it.

Copy link
Contributor Author

@gesinger gesinger Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mainly an issue when either updating a playlist before starting, updating while paused, or if on some refreshes you miss a timeline (a short one).

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well with the test content we have.

@gesinger gesinger merged commit 5e9b4f1 into videojs:main Feb 10, 2021
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

Successfully merging this pull request may close these issues.

3 participants