Fix initial camera quality #5551
Merged
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 a call started and the VideoConstrainer was created the video track was assumed to be already in high quality, so when the VideoConstrainer was asked to apply again the high quality constraints it just ignored the request. However, in some cases the browser does not initialize the camera in high quality, so the camera was kept in a lower quality for as long as the high quality was kept being requested.
Moreover, even if the browser initialized the camera with high quality that quality might not be exactly the same as the one set when applying the high quality constraints, so even in those cases the constraints should be applied anyway for consistency.
How to test
OCA.Talk.SimpleWebRTC.webrtc.peers[0].pc.getSenders()[1].track.getSettings()Result with this pull request
The resolution will be equal to or larger than 720x540 (probably it will be an HD resolution, 1280x720).
In some cases Chromium fails to apply the new constraints; I am still investigating this, but in any case it seemss unrelated to the changes here.
Besides that, note that due to how media constraints work even if the camera is a Full HD camera the resolution might not be the maximum resolution of the camera.
Result without this pull request
The resolution will be (probably) an VGA resolution (640x480 or 640x360).
Note that, depending on the browser, camera, operating system... even without this pull request the initial quality could be high 🤷