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(latency-controller): only sync live stream #5604

Merged
merged 1 commit into from Dec 13, 2023

Conversation

FredZeng
Copy link
Contributor

This PR will...

maxLiveSyncPlaybackRate should only work for live stream.

I'm using same config ({ maxLiveSyncPlaybackRate: 1.2 }) to play normal playback and live stream.
When playing playback, we hope users can change playback rate as needed. However, things work not quiet well.

When user changes playback rate to 2, the player will reset to 1 quickly.

image

To figure out what happen, I have debugged the latency-controller.ts file.
It seems that we want to listen 'timeupdate' event when receive MEDIA_ATTACHED(https://github.com/video-dev/hls.js/blob/master/src/controller/latency-controller.ts#L153), and remove 'timeupdate' event when receive LEVEL_UPDATED(https://github.com/video-dev/hls.js/blob/master/src/controller/latency-controller.ts#L177).

Since the MEDIA_ATTACHED is triggered by _onMediaSourceOpen fired by sourceopen event, the order between MEDIA_ATTACHED and LEVEL_UPDATED cannot be guaranteed.

When LEVEL_UPDATED triggered before MEDIA_ATTACHED, the latency tracer (mouted by 'timeupdate') will never get a chance to stop, making user unable to change playback rate.

Why is this Pull Request needed?

To make sure maxLiveSyncPlaybackRate config only work for live stream.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@robwalch robwalch added this to the 1.5.0 milestone Dec 13, 2023
@robwalch robwalch merged commit d3845c2 into video-dev:master Dec 13, 2023
12 checks passed
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.

None yet

2 participants