Fix race condition leading to a JS error instead of a NO_PLAYABLE_REPRESENTATION #1201
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.
A
NO_PLAYABLE_REPRESENTATION
error is what happen if fallbacks are enabled for encrypted contents but all qualities have been fallbacked from.We had a race conditions if that situation arised before setting the corresponding track (I'm not too sure when this does happen but it did) where a random JS error (along the lines of "cannot read the property bitrate of undefined") i would be sent as an error nstead of the expected
NO_PLAYABLE_REPRESENTATION
error.This race condition was linked to our handling of RxJS, so I'm unsure if it's still reproducible on our current
dev
branch (as we've removed RxJS from the source code since then). Still, I added in this PR supplementary checks and resilience code that would handle this situation should it ever happen again.I chose to write the fix on top of the
next
branch, instead of the more usual fix on top of themaster
branch, because the corresponding code has completely been refactored since, and there's a higher chance of us releasing a3.30.0
than a3.29.1
release, that issue being relatively rare to reproduce.If we ever should release a
v3.29.1
instead, I will backport that fix.