From 067801acaed75a4f0e28df235b6fc3c702899fa9 Mon Sep 17 00:00:00 2001 From: Joao Siebel Date: Mon, 22 Apr 2019 09:11:16 -0300 Subject: [PATCH] update logic and rename function --- .../ui/components/video-provider/component.jsx | 6 +++--- .../ui/services/network-information/index.js | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx index a0edfa4fec..fb8bcd42c9 100755 --- a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx @@ -8,7 +8,7 @@ import logger from '/imports/startup/client/logger'; import { Session } from 'meteor/session'; import browser from 'browser-detect'; import { - currentWebcamConnections, + updateCurrentWebcamsConnection, getCurrentWebcams, deleteWebcamConnection, newWebcamConnection, @@ -478,7 +478,7 @@ class VideoProvider extends Component { } delete this.webRtcPeers[id]; deleteWebcamConnection(id); - currentWebcamConnections(this.webRtcPeers); + updateCurrentWebcamsConnection(this.webRtcPeers); } else { this.logger('warn', 'No WebRTC peer to stop (not an error)', { cameraId: id }); } @@ -561,7 +561,7 @@ class VideoProvider extends Component { this.webRtcPeers[id].peerConnection.oniceconnectionstatechange = this._getOnIceConnectionStateChangeCallback(id); } newWebcamConnection({ userId: id, peer: this.webRtcPeers[id] }); - currentWebcamConnections(this.webRtcPeers); + updateCurrentWebcamsConnection(this.webRtcPeers); } } diff --git a/bigbluebutton-html5/imports/ui/services/network-information/index.js b/bigbluebutton-html5/imports/ui/services/network-information/index.js index 78e0e37b3e..ee7efb2c1e 100644 --- a/bigbluebutton-html5/imports/ui/services/network-information/index.js +++ b/bigbluebutton-html5/imports/ui/services/network-information/index.js @@ -17,11 +17,11 @@ const WARNING_END_TIME = 60000; let monitoringIntervalRef; -export const currentWebcamConnections = (webrtcConnections) => { +export const updateCurrentWebcamsConnection = (connections) => { const doc = { timestamp: new Date().getTime(), event: NUMBER_OF_WEBCAMS_CHANGED, - payload: Object.keys(webrtcConnections), + payload: Object.keys(connections), }; NetworkInformationLocal.insert(doc); @@ -110,14 +110,15 @@ export const startBandwidthMonitoring = () => { time: { $lt: dangerLowerBoundary, $gte: warningLowerBoundary }, }).count(); - if (warningZoneReceivers && !dangerZone) { - if (!warningZoneReceivers) { - makeCall('setUserEffectiveConnectionType', 'warning'); - } - } else if (dangerZone) { + + if (dangerZone) { if (!dangerZoneReceivers) { makeCall('setUserEffectiveConnectionType', 'danger'); } + } else if (warningZone) { + if (!warningZoneReceivers) { + makeCall('setUserEffectiveConnectionType', 'warning'); + } } else { makeCall('setUserEffectiveConnectionType', ''); } @@ -192,7 +193,7 @@ export const updateWebcamStats = (id, stats) => { export default { NetworkInformationLocal, - currentWebcamConnections, + updateCurrentWebcamsConnection, deleteWebcamConnection, getCurrentWebcams, newWebcamConnection,