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.
Problem
On my slow machine, about half the time the "f" layer does not even start before the
monitor code swoops in and downgrades quality.
It is puzzling as to why it is not started. Activity Monitor shows 75% idle even when all
layers are encoding. And the server is running on the same machine. So, bandwidth
should not be an issue.
Anyhow, once downgraded, we wait the 60 seconds before enabling the "f" layer
which is quite a while for high quality video to be sent out.
Fix
Check if the best encoder has been active (by checking
framesSent !== 0
) beforedowngrading. With this change, the "f" layer starts about 15 - 20 seconds into the
session rather the 60+ seconds because of downgrading too early. 15 - 20 seconds is
not great either, but at least it is not as bad.
To think about
What if even "h" was too much and we need to downgrade to "q"? By waiting for "f"
to start, we will never get to that. Maybe, we need to check the currently active (or
at some point active) best encoding and see if that is suffering. Or maybe, letting the
browser handle it is okay as "h" suffering is probably a sign that the machine is going
to perform poorly even for the most basic cases.
Testing
Ensure that "f" layer is not clobbered before it has a chance to start.