-
Notifications
You must be signed in to change notification settings - Fork 217
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: preserve track enabled state during cloning #2061
base: master
Are you sure you want to change the base?
Conversation
Ensures track.enabled state is correctly maintained when cloning MediaStreamTracks. Addresses a Safari 18 bug where cloned tracks are incorrectly enabled during cloning. See https://commits.webkit.org/285916@main for more details.
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.
Implementation looks good. Please complete the PR checklist next.
Prevents "Cannot read properties of undefined" error when cloning data tracks by only setting the enabled state for audio/video tracks.
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.
Can you add changelog and unit test?
Sure thing! I just added both. |
it(`should maintain track enabled state (${enabledState}) during publication`, () => { | ||
const mediaStreamTrack = new FakeMediaStreamTrack('audio'); | ||
mediaStreamTrack.enabled = enabledState; | ||
|
||
const trackSender = new MediaTrackSender(mediaStreamTrack); | ||
assert.strictEqual(trackSender.track.enabled, enabledState); | ||
|
||
const publication = new LocalTrackPublicationSignaling(trackSender, 'track1', 'standard'); | ||
|
||
assert.strictEqual(publication.trackTransceiver.track.enabled, enabledState); | ||
assert.strictEqual(publication.isEnabled, enabledState); | ||
}); | ||
}); |
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.
In order to properly test the Safari bug, we should also mock the behavior of the 'clone' function to always set the enabled state to 'true'. That way, we are sure that we're testing it properly.
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 agree. I just added a test mocking the clone
method to mimic the Safari 18 bug.
Pull Request Details
Description
Ensures track.enabled state is correctly maintained when cloning MediaStreamTracks. Addresses a Safari 18 bug where cloned tracks are incorrectly enabled during cloning. See https://commits.webkit.org/285916@main for more details.
Bug report
Burndown
Before review
npm test