Remove old tracks before adding/replacing new ones in janus.js #3203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we implemented #3003 in
janus.js
, we made it so when adding/replacing new tracks, we'd first capture the new track and only after that we'd remove the old one: actually, when doingreplace: true
, the previous track would not be removed at all. Apparently this caused problems on some devices, e.g., as reported in #3201.This patch tries to address that, by removing a track before it's updated. We had a FIXME in there since this may cause problems, as with this change there could be some time in between a track is removed and then replaced when nothing is added. As such, I'm providing this as a PR: please test and ensure it doesn't cause regressions or problems, as I plan to merge soon if it fixes the problem.