Bläddra i källkod

Merge pull request #2024 from virtuacoplenny/lenny/no-resolution

ref(stats): do not modify stats object from lib
master
bbaldino 7 år sedan
förälder
incheckning
1ef3e4b7dc
1 ändrade filer med 7 tillägg och 8 borttagningar
  1. 7
    8
      react/features/connection-indicator/statsEmitter.js

+ 7
- 8
react/features/connection-indicator/statsEmitter.js Visa fil

@@ -108,20 +108,19 @@ const statsEmitter = {
108 108
      * @returns {void}
109 109
      */
110 110
     _onStatsUpdated(currentUserId, stats) {
111
-        const allUserFramerates = stats.framerate;
112
-        const allUserResolutions = stats.resolution;
113
-
114
-        const currentUserFramerate = allUserFramerates[currentUserId];
115
-        const currentUserResolution = allUserResolutions[currentUserId];
111
+        const allUserFramerates = stats.framerate || {};
112
+        const allUserResolutions = stats.resolution || {};
116 113
 
117 114
         // FIXME resolution and framerate are hashes keyed off of user ids with
118 115
         // stat values. Receivers of stats expect resolution and framerate to
119 116
         // be primatives, not hashes, so overwrites the 'lib-jitsi-meet' stats
120 117
         // objects.
121
-        stats.framerate = currentUserFramerate;
122
-        stats.resolution = currentUserResolution;
118
+        const modifiedLocalStats = Object.assign({}, stats, {
119
+            framerate: allUserFramerates[currentUserId],
120
+            resolution: allUserResolutions[currentUserId]
121
+        });
123 122
 
124
-        this._emitStatsUpdate(currentUserId, stats);
123
+        this._emitStatsUpdate(currentUserId, modifiedLocalStats);
125 124
 
126 125
         // Get all the unique user ids from the framerate and resolution stats
127 126
         // and update remote user stats as needed.

Laddar…
Avbryt
Spara