Skip to content
Snippets Groups Projects
Commit 8dda22f8 authored by prlanzarin's avatar prlanzarin
Browse files

[html5/webrtc] Fix tryGenerateIceCandidates rejections, put it behind a flag

Fixed two occurrences where the tryGenerateIceCandidates workaround rejected without an error, which borked the callers error handling

Also put it behind a config flag. This workaround used to be important when Kurento didnt infer prflx candidates properly, but that`s no longer the case. With the flag, we can disable the workaround to see if there`s any visible regression and hopefully remove it down the road
parent fb96ffdc
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import Auth from '/imports/ui/services/auth';
import { Session } from 'meteor/session';
import logger from '/imports/startup/client/logger';
const ICE_GATHERING_CHECK_ENABLED = Meteor.settings.public.media.recvonlyIceGatheringCheck;
const getSessionToken = () => Auth.sessionToken;
export async function getIceServersList() {
......@@ -43,13 +44,13 @@ export function canGenerateIceCandidates() {
pc.onicegatheringstatechange = function (e) {
if (e.currentTarget.iceGatheringState === 'complete' && countIceCandidates === 0) {
logger.warn({ logCode: 'no_valid_candidate' }, 'No useful ICE candidate found. Will request gUM permission.');
reject();
reject(new Error('No valid candidate'));
}
};
setTimeout(() => {
pc.close();
if (!countIceCandidates) reject();
if (!countIceCandidates) reject(new Error('Gathering check timeout'));
}, 5000);
const p = pc.createOffer({ offerToReceiveVideo: true });
......@@ -66,11 +67,20 @@ export function canGenerateIceCandidates() {
* generate at least srflx candidates.
* This is a workaround due to a behaviour some browsers display (mainly Safari)
* where they won't generate srflx or relay candidates if no gUM permission is
* given. Since our media servers aren't able to make it work by prflx
* candidates, we need to do this.
* given.
*
*
* UPDATE:
* This used to be valid when Kurento wasn't treating prflx candidates properly.
* It is now, so this workaround is being revisited. I've put it under a flag
* so that we can field trial it disabled and gauge the impact of removing it.
* Hopelly we can get rid of it.
*
* prlanzarin 11-11-20
*/
export function tryGenerateIceCandidates() {
return new Promise((resolve, reject) => {
if (!ICE_GATHERING_CHECK_ENABLED) return resolve();
canGenerateIceCandidates().then(() => {
resolve();
}).catch(() => {
......
......@@ -277,6 +277,7 @@ public:
stunTurnServersFetchAddress: "/bigbluebutton/api/stuns"
cacheStunTurnServers: true
fallbackStunServer: ''
recvonlyIceGatheringCheck: true
mediaTag: "#remote-media"
callTransferTimeout: 5000
callHangupTimeout: 2000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment