fix: high CPU on Chrome with low fps screen sharing (#1570)
* fix: high CPU on Chrome with low fps screen sharing
It turns out that if 5 fps is set on the track constraints,
Chrome will capture the original video in 30 fps and only
further down the pipeline will downsample it to 5 fps.
This results in very high CPU usage. Specify max FPS in
getDisplayMedia to fix the problem.
Getting rid of track.applyConstraints should also fix another
issue on Firefox where it reports 0x0 screen size after this call.
* ref(RTCUtils): remove trackOptions
* remove extra &&
Both of the cases where user clicks cancel and when screen recording
permissions were not granted at the OS level are almost the same,
except for a small difference in the error.message.
This was only tested on Chrome 85.0.4183.121/Mac OS 10.15.6
Get rid of all wrappers and use navigator.mediaDevices.getUserMedia, since all
supported platforms have it by now.
Also use the unprefixed versions of WebRTC APIs.
* Enables adapter for edge.
We were not filtering correctly all unsupported iceServers and an error is thrown and no connection is established.
* Enable desktop sharing for Edge.
Currently when replacing video track with desktop sharing one, doesn't work because of: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17528460/
If Edge user joins first and enables desktop sharing it will work when others join. Tried also to use replaceTrack/setTrack as a workaround, but again we hit an error, this time InvalidAccessError.
* Adds the helper function usesAdapter in BrowserCaps.
fix(screensharing): set error type for cancelling extension install
When cancelling the prompt to install the extension, instead of
treating it as a generic error treat is as the cancel extension
error. This allows existing logic to trigger that will not show
an error message on cancel.
* fix(SS): Set min and max frame rate to 5
* fix(SS): Set min and max frame rate for the new GUM flow.
* feat(ss_framerate): Add config option for min/max frame rate.
* doc(RTCUtils): Fix params format.
* fix(SS_framerate): Don't pass undefined constraints.
* fix(SS_constraints): Handle chromeMediaSourceId === undefined.
To install the chrome webstore extension, the user must already have installed "Download Chrome Extension". On missing extension we open a popup window which allows the user to add the extension and then install it.
ESLint 4.8.0 discovers a lot of error related to formatting. While I
tried to fix as many of them as possible, a portion of them actually go
against our coding style. In such a case, I've disabled the indent rule
which effectively leaves it as it was before ESLint 4.8.0.
feat(ScreenObtainer): trigger external for not verified site
Will trigger external installation also for sites that are not the main
whitelisted domain. This allows to reuse one extension for many sites
(they still have to be on the whitelist, but only one can be "main").
CHROME_EXTENSION_USER_GESTURE_REQUIRED will be triggered if
the extension installation fails, because the request to get desktop
stream did not originate in user gesture handler (a button click for
example).