-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Bugfix: preferManagedMediaSource:false when MSE is not present #6338
Bugfix: preferManagedMediaSource:false when MSE is not present #6338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for identifying this issue and providing a fix. Please see the requested changes.
src/utils/mediasource-helper.ts
Outdated
@@ -15,3 +15,7 @@ export function getMediaSource( | |||
((self as any).WebKitMediaSource as typeof MediaSource) | |||
); | |||
} | |||
|
|||
export function isManagedMediaSource(source: typeof MediaSource | undefined) { | |||
return source === (self as any).ManagedMediaSource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self
may be undefined in some environments.
return source === (self as any).ManagedMediaSource; | |
return typeof self !== 'undefined' && | |
source === (self as any).ManagedMediaSource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change we should update the constructor to use this function
constructor(hls: Hls, fragmentTracker: FragmentTracker) {
super('buffer-controller', hls.logger);
this.hls = hls;
this.fragmentTracker = fragmentTracker;
this.appendSource = isManagedMediaSource(
getMediaSource(hls.config.preferManagedMediaSource)
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, thank you
src/controller/buffer-controller.ts
Outdated
@@ -207,6 +210,8 @@ export default class BufferController extends Logger implements ComponentAPI { | |||
) { | |||
const media = (this.media = data.media); | |||
const MediaSource = getMediaSource(this.appendSource); | |||
this.appendSource ||= isManagedMediaSource(MediaSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the OR here. If it's not ManagedMediaSource for any reason, appendSource
should be set to false
.
this.appendSource ||= isManagedMediaSource(MediaSource); | |
this.appendSource = isManagedMediaSource(MediaSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When taking a step back and taking into consideration this comment.
This line is no longer needed thus I decided to remove it all together
(cherry picked from commit 0d00e7e)
* patch/v1.5.x: Bugfix: Patch for light player exception with audio groups (#6342) Do not use "levelCodec" to instantiate SourceBuffer when multiple audio codec strings are present in the Multivariant Playlist variant CODECS attribute with muxed content (#6341) Bugfix: preferManagedMediaSource:false when MSE is not present (#6338) Determine canSkip based on age of last playlist request (#6300) API.md update removeLevel
This PR will...
Flip the BufferController.appendSource flag, in cases where preferManagedMediaSource config is set to false but MSE is not present.
Why is this Pull Request needed?
The API Docs state:
This is indeed the case but the appendSource flag is never updated to handle the scenario as it's only set within the constructor:
, thus blocks like:
and
never get invoked.
What this PR aims to do is check if the elected MediaSource is MMS and ensure appendSource adequately represent the state of the world.
Are there any points in the code the reviewer needs to double check?
Not to my knowledge
Checklist