Merge pull request #748 from jitsi/gsm_bars_interrupted

Fixes the gsm bars during ice disconnected
This commit is contained in:
Paweł Domas 2016-07-22 14:02:19 -05:00 committed by GitHub
commit 974ba47e3c
2 changed files with 33 additions and 5 deletions

View File

@ -25,6 +25,11 @@ const TrackErrors = JitsiMeetJS.errors.track;
let room, connection, localAudio, localVideo, roomLocker;
/**
* Indicates whether the connection is interrupted or not.
*/
let connectionIsInterrupted = false;
import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
/**
@ -1076,6 +1081,15 @@ export default {
});
}
room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
connectionIsInterrupted = true;
ConnectionQuality.updateLocalConnectionQuality(0);
});
room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
connectionIsInterrupted = false;
});
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
APP.API.notifyDisplayNameChanged(id, displayName);
APP.UI.changeDisplayName(id, displayName);
@ -1131,7 +1145,7 @@ export default {
}
room.on(ConferenceEvents.CONNECTION_STATS, function (stats) {
ConnectionQuality.updateLocalStats(stats);
ConnectionQuality.updateLocalStats(stats, connectionIsInterrupted);
});
ConnectionQuality.addListener(CQEvents.LOCALSTATS_UPDATED,

View File

@ -41,12 +41,26 @@ export default {
/**
* Updates the local statistics
* @param data new statistics
* @param dontUpdateLocalConnectionQuality {boolean} if true -
* localConnectionQuality wont be recalculated.
*/
updateLocalStats: function (data) {
updateLocalStats: function (data, dontUpdateLocalConnectionQuality) {
stats = data;
if(!dontUpdateLocalConnectionQuality) {
var newVal = 100 - stats.packetLoss.total;
localConnectionQuality =
calculateQuality(newVal, localConnectionQuality);
}
eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, localConnectionQuality,
stats);
},
/**
* Updates only the localConnectionQuality value
* @param values {int} the new value. should be from 0 - 100.
*/
updateLocalConnectionQuality: function (value) {
localConnectionQuality = value;
eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, localConnectionQuality,
stats);
},