Skip to content

Commit

Permalink
Merge pull request jitsi#2024 from virtuacoplenny/lenny/no-resolution
Browse files Browse the repository at this point in the history
ref(stats): do not modify stats object from lib
  • Loading branch information
bbaldino authored Oct 3, 2017
2 parents 86fcfcc + eb1a44f commit 1ef3e4b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions react/features/connection-indicator/statsEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,19 @@ const statsEmitter = {
* @returns {void}
*/
_onStatsUpdated(currentUserId, stats) {
const allUserFramerates = stats.framerate;
const allUserResolutions = stats.resolution;

const currentUserFramerate = allUserFramerates[currentUserId];
const currentUserResolution = allUserResolutions[currentUserId];
const allUserFramerates = stats.framerate || {};
const allUserResolutions = stats.resolution || {};

// FIXME resolution and framerate are hashes keyed off of user ids with
// stat values. Receivers of stats expect resolution and framerate to
// be primatives, not hashes, so overwrites the 'lib-jitsi-meet' stats
// objects.
stats.framerate = currentUserFramerate;
stats.resolution = currentUserResolution;
const modifiedLocalStats = Object.assign({}, stats, {
framerate: allUserFramerates[currentUserId],
resolution: allUserResolutions[currentUserId]
});

this._emitStatsUpdate(currentUserId, stats);
this._emitStatsUpdate(currentUserId, modifiedLocalStats);

// Get all the unique user ids from the framerate and resolution stats
// and update remote user stats as needed.
Expand Down

0 comments on commit 1ef3e4b

Please sign in to comment.