Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fixes an error caused by trying to get a property of undefined related to audio levels.
Lyubomir Marinove9a3b453165f
diff --git a/audio_levels.js b/audio_levels.jsindex 3f97343785..a25da0116a 100644--- a/audio_levels.js+++ b/audio_levels.js@@ -117,15 +117,27 @@ var AudioLevels = (function(my) {var audioLevelCanvasOrig = $('#' + videoSpanId + '>canvas').get(0);- audioLevelCanvasCache[resourceJid]- = CanvasUtil.cloneCanvas(audioLevelCanvasOrig);+ /*+ * FIXME Testing has shown that audioLevelCanvasOrig may not exist.+ * In such a case, the method CanvasUtil.cloneCanvas may throw an+ * error. Since audio levels are frequently updated, the errors have+ * been observed to pile into the console, strain the CPU.+ */+ if (audioLevelCanvasOrig)+ {+ audioLevelCanvasCache[resourceJid]+ = CanvasUtil.cloneCanvas(audioLevelCanvasOrig);+ }}var canvas = audioLevelCanvasCache[resourceJid];+ if (!canvas)+ return;+var drawContext = canvas.getContext('2d');- drawContext.clearRect (0, 0, canvas.width, canvas.height);+ drawContext.clearRect(0, 0, canvas.width, canvas.height);var shadowLevel = getShadowLevel(audioLevel);@@ -190,4 +202,4 @@ var AudioLevels = (function(my) {return my;-})(AudioLevels || {});\ No newline at end of file+})(AudioLevels || {});diff --git a/canvas_util.js b/canvas_util.jsindex bc96f030ab..b8a1b0e9e0 100644--- a/canvas_util.js+++ b/canvas_util.js@@ -81,6 +81,14 @@ var CanvasUtil = (function(my) {* @return the new cloned canvas.*/my.cloneCanvas = function (oldCanvas) {+ /*+ * FIXME Testing has shown that oldCanvas may not exist. In such a case,+ * the method CanvasUtil.cloneCanvas may throw an error. Since audio+ * levels are frequently updated, the errors have been observed to pile+ * into the console, strain the CPU.+ */+ if (!oldCanvas)+ return oldCanvas;//create a new canvasvar newCanvas = document.createElement('canvas');@@ -98,4 +106,4 @@ var CanvasUtil = (function(my) {};return my;-})(CanvasUtil || {});\ No newline at end of file+})(CanvasUtil || {});