-
Notifications
You must be signed in to change notification settings - Fork 425
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: store queue and current transmux on transmuxer instead of global #1045
Conversation
0f18dec
to
a0d6775
Compare
@@ -590,23 +595,6 @@ export default class SegmentLoader extends videojs.EventTarget { | |||
} | |||
} | |||
|
|||
createTransmuxer_() { |
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.
This moved to segmentTransmuxer.createTransmuxer
for a few reasons:
- We use it in tests in exactly the same manner
- We need to add some special properties to the transmuxer when we create it in segmentTransmuxer to prevent state from being kept in the segmentTransmuxer itself
- We need to clear those same properties on terminate, which we do by wrapping terminate in segmentTransmuxer
- segmentTransmuxer already handles all the other transmuxer message logic, so having logic here for it is weird.
cf98826
to
6257202
Compare
@@ -632,9 +620,6 @@ export default class SegmentLoader extends videojs.EventTarget { | |||
this.abort_(); | |||
if (this.transmuxer_) { | |||
this.transmuxer_.terminate(); | |||
// Although it isn't an instance of a class, the segment transmuxer must still be | |||
// cleaned up. | |||
segmentTransmuxer.dispose(); |
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.
dispose is gone, segmentTransmuxer stores no state.
@@ -1,5 +1,4 @@ | |||
const transmuxQueue = []; |
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.
now stored on transmuxer, not global.
const transmuxedData = { | ||
isPartial, | ||
buffer: [] | ||
}; | ||
|
||
const handleMessage = (event) => { | ||
if (!currentTransmux) { | ||
if (transmuxer.currentTransmux !== options) { |
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 need access to options above so that we can verify that we haven't been disposed.
563711f
to
3b00e18
Compare
Problem
So this is somewhat of a bigger issue then I originally realized when I found an issue in tests for #1043 . The segmentTransmuxer stores a global cache of the currentTransmux and transmux queues. This causes a few issues:
Changes
Store the transmuxQueue and currentTransmux on the transmuxer that is being used rather than keeping a global list.