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
Fix stream end/start race condition
Mike Keesey0fdf5e010227
diff --git a/libs/app.bundle.js b/libs/app.bundle.jsindex 68bc3abe34..0042934997 100644--- a/libs/app.bundle.js+++ b/libs/app.bundle.js@@ -1,4 +1,4 @@-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.APP=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.APP = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){/* jshint -W117 *//* application specific logic */@@ -289,7 +289,7 @@ var API = {};module.exports = API;-},{"../../service/xmpp/XMPPEvents":100}],3:[function(require,module,exports){+},{"../../service/xmpp/XMPPEvents":101}],3:[function(require,module,exports){/* global APP *//**@@ -574,7 +574,7 @@ function onPinnedEndpointChanged(userResource)module.exports = DataChannels;-},{"../../service/RTC/RTCEvents":91}],5:[function(require,module,exports){+},{"../../service/RTC/RTCEvents":92}],5:[function(require,module,exports){var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");@@ -682,7 +682,7 @@ LocalStream.prototype.getId = function () {module.exports = LocalStream;-},{"../../service/RTC/StreamEventTypes.js":93}],6:[function(require,module,exports){+},{"../../service/RTC/StreamEventTypes.js":94}],6:[function(require,module,exports){////These lines should be uncommented when require works in app.jsvar MediaStreamType = require("../../service/RTC/MediaStreamTypes");var StreamEventType = require("../../service/RTC/StreamEventTypes");@@ -744,7 +744,7 @@ MediaStream.prototype.setVideoType = function (value) {module.exports = MediaStream;-},{"../../service/RTC/MediaStreamTypes":89,"../../service/RTC/StreamEventTypes":93}],7:[function(require,module,exports){+},{"../../service/RTC/MediaStreamTypes":90,"../../service/RTC/StreamEventTypes":94}],7:[function(require,module,exports){var EventEmitter = require("events");var RTCUtils = require("./RTCUtils.js");var LocalStream = require("./LocalStream.js");@@ -991,7 +991,7 @@ var RTC = {module.exports = RTC;-},{"../../service/RTC/MediaStreamTypes":89,"../../service/RTC/RTCEvents.js":91,"../../service/RTC/StreamEventTypes.js":93,"../../service/UI/UIEvents":94,"../../service/desktopsharing/DesktopSharingEventTypes":97,"../../service/xmpp/XMPPEvents":100,"./DataChannels":4,"./LocalStream.js":5,"./MediaStream.js":6,"./RTCUtils.js":8,"events":101}],8:[function(require,module,exports){+},{"../../service/RTC/MediaStreamTypes":90,"../../service/RTC/RTCEvents.js":92,"../../service/RTC/StreamEventTypes.js":94,"../../service/UI/UIEvents":95,"../../service/desktopsharing/DesktopSharingEventTypes":98,"../../service/xmpp/XMPPEvents":101,"./DataChannels":4,"./LocalStream.js":5,"./MediaStream.js":6,"./RTCUtils.js":8,"events":102}],8:[function(require,module,exports){var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");var Resolutions = require("../../service/RTC/Resolutions");@@ -1404,7 +1404,7 @@ RTCUtils.prototype.createVideoStream = function(stream)module.exports = RTCUtils;-},{"../../service/RTC/RTCBrowserType.js":90,"../../service/RTC/Resolutions":92}],9:[function(require,module,exports){+},{"../../service/RTC/RTCBrowserType.js":91,"../../service/RTC/Resolutions":93}],9:[function(require,module,exports){var UI = {};var VideoLayout = require("./videolayout/VideoLayout.js");@@ -2174,7 +2174,7 @@ UI.setVideoMuteButtonsState = function (mute) {module.exports = UI;-},{"../../service/RTC/RTCEvents":91,"../../service/RTC/StreamEventTypes":93,"../../service/connectionquality/CQEvents":96,"../../service/desktopsharing/DesktopSharingEventTypes":97,"../../service/members/Events":98,"../../service/xmpp/XMPPEvents":100,"./../settings/Settings":40,"./audio_levels/AudioLevels.js":10,"./authentication/Authentication":12,"./avatar/Avatar":14,"./etherpad/Etherpad.js":15,"./prezi/Prezi.js":16,"./side_pannels/SidePanelToggler":18,"./side_pannels/chat/Chat.js":19,"./side_pannels/contactlist/ContactList":23,"./side_pannels/settings/SettingsMenu":24,"./toolbars/BottomToolbar":25,"./toolbars/Toolbar":26,"./toolbars/ToolbarToggler":27,"./util/MessageHandler":29,"./util/NicknameHandler":30,"./util/UIUtil":31,"./videolayout/VideoLayout.js":33,"./welcome_page/RoomnameGenerator":34,"./welcome_page/WelcomePage":35,"events":101}],10:[function(require,module,exports){+},{"../../service/RTC/RTCEvents":92,"../../service/RTC/StreamEventTypes":94,"../../service/connectionquality/CQEvents":97,"../../service/desktopsharing/DesktopSharingEventTypes":98,"../../service/members/Events":99,"../../service/xmpp/XMPPEvents":101,"./../settings/Settings":40,"./audio_levels/AudioLevels.js":10,"./authentication/Authentication":12,"./avatar/Avatar":14,"./etherpad/Etherpad.js":15,"./prezi/Prezi.js":16,"./side_pannels/SidePanelToggler":18,"./side_pannels/chat/Chat.js":19,"./side_pannels/contactlist/ContactList":23,"./side_pannels/settings/SettingsMenu":24,"./toolbars/BottomToolbar":25,"./toolbars/Toolbar":26,"./toolbars/ToolbarToggler":27,"./util/MessageHandler":29,"./util/NicknameHandler":30,"./util/UIUtil":31,"./videolayout/VideoLayout.js":33,"./welcome_page/RoomnameGenerator":34,"./welcome_page/WelcomePage":35,"events":102}],10:[function(require,module,exports){var CanvasUtil = require("./CanvasUtils");var ASDrawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');@@ -3062,7 +3062,7 @@ var Avatar = {module.exports = Avatar;-},{"../../../service/RTC/MediaStreamTypes":89,"../../settings/Settings":40,"../videolayout/VideoLayout":33}],15:[function(require,module,exports){+},{"../../../service/RTC/MediaStreamTypes":90,"../../settings/Settings":40,"../videolayout/VideoLayout":33}],15:[function(require,module,exports){/* global $, config,setLargeVideoVisible, Util */@@ -4545,7 +4545,7 @@ var Chat = (function (my) {return my;}(Chat || {}));module.exports = Chat;-},{"../../../../service/UI/UIEvents":94,"../../toolbars/ToolbarToggler":27,"../../util/NicknameHandler":30,"../../util/UIUtil":31,"../SidePanelToggler":18,"./Commands":20,"./Replacement":21,"./smileys.json":22}],20:[function(require,module,exports){+},{"../../../../service/UI/UIEvents":95,"../../toolbars/ToolbarToggler":27,"../../util/NicknameHandler":30,"../../util/UIUtil":31,"../SidePanelToggler":18,"./Commands":20,"./Replacement":21,"./smileys.json":22}],20:[function(require,module,exports){var UIUtil = require("../../util/UIUtil");/**@@ -5028,7 +5028,7 @@ var SettingsMenu = {module.exports = SettingsMenu;-},{"../../../../service/translation/languages":99,"../../avatar/Avatar":14,"../../util/UIUtil":31,"./../../../settings/Settings":40}],25:[function(require,module,exports){+},{"../../../../service/translation/languages":100,"../../avatar/Avatar":14,"../../util/UIUtil":31,"./../../../settings/Settings":40}],25:[function(require,module,exports){var PanelToggler = require("../side_pannels/SidePanelToggler");var buttonHandlers = {@@ -5720,7 +5720,7 @@ var Toolbar = (function (my) {}(Toolbar || {}));module.exports = Toolbar;-},{"../../../service/authentication/AuthenticationEvents":95,"../authentication/Authentication":12,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/SidePanelToggler":18,"../util/MessageHandler":29,"../util/UIUtil":31,"./BottomToolbar":25}],27:[function(require,module,exports){+},{"../../../service/authentication/AuthenticationEvents":96,"../authentication/Authentication":12,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/SidePanelToggler":18,"../util/MessageHandler":29,"../util/UIUtil":31,"./BottomToolbar":25}],27:[function(require,module,exports){/* global $, interfaceConfig, Moderator, DesktopStreaming.showDesktopSharingButton */var toolbarTimeoutObject,@@ -6198,7 +6198,7 @@ var NickanameHandler = {};module.exports = NickanameHandler;-},{"../../../service/UI/UIEvents":94}],31:[function(require,module,exports){+},{"../../../service/UI/UIEvents":95}],31:[function(require,module,exports){/*** Created by hristo on 12/22/14.*/@@ -9006,7 +9006,7 @@ var VideoLayout = (function (my) {}(VideoLayout || {}));module.exports = VideoLayout;-},{"../../../service/RTC/MediaStreamTypes":89,"../../../service/UI/UIEvents":94,"../audio_levels/AudioLevels":10,"../avatar/Avatar":14,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/chat/Chat":19,"../side_pannels/contactlist/ContactList":23,"../util/NicknameHandler":30,"../util/UIUtil":31,"./ConnectionIndicator":32}],34:[function(require,module,exports){+},{"../../../service/RTC/MediaStreamTypes":90,"../../../service/UI/UIEvents":95,"../audio_levels/AudioLevels":10,"../avatar/Avatar":14,"../etherpad/Etherpad":15,"../prezi/Prezi":16,"../side_pannels/chat/Chat":19,"../side_pannels/contactlist/ContactList":23,"../util/NicknameHandler":30,"../util/UIUtil":31,"./ConnectionIndicator":32}],34:[function(require,module,exports){//var nouns = [//];var pluralNouns = [@@ -9424,7 +9424,7 @@ var ConnectionQuality = {};module.exports = ConnectionQuality;-},{"../../service/connectionquality/CQEvents":96,"../../service/xmpp/XMPPEvents":100,"events":101}],37:[function(require,module,exports){+},{"../../service/connectionquality/CQEvents":97,"../../service/xmpp/XMPPEvents":101,"events":102}],37:[function(require,module,exports){/* global $, alert, APP, changeLocalVideo, chrome, config, getConferenceHandler,getUserMediaWithConstraints *//**@@ -9792,7 +9792,7 @@ module.exports = {};-},{"../../service/desktopsharing/DesktopSharingEventTypes":97,"events":101}],38:[function(require,module,exports){+},{"../../service/desktopsharing/DesktopSharingEventTypes":98,"events":102}],38:[function(require,module,exports){//maps keycode to character, id of popover for given function and functionvar shortcuts = {67: {@@ -10010,7 +10010,7 @@ var Members = {module.exports = Members;-},{"../../service/members/Events":98,"../../service/xmpp/XMPPEvents":100,"events":101}],40:[function(require,module,exports){+},{"../../service/members/Events":99,"../../service/xmpp/XMPPEvents":101,"events":102}],40:[function(require,module,exports){var email = '';var displayName = '';var userId;@@ -10379,7 +10379,7 @@ SimulcastReceiver.prototype.transformRemoteDescription = function (desc) {};module.exports = SimulcastReceiver;-},{"../../service/RTC/MediaStreamTypes":89,"./SimulcastLogger":41,"./SimulcastUtils":44}],43:[function(require,module,exports){+},{"../../service/RTC/MediaStreamTypes":90,"./SimulcastLogger":41,"./SimulcastUtils":44}],43:[function(require,module,exports){var SimulcastLogger = require("./SimulcastLogger");var SimulcastUtils = require("./SimulcastUtils");@@ -11339,7 +11339,7 @@ SimulcastManager.prototype.resetSender = function() {var simulcast = new SimulcastManager();module.exports = simulcast;-},{"../../service/RTC/RTCEvents":91,"./SimulcastReceiver":42,"./SimulcastSender":43,"./SimulcastUtils":44}],46:[function(require,module,exports){+},{"../../service/RTC/RTCEvents":92,"./SimulcastReceiver":42,"./SimulcastSender":43,"./SimulcastUtils":44}],46:[function(require,module,exports){/*** Provides statistics for the local stream.*/@@ -12211,7 +12211,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()};-},{"../../service/RTC/RTCBrowserType":90}],48:[function(require,module,exports){+},{"../../service/RTC/RTCBrowserType":91}],48:[function(require,module,exports){/*** Created by hristo on 8/4/14.*/@@ -12344,7 +12344,7 @@ var statistics =module.exports = statistics;-},{"../../service/RTC/StreamEventTypes.js":93,"../../service/xmpp/XMPPEvents":100,"./LocalStatsCollector.js":46,"./RTPStatsCollector.js":47,"events":101}],49:[function(require,module,exports){+},{"../../service/RTC/StreamEventTypes.js":94,"../../service/xmpp/XMPPEvents":101,"./LocalStatsCollector.js":46,"./RTPStatsCollector.js":47,"events":102}],49:[function(require,module,exports){var i18n = require("i18next-client");var languages = require("../../service/translation/languages");var Settings = require("../settings/Settings");@@ -12478,13 +12478,14 @@ module.exports = {}};-},{"../../service/translation/languages":99,"../settings/Settings":40,"i18next-client":64}],50:[function(require,module,exports){+},{"../../service/translation/languages":100,"../settings/Settings":40,"i18next-client":65}],50:[function(require,module,exports){/* jshint -W117 */var TraceablePeerConnection = require("./TraceablePeerConnection");var SDPDiffer = require("./SDPDiffer");var SDPUtil = require("./SDPUtil");var SDP = require("./SDP");var RTCBrowserType = require("../../service/RTC/RTCBrowserType");+var async = require("async");// Jingle stufffunction JingleSession(me, sid, connection, service) {@@ -12533,6 +12534,7 @@ function JingleSession(me, sid, connection, service) {* by the application logic.*/this.videoMuteByUser = false;+ this.modifySourcesQueue = async.queue(this._modifySources.bind(this), 1);}//TODO: this array must be removed when firefox implement multistream support@@ -13255,7 +13257,7 @@ JingleSession.prototype.addSource = function (elem, fromJid) {});sdp.raw = sdp.session + sdp.media.join('');});- this.modifySources();+ this.modifySourcesQueue.push();};JingleSession.prototype.removeSource = function (elem, fromJid) {@@ -13316,11 +13318,12 @@ JingleSession.prototype.removeSource = function (elem, fromJid) {});sdp.raw = sdp.session + sdp.media.join('');});- this.modifySources();+ this.modifySourcesQueue.push();};-JingleSession.prototype.modifySources = function (successCallback) {+JingleSession.prototype._modifySources = function (successCallback, queueCallback) {var self = this;+if (this.peerconnection.signalingState == 'closed') return;if (!(this.addssrc.length || this.removessrc.length || this.pendingop !== null || this.switchstreams)){// There is nothing to do since scheduled job might have been executed by another succeeding call@@ -13328,21 +13331,7 @@ JingleSession.prototype.modifySources = function (successCallback) {if(successCallback){successCallback();}- return;- }-- // FIXME: this is a big hack- // https://code.google.com/p/webrtc/issues/detail?id=2688- // ^ has been fixed.- if (!(this.peerconnection.signalingState == 'stable' && this.peerconnection.iceConnectionState == 'connected')) {- console.warn('modifySources not yet', this.peerconnection.signalingState, this.peerconnection.iceConnectionState);- this.wait = true;- window.setTimeout(function() { self.modifySources(successCallback); }, 250);- return;- }- if (this.wait) {- window.setTimeout(function() { self.modifySources(successCallback); }, 2500);- this.wait = false;+ queueCallback();return;}@@ -13382,6 +13371,7 @@ JingleSession.prototype.modifySources = function (successCallback) {if(self.signalingState == 'closed') {console.error("createAnswer attempt on closed state");+ queueCallback("createAnswer attempt on closed state");return;}@@ -13418,23 +13408,28 @@ JingleSession.prototype.modifySources = function (successCallback) {if(successCallback){successCallback();}+ queueCallback();},function(error) {console.error('modified setLocalDescription failed', error);+ queueCallback(error);});},function(error) {console.error('modified answer failed', error);+ queueCallback(error);});},function(error) {console.error('modify failed', error);+ queueCallback(error);});};+/*** Switches video streams.* @param new_stream new stream that will be used as video of this session.@@ -13465,7 +13460,7 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success}self.switchstreams = true;- self.modifySources(function() {+ self.modifySourcesQueue.push(function() {console.log('modify sources done');success_callback();@@ -13573,7 +13568,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {this.hardMuteVideo(mute);- this.modifySources(callback(mute));+ this.modifySourcesQueue.push(callback(mute));};JingleSession.prototype.hardMuteVideo = function (muted) {@@ -13819,7 +13814,7 @@ JingleSession.prototype.remoteStreamAdded = function (data, times) {module.exports = JingleSession;-},{"../../service/RTC/RTCBrowserType":90,"./SDP":51,"./SDPDiffer":52,"./SDPUtil":53,"./TraceablePeerConnection":54}],51:[function(require,module,exports){+},{"../../service/RTC/RTCBrowserType":91,"./SDP":51,"./SDPDiffer":52,"./SDPUtil":53,"./TraceablePeerConnection":54,"async":64}],51:[function(require,module,exports){/* jshint -W117 */var SDPUtil = require("./SDPUtil");@@ -15277,7 +15272,7 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {module.exports = TraceablePeerConnection;-},{"sdp-interop":82}],55:[function(require,module,exports){+},{"sdp-interop":83}],55:[function(require,module,exports){/* global $, $iq, APP, config, connection, UI, messageHandler,roomName, sessionTerminated, Strophe, Util */var XMPPEvents = require("../../service/xmpp/XMPPEvents");@@ -15695,7 +15690,7 @@ module.exports = Moderator;-},{"../../service/authentication/AuthenticationEvents":95,"../../service/xmpp/XMPPEvents":100,"../settings/Settings":40}],56:[function(require,module,exports){+},{"../../service/authentication/AuthenticationEvents":96,"../../service/xmpp/XMPPEvents":101,"../settings/Settings":40}],56:[function(require,module,exports){/* global $, $iq, config, connection, focusMucJid, messageHandler, Moderator,Toolbar, Util */var Moderator = require("./moderator");@@ -16509,7 +16504,7 @@ module.exports = function(XMPP, eventEmitter) {};-},{"../../service/xmpp/XMPPEvents":100,"./JingleSession":50,"./moderator":55}],58:[function(require,module,exports){+},{"../../service/xmpp/XMPPEvents":101,"./JingleSession":50,"./moderator":55}],58:[function(require,module,exports){/* jshint -W117 */var JingleSession = require("./JingleSession");@@ -16848,7 +16843,7 @@ module.exports = function(XMPP, eventEmitter)};-},{"../../service/xmpp/XMPPEvents":100,"./JingleSession":50}],59:[function(require,module,exports){+},{"../../service/xmpp/XMPPEvents":101,"./JingleSession":50}],59:[function(require,module,exports){/* global Strophe */module.exports = function () {@@ -17569,7 +17564,1134 @@ var XMPP = {module.exports = XMPP;-},{"../../service/RTC/RTCEvents":91,"../../service/RTC/StreamEventTypes":93,"../../service/UI/UIEvents":94,"../../service/xmpp/XMPPEvents":100,"../settings/Settings":40,"./SDP":51,"./moderator":55,"./recording":56,"./strophe.emuc":57,"./strophe.jingle":58,"./strophe.logger":59,"./strophe.moderate":60,"./strophe.rayo":61,"./strophe.util":62,"events":101,"pako":65}],64:[function(require,module,exports){+},{"../../service/RTC/RTCEvents":92,"../../service/RTC/StreamEventTypes":94,"../../service/UI/UIEvents":95,"../../service/xmpp/XMPPEvents":101,"../settings/Settings":40,"./SDP":51,"./moderator":55,"./recording":56,"./strophe.emuc":57,"./strophe.jingle":58,"./strophe.logger":59,"./strophe.moderate":60,"./strophe.rayo":61,"./strophe.util":62,"events":102,"pako":66}],64:[function(require,module,exports){+(function (process){+/*!+ * async+ * https://github.com/caolan/async+ *+ * Copyright 2010-2014 Caolan McMahon+ * Released under the MIT license+ */+/*jshint onevar: false, indent:4 */+/*global setImmediate: false, setTimeout: false, console: false */+(function () {++ var async = {};++ // global on the server, window in the browser+ var root, previous_async;++ root = this;+ if (root != null) {+ previous_async = root.async;+ }++ async.noConflict = function () {+ root.async = previous_async;+ return async;+ };++ function only_once(fn) {+ var called = false;+ return function() {+ if (called) throw new Error("Callback was already called.");+ called = true;+ fn.apply(root, arguments);+ }+ }++ //// cross-browser compatiblity functions ////++ var _toString = Object.prototype.toString;++ var _isArray = Array.isArray || function (obj) {+ return _toString.call(obj) === '[object Array]';+ };++ var _each = function (arr, iterator) {+ if (arr.forEach) {+ return arr.forEach(iterator);+ }+ for (var i = 0; i < arr.length; i += 1) {+ iterator(arr[i], i, arr);+ }+ };++ var _map = function (arr, iterator) {+ if (arr.map) {+ return arr.map(iterator);+ }+ var results = [];+ _each(arr, function (x, i, a) {+ results.push(iterator(x, i, a));+ });+ return results;+ };++ var _reduce = function (arr, iterator, memo) {+ if (arr.reduce) {+ return arr.reduce(iterator, memo);+ }+ _each(arr, function (x, i, a) {+ memo = iterator(memo, x, i, a);+ });+ return memo;+ };++ var _keys = function (obj) {+ if (Object.keys) {+ return Object.keys(obj);+ }+ var keys = [];+ for (var k in obj) {+ if (obj.hasOwnProperty(k)) {+ keys.push(k);+ }+ }+ return keys;+ };++ //// exported async module functions ////++ //// nextTick implementation with browser-compatible fallback ////+ if (typeof process === 'undefined' || !(process.nextTick)) {+ if (typeof setImmediate === 'function') {+ async.nextTick = function (fn) {+ // not a direct alias for IE10 compatibility+ setImmediate(fn);+ };+ async.setImmediate = async.nextTick;+ }+ else {+ async.nextTick = function (fn) {+ setTimeout(fn, 0);+ };+ async.setImmediate = async.nextTick;+ }+ }+ else {+ async.nextTick = process.nextTick;+ if (typeof setImmediate !== 'undefined') {+ async.setImmediate = function (fn) {+ // not a direct alias for IE10 compatibility+ setImmediate(fn);+ };+ }+ else {+ async.setImmediate = async.nextTick;+ }+ }++ async.each = function (arr, iterator, callback) {+ callback = callback || function () {};+ if (!arr.length) {+ return callback();+ }+ var completed = 0;+ _each(arr, function (x) {+ iterator(x, only_once(done) );+ });+ function done(err) {+ if (err) {+ callback(err);+ callback = function () {};+ }+ else {+ completed += 1;+ if (completed >= arr.length) {+ callback();+ }+ }+ }+ };+ async.forEach = async.each;++ async.eachSeries = function (arr, iterator, callback) {+ callback = callback || function () {};+ if (!arr.length) {+ return callback();+ }+ var completed = 0;+ var iterate = function () {+ iterator(arr[completed], function (err) {+ if (err) {+ callback(err);+ callback = function () {};+ }+ else {+ completed += 1;+ if (completed >= arr.length) {+ callback();+ }+ else {+ iterate();+ }+ }+ });+ };+ iterate();+ };+ async.forEachSeries = async.eachSeries;++ async.eachLimit = function (arr, limit, iterator, callback) {+ var fn = _eachLimit(limit);+ fn.apply(null, [arr, iterator, callback]);+ };+ async.forEachLimit = async.eachLimit;++ var _eachLimit = function (limit) {++ return function (arr, iterator, callback) {+ callback = callback || function () {};+ if (!arr.length || limit <= 0) {+ return callback();+ }+ var completed = 0;+ var started = 0;+ var running = 0;++ (function replenish () {+ if (completed >= arr.length) {+ return callback();+ }++ while (running < limit && started < arr.length) {+ started += 1;+ running += 1;+ iterator(arr[started - 1], function (err) {+ if (err) {+ callback(err);+ callback = function () {};+ }+ else {+ completed += 1;+ running -= 1;+ if (completed >= arr.length) {+ callback();+ }+ else {+ replenish();+ }+ }+ });+ }+ })();+ };+ };+++ var doParallel = function (fn) {+ return function () {+ var args = Array.prototype.slice.call(arguments);+ return fn.apply(null, [async.each].concat(args));+ };+ };+ var doParallelLimit = function(limit, fn) {+ return function () {+ var args = Array.prototype.slice.call(arguments);+ return fn.apply(null, [_eachLimit(limit)].concat(args));+ };+ };+ var doSeries = function (fn) {+ return function () {+ var args = Array.prototype.slice.call(arguments);+ return fn.apply(null, [async.eachSeries].concat(args));+ };+ };+++ var _asyncMap = function (eachfn, arr, iterator, callback) {+ arr = _map(arr, function (x, i) {+ return {index: i, value: x};+ });+ if (!callback) {+ eachfn(arr, function (x, callback) {+ iterator(x.value, function (err) {+ callback(err);+ });+ });+ } else {+ var results = [];+ eachfn(arr, function (x, callback) {+ iterator(x.value, function (err, v) {+ results[x.index] = v;+ callback(err);+ });+ }, function (err) {+ callback(err, results);+ });+ }+ };+ async.map = doParallel(_asyncMap);+ async.mapSeries = doSeries(_asyncMap);+ async.mapLimit = function (arr, limit, iterator, callback) {+ return _mapLimit(limit)(arr, iterator, callback);+ };++ var _mapLimit = function(limit) {+ return doParallelLimit(limit, _asyncMap);+ };++ // reduce only has a series version, as doing reduce in parallel won't+ // work in many situations.+ async.reduce = function (arr, memo, iterator, callback) {+ async.eachSeries(arr, function (x, callback) {+ iterator(memo, x, function (err, v) {+ memo = v;+ callback(err);+ });+ }, function (err) {+ callback(err, memo);+ });+ };+ // inject alias+ async.inject = async.reduce;+ // foldl alias+ async.foldl = async.reduce;++ async.reduceRight = function (arr, memo, iterator, callback) {+ var reversed = _map(arr, function (x) {+ return x;+ }).reverse();+ async.reduce(reversed, memo, iterator, callback);+ };+ // foldr alias+ async.foldr = async.reduceRight;++ var _filter = function (eachfn, arr, iterator, callback) {+ var results = [];+ arr = _map(arr, function (x, i) {+ return {index: i, value: x};+ });+ eachfn(arr, function (x, callback) {+ iterator(x.value, function (v) {+ if (v) {+ results.push(x);+ }+ callback();+ });+ }, function (err) {+ callback(_map(results.sort(function (a, b) {+ return a.index - b.index;+ }), function (x) {+ return x.value;+ }));+ });+ };+ async.filter = doParallel(_filter);+ async.filterSeries = doSeries(_filter);+ // select alias+ async.select = async.filter;+ async.selectSeries = async.filterSeries;++ var _reject = function (eachfn, arr, iterator, callback) {+ var results = [];+ arr = _map(arr, function (x, i) {+ return {index: i, value: x};+ });+ eachfn(arr, function (x, callback) {+ iterator(x.value, function (v) {+ if (!v) {+ results.push(x);+ }+ callback();+ });+ }, function (err) {+ callback(_map(results.sort(function (a, b) {+ return a.index - b.index;+ }), function (x) {+ return x.value;+ }));+ });+ };+ async.reject = doParallel(_reject);+ async.rejectSeries = doSeries(_reject);++ var _detect = function (eachfn, arr, iterator, main_callback) {+ eachfn(arr, function (x, callback) {+ iterator(x, function (result) {+ if (result) {+ main_callback(x);+ main_callback = function () {};+ }+ else {+ callback();+ }+ });+ }, function (err) {+ main_callback();+ });+ };+ async.detect = doParallel(_detect);+ async.detectSeries = doSeries(_detect);++ async.some = function (arr, iterator, main_callback) {+ async.each(arr, function (x, callback) {+ iterator(x, function (v) {+ if (v) {+ main_callback(true);+ main_callback = function () {};+ }+ callback();+ });+ }, function (err) {+ main_callback(false);+ });+ };+ // any alias+ async.any = async.some;++ async.every = function (arr, iterator, main_callback) {+ async.each(arr, function (x, callback) {+ iterator(x, function (v) {+ if (!v) {+ main_callback(false);+ main_callback = function () {};+ }+ callback();+ });+ }, function (err) {+ main_callback(true);+ });+ };+ // all alias+ async.all = async.every;++ async.sortBy = function (arr, iterator, callback) {+ async.map(arr, function (x, callback) {+ iterator(x, function (err, criteria) {+ if (err) {+ callback(err);+ }+ else {+ callback(null, {value: x, criteria: criteria});+ }+ });+ }, function (err, results) {+ if (err) {+ return callback(err);+ }+ else {+ var fn = function (left, right) {+ var a = left.criteria, b = right.criteria;+ return a < b ? -1 : a > b ? 1 : 0;+ };+ callback(null, _map(results.sort(fn), function (x) {+ return x.value;+ }));+ }+ });+ };++ async.auto = function (tasks, callback) {+ callback = callback || function () {};+ var keys = _keys(tasks);+ var remainingTasks = keys.length+ if (!remainingTasks) {+ return callback();+ }++ var results = {};++ var listeners = [];+ var addListener = function (fn) {+ listeners.unshift(fn);+ };+ var removeListener = function (fn) {+ for (var i = 0; i < listeners.length; i += 1) {+ if (listeners[i] === fn) {+ listeners.splice(i, 1);+ return;+ }+ }+ };+ var taskComplete = function () {+ remainingTasks--+ _each(listeners.slice(0), function (fn) {+ fn();+ });+ };++ addListener(function () {+ if (!remainingTasks) {+ var theCallback = callback;+ // prevent final callback from calling itself if it errors+ callback = function () {};++ theCallback(null, results);+ }+ });++ _each(keys, function (k) {+ var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];+ var taskCallback = function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (args.length <= 1) {+ args = args[0];+ }+ if (err) {+ var safeResults = {};+ _each(_keys(results), function(rkey) {+ safeResults[rkey] = results[rkey];+ });+ safeResults[k] = args;+ callback(err, safeResults);+ // stop subsequent errors hitting callback multiple times+ callback = function () {};+ }+ else {+ results[k] = args;+ async.setImmediate(taskComplete);+ }+ };+ var requires = task.slice(0, Math.abs(task.length - 1)) || [];+ var ready = function () {+ return _reduce(requires, function (a, x) {+ return (a && results.hasOwnProperty(x));+ }, true) && !results.hasOwnProperty(k);+ };+ if (ready()) {+ task[task.length - 1](taskCallback, results);+ }+ else {+ var listener = function () {+ if (ready()) {+ removeListener(listener);+ task[task.length - 1](taskCallback, results);+ }+ };+ addListener(listener);+ }+ });+ };++ async.retry = function(times, task, callback) {+ var DEFAULT_TIMES = 5;+ var attempts = [];+ // Use defaults if times not passed+ if (typeof times === 'function') {+ callback = task;+ task = times;+ times = DEFAULT_TIMES;+ }+ // Make sure times is a number+ times = parseInt(times, 10) || DEFAULT_TIMES;+ var wrappedTask = function(wrappedCallback, wrappedResults) {+ var retryAttempt = function(task, finalAttempt) {+ return function(seriesCallback) {+ task(function(err, result){+ seriesCallback(!err || finalAttempt, {err: err, result: result});+ }, wrappedResults);+ };+ };+ while (times) {+ attempts.push(retryAttempt(task, !(times-=1)));+ }+ async.series(attempts, function(done, data){+ data = data[data.length - 1];+ (wrappedCallback || callback)(data.err, data.result);+ });+ }+ // If a callback is passed, run this as a controll flow+ return callback ? wrappedTask() : wrappedTask+ };++ async.waterfall = function (tasks, callback) {+ callback = callback || function () {};+ if (!_isArray(tasks)) {+ var err = new Error('First argument to waterfall must be an array of functions');+ return callback(err);+ }+ if (!tasks.length) {+ return callback();+ }+ var wrapIterator = function (iterator) {+ return function (err) {+ if (err) {+ callback.apply(null, arguments);+ callback = function () {};+ }+ else {+ var args = Array.prototype.slice.call(arguments, 1);+ var next = iterator.next();+ if (next) {+ args.push(wrapIterator(next));+ }+ else {+ args.push(callback);+ }+ async.setImmediate(function () {+ iterator.apply(null, args);+ });+ }+ };+ };+ wrapIterator(async.iterator(tasks))();+ };++ var _parallel = function(eachfn, tasks, callback) {+ callback = callback || function () {};+ if (_isArray(tasks)) {+ eachfn.map(tasks, function (fn, callback) {+ if (fn) {+ fn(function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (args.length <= 1) {+ args = args[0];+ }+ callback.call(null, err, args);+ });+ }+ }, callback);+ }+ else {+ var results = {};+ eachfn.each(_keys(tasks), function (k, callback) {+ tasks[k](function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (args.length <= 1) {+ args = args[0];+ }+ results[k] = args;+ callback(err);+ });+ }, function (err) {+ callback(err, results);+ });+ }+ };++ async.parallel = function (tasks, callback) {+ _parallel({ map: async.map, each: async.each }, tasks, callback);+ };++ async.parallelLimit = function(tasks, limit, callback) {+ _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);+ };++ async.series = function (tasks, callback) {+ callback = callback || function () {};+ if (_isArray(tasks)) {+ async.mapSeries(tasks, function (fn, callback) {+ if (fn) {+ fn(function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (args.length <= 1) {+ args = args[0];+ }+ callback.call(null, err, args);+ });+ }+ }, callback);+ }+ else {+ var results = {};+ async.eachSeries(_keys(tasks), function (k, callback) {+ tasks[k](function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (args.length <= 1) {+ args = args[0];+ }+ results[k] = args;+ callback(err);+ });+ }, function (err) {+ callback(err, results);+ });+ }+ };++ async.iterator = function (tasks) {+ var makeCallback = function (index) {+ var fn = function () {+ if (tasks.length) {+ tasks[index].apply(null, arguments);+ }+ return fn.next();+ };+ fn.next = function () {+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;+ };+ return fn;+ };+ return makeCallback(0);+ };++ async.apply = function (fn) {+ var args = Array.prototype.slice.call(arguments, 1);+ return function () {+ return fn.apply(+ null, args.concat(Array.prototype.slice.call(arguments))+ );+ };+ };++ var _concat = function (eachfn, arr, fn, callback) {+ var r = [];+ eachfn(arr, function (x, cb) {+ fn(x, function (err, y) {+ r = r.concat(y || []);+ cb(err);+ });+ }, function (err) {+ callback(err, r);+ });+ };+ async.concat = doParallel(_concat);+ async.concatSeries = doSeries(_concat);++ async.whilst = function (test, iterator, callback) {+ if (test()) {+ iterator(function (err) {+ if (err) {+ return callback(err);+ }+ async.whilst(test, iterator, callback);+ });+ }+ else {+ callback();+ }+ };++ async.doWhilst = function (iterator, test, callback) {+ iterator(function (err) {+ if (err) {+ return callback(err);+ }+ var args = Array.prototype.slice.call(arguments, 1);+ if (test.apply(null, args)) {+ async.doWhilst(iterator, test, callback);+ }+ else {+ callback();+ }+ });+ };++ async.until = function (test, iterator, callback) {+ if (!test()) {+ iterator(function (err) {+ if (err) {+ return callback(err);+ }+ async.until(test, iterator, callback);+ });+ }+ else {+ callback();+ }+ };++ async.doUntil = function (iterator, test, callback) {+ iterator(function (err) {+ if (err) {+ return callback(err);+ }+ var args = Array.prototype.slice.call(arguments, 1);+ if (!test.apply(null, args)) {+ async.doUntil(iterator, test, callback);+ }+ else {+ callback();+ }+ });+ };++ async.queue = function (worker, concurrency) {+ if (concurrency === undefined) {+ concurrency = 1;+ }+ function _insert(q, data, pos, callback) {+ if (!q.started){+ q.started = true;+ }+ if (!_isArray(data)) {+ data = [data];+ }+ if(data.length == 0) {+ // call drain immediately if there are no tasks+ return async.setImmediate(function() {+ if (q.drain) {+ q.drain();+ }+ });+ }+ _each(data, function(task) {+ var item = {+ data: task,+ callback: typeof callback === 'function' ? callback : null+ };++ if (pos) {+ q.tasks.unshift(item);+ } else {+ q.tasks.push(item);+ }++ if (q.saturated && q.tasks.length === q.concurrency) {+ q.saturated();+ }+ async.setImmediate(q.process);+ });+ }++ var workers = 0;+ var q = {+ tasks: [],+ concurrency: concurrency,+ saturated: null,+ empty: null,+ drain: null,+ started: false,+ paused: false,+ push: function (data, callback) {+ _insert(q, data, false, callback);+ },+ kill: function () {+ q.drain = null;+ q.tasks = [];+ },+ unshift: function (data, callback) {+ _insert(q, data, true, callback);+ },+ process: function () {+ if (!q.paused && workers < q.concurrency && q.tasks.length) {+ var task = q.tasks.shift();+ if (q.empty && q.tasks.length === 0) {+ q.empty();+ }+ workers += 1;+ var next = function () {+ workers -= 1;+ if (task.callback) {+ task.callback.apply(task, arguments);+ }+ if (q.drain && q.tasks.length + workers === 0) {+ q.drain();+ }+ q.process();+ };+ var cb = only_once(next);+ worker(task.data, cb);+ }+ },+ length: function () {+ return q.tasks.length;+ },+ running: function () {+ return workers;+ },+ idle: function() {+ return q.tasks.length + workers === 0;+ },+ pause: function () {+ if (q.paused === true) { return; }+ q.paused = true;+ q.process();+ },+ resume: function () {+ if (q.paused === false) { return; }+ q.paused = false;+ q.process();+ }+ };+ return q;+ };++ async.priorityQueue = function (worker, concurrency) {++ function _compareTasks(a, b){+ return a.priority - b.priority;+ };++ function _binarySearch(sequence, item, compare) {+ var beg = -1,+ end = sequence.length - 1;+ while (beg < end) {+ var mid = beg + ((end - beg + 1) >>> 1);+ if (compare(item, sequence[mid]) >= 0) {+ beg = mid;+ } else {+ end = mid - 1;+ }+ }+ return beg;+ }++ function _insert(q, data, priority, callback) {+ if (!q.started){+ q.started = true;+ }+ if (!_isArray(data)) {+ data = [data];+ }+ if(data.length == 0) {+ // call drain immediately if there are no tasks+ return async.setImmediate(function() {+ if (q.drain) {+ q.drain();+ }+ });+ }+ _each(data, function(task) {+ var item = {+ data: task,+ priority: priority,+ callback: typeof callback === 'function' ? callback : null+ };++ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);++ if (q.saturated && q.tasks.length === q.concurrency) {+ q.saturated();+ }+ async.setImmediate(q.process);+ });+ }++ // Start with a normal queue+ var q = async.queue(worker, concurrency);++ // Override push to accept second parameter representing priority+ q.push = function (data, priority, callback) {+ _insert(q, data, priority, callback);+ };++ // Remove unshift function+ delete q.unshift;++ return q;+ };++ async.cargo = function (worker, payload) {+ var working = false,+ tasks = [];++ var cargo = {+ tasks: tasks,+ payload: payload,+ saturated: null,+ empty: null,+ drain: null,+ drained: true,+ push: function (data, callback) {+ if (!_isArray(data)) {+ data = [data];+ }+ _each(data, function(task) {+ tasks.push({+ data: task,+ callback: typeof callback === 'function' ? callback : null+ });+ cargo.drained = false;+ if (cargo.saturated && tasks.length === payload) {+ cargo.saturated();+ }+ });+ async.setImmediate(cargo.process);+ },+ process: function process() {+ if (working) return;+ if (tasks.length === 0) {+ if(cargo.drain && !cargo.drained) cargo.drain();+ cargo.drained = true;+ return;+ }++ var ts = typeof payload === 'number'+ ? tasks.splice(0, payload)+ : tasks.splice(0, tasks.length);++ var ds = _map(ts, function (task) {+ return task.data;+ });++ if(cargo.empty) cargo.empty();+ working = true;+ worker(ds, function () {+ working = false;++ var args = arguments;+ _each(ts, function (data) {+ if (data.callback) {+ data.callback.apply(null, args);+ }+ });++ process();+ });+ },+ length: function () {+ return tasks.length;+ },+ running: function () {+ return working;+ }+ };+ return cargo;+ };++ var _console_fn = function (name) {+ return function (fn) {+ var args = Array.prototype.slice.call(arguments, 1);+ fn.apply(null, args.concat([function (err) {+ var args = Array.prototype.slice.call(arguments, 1);+ if (typeof console !== 'undefined') {+ if (err) {+ if (console.error) {+ console.error(err);+ }+ }+ else if (console[name]) {+ _each(args, function (x) {+ console[name](x);+ });+ }+ }+ }]));+ };+ };+ async.log = _console_fn('log');+ async.dir = _console_fn('dir');+ /*async.info = _console_fn('info');+ async.warn = _console_fn('warn');+ async.error = _console_fn('error');*/++ async.memoize = function (fn, hasher) {+ var memo = {};+ var queues = {};+ hasher = hasher || function (x) {+ return x;+ };+ var memoized = function () {+ var args = Array.prototype.slice.call(arguments);+ var callback = args.pop();+ var key = hasher.apply(null, args);+ if (key in memo) {+ async.nextTick(function () {+ callback.apply(null, memo[key]);+ });+ }+ else if (key in queues) {+ queues[key].push(callback);+ }+ else {+ queues[key] = [callback];+ fn.apply(null, args.concat([function () {+ memo[key] = arguments;+ var q = queues[key];+ delete queues[key];+ for (var i = 0, l = q.length; i < l; i++) {+ q[i].apply(null, arguments);+ }+ }]));+ }+ };+ memoized.memo = memo;+ memoized.unmemoized = fn;+ return memoized;+ };++ async.unmemoize = function (fn) {+ return function () {+ return (fn.unmemoized || fn).apply(null, arguments);+ };+ };++ async.times = function (count, iterator, callback) {+ var counter = [];+ for (var i = 0; i < count; i++) {+ counter.push(i);+ }+ return async.map(counter, iterator, callback);+ };++ async.timesSeries = function (count, iterator, callback) {+ var counter = [];+ for (var i = 0; i < count; i++) {+ counter.push(i);+ }+ return async.mapSeries(counter, iterator, callback);+ };++ async.seq = function (/* functions... */) {+ var fns = arguments;+ return function () {+ var that = this;+ var args = Array.prototype.slice.call(arguments);+ var callback = args.pop();+ async.reduce(fns, args, function (newargs, fn, cb) {+ fn.apply(that, newargs.concat([function () {+ var err = arguments[0];+ var nextargs = Array.prototype.slice.call(arguments, 1);+ cb(err, nextargs);+ }]))+ },+ function (err, results) {+ callback.apply(that, [err].concat(results));+ });+ };+ };++ async.compose = function (/* functions... */) {+ return async.seq.apply(null, Array.prototype.reverse.call(arguments));+ };++ var _applyEach = function (eachfn, fns /*args...*/) {+ var go = function () {+ var that = this;+ var args = Array.prototype.slice.call(arguments);+ var callback = args.pop();+ return eachfn(fns, function (fn, cb) {+ fn.apply(that, args.concat([cb]));+ },+ callback);+ };+ if (arguments.length > 2) {+ var args = Array.prototype.slice.call(arguments, 2);+ return go.apply(this, args);+ }+ else {+ return go;+ }+ };+ async.applyEach = doParallel(_applyEach);+ async.applyEachSeries = doSeries(_applyEach);++ async.forever = function (fn, callback) {+ function next(err) {+ if (err) {+ if (callback) {+ return callback(err);+ }+ throw err;+ }+ fn(next);+ }+ next();+ };++ // Node.js+ if (typeof module !== 'undefined' && module.exports) {+ module.exports = async;+ }+ // AMD / RequireJS+ else if (typeof define !== 'undefined' && define.amd) {+ define([], function () {+ return async;+ });+ }+ // included directly via <script> tag+ else {+ root.async = async;+ }++}());++}).call(this,require('_process'))+},{"_process":103}],65:[function(require,module,exports){// i18next, v1.7.7// Copyright (c)2014 Jan Mühlemann (jamuhl).// Distributed under MIT license@@ -19692,7 +20814,7 @@ module.exports = XMPP;i18n.options = o;})();-},{"jquery":"jquery"}],65:[function(require,module,exports){+},{"jquery":"jquery"}],66:[function(require,module,exports){// Top level file is just a mixin of submodules & constants'use strict';@@ -19707,7 +20829,7 @@ var pako = {};assign(pako, deflate, inflate, constants);module.exports = pako;-},{"./lib/deflate":66,"./lib/inflate":67,"./lib/utils/common":68,"./lib/zlib/constants":71}],66:[function(require,module,exports){+},{"./lib/deflate":67,"./lib/inflate":68,"./lib/utils/common":69,"./lib/zlib/constants":72}],67:[function(require,module,exports){'use strict';@@ -20072,7 +21194,7 @@ exports.Deflate = Deflate;exports.deflate = deflate;exports.deflateRaw = deflateRaw;exports.gzip = gzip;-},{"./utils/common":68,"./utils/strings":69,"./zlib/deflate.js":73,"./zlib/messages":78,"./zlib/zstream":80}],67:[function(require,module,exports){+},{"./utils/common":69,"./utils/strings":70,"./zlib/deflate.js":74,"./zlib/messages":79,"./zlib/zstream":81}],68:[function(require,module,exports){'use strict';@@ -20441,7 +21563,7 @@ exports.inflate = inflate;exports.inflateRaw = inflateRaw;exports.ungzip = inflate;-},{"./utils/common":68,"./utils/strings":69,"./zlib/constants":71,"./zlib/gzheader":74,"./zlib/inflate.js":76,"./zlib/messages":78,"./zlib/zstream":80}],68:[function(require,module,exports){+},{"./utils/common":69,"./utils/strings":70,"./zlib/constants":72,"./zlib/gzheader":75,"./zlib/inflate.js":77,"./zlib/messages":79,"./zlib/zstream":81}],69:[function(require,module,exports){'use strict';@@ -20544,7 +21666,7 @@ exports.setTyped = function (on) {};exports.setTyped(TYPED_OK);-},{}],69:[function(require,module,exports){+},{}],70:[function(require,module,exports){// String encode/decode helpers'use strict';@@ -20731,7 +21853,7 @@ exports.utf8border = function(buf, max) {return (pos + _utf8len[buf[pos]] > max) ? pos : max;};-},{"./common":68}],70:[function(require,module,exports){+},{"./common":69}],71:[function(require,module,exports){'use strict';// Note: adler32 takes 12% for level 0 and 2% for level 6.@@ -20764,7 +21886,7 @@ function adler32(adler, buf, len, pos) {module.exports = adler32;-},{}],71:[function(require,module,exports){+},{}],72:[function(require,module,exports){module.exports = {/* Allowed flush values; see deflate() and inflate() below for details */@@ -20812,7 +21934,7 @@ module.exports = {Z_DEFLATED: 8//Z_NULL: null // Use -1 or null inline, depending on var type};-},{}],72:[function(require,module,exports){+},{}],73:[function(require,module,exports){'use strict';// Note: we can't get significant speed boost here.@@ -20854,7 +21976,7 @@ function crc32(crc, buf, len, pos) {module.exports = crc32;-},{}],73:[function(require,module,exports){+},{}],74:[function(require,module,exports){'use strict';var utils = require('../utils/common');@@ -22620,7 +23742,7 @@ exports.deflatePending = deflatePending;exports.deflatePrime = deflatePrime;exports.deflateTune = deflateTune;*/-},{"../utils/common":68,"./adler32":70,"./crc32":72,"./messages":78,"./trees":79}],74:[function(require,module,exports){+},{"../utils/common":69,"./adler32":71,"./crc32":73,"./messages":79,"./trees":80}],75:[function(require,module,exports){'use strict';@@ -22661,7 +23783,7 @@ function GZheader() {}module.exports = GZheader;-},{}],75:[function(require,module,exports){+},{}],76:[function(require,module,exports){'use strict';// See state defs from inflate.js@@ -22988,7 +24110,7 @@ module.exports = function inflate_fast(strm, start) {return;};-},{}],76:[function(require,module,exports){+},{}],77:[function(require,module,exports){'use strict';@@ -24492,7 +25614,7 @@ exports.inflateSync = inflateSync;exports.inflateSyncPoint = inflateSyncPoint;exports.inflateUndermine = inflateUndermine;*/-},{"../utils/common":68,"./adler32":70,"./crc32":72,"./inffast":75,"./inftrees":77}],77:[function(require,module,exports){+},{"../utils/common":69,"./adler32":71,"./crc32":73,"./inffast":76,"./inftrees":78}],78:[function(require,module,exports){'use strict';@@ -24819,7 +25941,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, tareturn 0;};-},{"../utils/common":68}],78:[function(require,module,exports){+},{"../utils/common":69}],79:[function(require,module,exports){'use strict';module.exports = {@@ -24833,7 +25955,7 @@ module.exports = {'-5': 'buffer error', /* Z_BUF_ERROR (-5) */'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */};-},{}],79:[function(require,module,exports){+},{}],80:[function(require,module,exports){'use strict';@@ -26033,7 +27155,7 @@ exports._tr_stored_block = _tr_stored_block;exports._tr_flush_block = _tr_flush_block;exports._tr_tally = _tr_tally;exports._tr_align = _tr_align;-},{"../utils/common":68}],80:[function(require,module,exports){+},{"../utils/common":69}],81:[function(require,module,exports){'use strict';@@ -26063,7 +27185,7 @@ function ZStream() {}module.exports = ZStream;-},{}],81:[function(require,module,exports){+},{}],82:[function(require,module,exports){module.exports = function arrayEquals(array) {// if the other array is a falsy value, returnif (!array)@@ -26089,10 +27211,10 @@ module.exports = function arrayEquals(array) {}-},{}],82:[function(require,module,exports){+},{}],83:[function(require,module,exports){exports.Interop = require('./interop');-},{"./interop":83}],83:[function(require,module,exports){+},{"./interop":84}],84:[function(require,module,exports){var transform = require('./transform');var arrayEquals = require('./array-equals');@@ -26615,7 +27737,7 @@ Interop.prototype.toPlanA = function(desc) {//#endregion};-},{"./array-equals":81,"./transform":84}],84:[function(require,module,exports){+},{"./array-equals":82,"./transform":85}],85:[function(require,module,exports){var transform = require('sdp-transform');exports.write = function(session, opts) {@@ -26714,7 +27836,7 @@ exports.parse = function(sdp) {};-},{"sdp-transform":86}],85:[function(require,module,exports){+},{"sdp-transform":87}],86:[function(require,module,exports){var grammar = module.exports = {v: [{name: 'version',@@ -26959,7 +28081,7 @@ Object.keys(grammar).forEach(function (key) {});});-},{}],86:[function(require,module,exports){+},{}],87:[function(require,module,exports){var parser = require('./parser');var writer = require('./writer');@@ -26969,7 +28091,7 @@ exports.parseFmtpConfig = parser.parseFmtpConfig;exports.parsePayloads = parser.parsePayloads;exports.parseRemoteCandidates = parser.parseRemoteCandidates;-},{"./parser":87,"./writer":88}],87:[function(require,module,exports){+},{"./parser":88,"./writer":89}],88:[function(require,module,exports){var toIntIfInt = function (v) {return String(Number(v)) === v ? Number(v) : v;};@@ -27064,7 +28186,7 @@ exports.parseRemoteCandidates = function (str) {return candidates;};-},{"./grammar":85}],88:[function(require,module,exports){+},{"./grammar":86}],89:[function(require,module,exports){var grammar = require('./grammar');// customized util.format - discards excess arguments and can void middle ones@@ -27180,14 +28302,14 @@ module.exports = function (session, opts) {return sdp.join('\r\n') + '\r\n';};-},{"./grammar":85}],89:[function(require,module,exports){+},{"./grammar":86}],90:[function(require,module,exports){var MediaStreamType = {VIDEO_TYPE: "Video",AUDIO_TYPE: "Audio"};module.exports = MediaStreamType;-},{}],90:[function(require,module,exports){+},{}],91:[function(require,module,exports){var RTCBrowserType = {RTC_BROWSER_CHROME: "rtc_browser.chrome",@@ -27195,7 +28317,7 @@ var RTCBrowserType = {};module.exports = RTCBrowserType;-},{}],91:[function(require,module,exports){+},{}],92:[function(require,module,exports){var RTCEvents = {LASTN_CHANGED: "rtc.lastn_changed",DOMINANTSPEAKER_CHANGED: "rtc.dominantspeaker_changed",@@ -27208,7 +28330,7 @@ var RTCEvents = {};module.exports = RTCEvents;-},{}],92:[function(require,module,exports){+},{}],93:[function(require,module,exports){var Resolutions = {"1080": {width: 1920,@@ -27262,7 +28384,7 @@ var Resolutions = {}};module.exports = Resolutions;-},{}],93:[function(require,module,exports){+},{}],94:[function(require,module,exports){var StreamEventTypes = {EVENT_TYPE_LOCAL_CREATED: "stream.local_created",@@ -27278,14 +28400,14 @@ var StreamEventTypes = {};module.exports = StreamEventTypes;-},{}],94:[function(require,module,exports){+},{}],95:[function(require,module,exports){var UIEvents = {NICKNAME_CHANGED: "UI.nickname_changed",SELECTED_ENDPOINT: "UI.selected_endpoint",PINNED_ENDPOINT: "UI.pinned_endpoint"};module.exports = UIEvents;-},{}],95:[function(require,module,exports){+},{}],96:[function(require,module,exports){var AuthenticationEvents = {/*** Event callback arguments:@@ -27299,7 +28421,7 @@ var AuthenticationEvents = {};module.exports = AuthenticationEvents;-},{}],96:[function(require,module,exports){+},{}],97:[function(require,module,exports){var CQEvents = {LOCALSTATS_UPDATED: "cq.localstats_updated",REMOTESTATS_UPDATED: "cq.remotestats_updated",@@ -27307,7 +28429,7 @@ var CQEvents = {};module.exports = CQEvents;-},{}],97:[function(require,module,exports){+},{}],98:[function(require,module,exports){var DesktopSharingEventTypes = {INIT: "ds.init",@@ -27317,14 +28439,14 @@ var DesktopSharingEventTypes = {};module.exports = DesktopSharingEventTypes;-},{}],98:[function(require,module,exports){+},{}],99:[function(require,module,exports){var Events = {DTMF_SUPPORT_CHANGED: "members.dtmf_support_changed"};module.exports = Events;-},{}],99:[function(require,module,exports){+},{}],100:[function(require,module,exports){module.exports = {getLanguages : function () {var languages = [];@@ -27340,7 +28462,7 @@ module.exports = {DE: "de",TR: "tr"}-},{}],100:[function(require,module,exports){+},{}],101:[function(require,module,exports){var XMPPEvents = {CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",CALL_TERMINATED: "xmpp.callterminated.jingle",@@ -27374,7 +28496,7 @@ var XMPPEvents = {DEVICE_AVAILABLE: "xmpp.device_available"};module.exports = XMPPEvents;-},{}],101:[function(require,module,exports){+},{}],102:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.//// Permission is hereby granted, free of charge, to any person obtaining a@@ -27677,5 +28799,64 @@ function isUndefined(arg) {return arg === void 0;}+},{}],103:[function(require,module,exports){+// shim for using process in browser++var process = module.exports = {};+var queue = [];+var draining = false;++function drainQueue() {+ if (draining) {+ return;+ }+ draining = true;+ var currentQueue;+ var len = queue.length;+ while(len) {+ currentQueue = queue;+ queue = [];+ var i = -1;+ while (++i < len) {+ currentQueue[i]();+ }+ len = queue.length;+ }+ draining = false;+}+process.nextTick = function (fun) {+ queue.push(fun);+ if (!draining) {+ setTimeout(drainQueue, 0);+ }+};++process.title = 'browser';+process.browser = true;+process.env = {};+process.argv = [];+process.version = ''; // empty string to avoid regexp issues++function noop() {}++process.on = noop;+process.addListener = noop;+process.once = noop;+process.off = noop;+process.removeListener = noop;+process.removeAllListeners = noop;+process.emit = noop;++process.binding = function (name) {+ throw new Error('process.binding is not supported');+};++// TODO(shtylman)+process.cwd = function () { return '/' };+process.chdir = function (dir) {+ throw new Error('process.chdir is not supported');+};+process.umask = function() { return 0; };+},{}]},{},[1])(1)});\ No newline at end of filediff --git a/modules/xmpp/JingleSession.js b/modules/xmpp/JingleSession.jsindex 796fb04c39..5b76132e5d 100644--- a/modules/xmpp/JingleSession.js+++ b/modules/xmpp/JingleSession.js@@ -4,6 +4,7 @@ var SDPDiffer = require("./SDPDiffer");var SDPUtil = require("./SDPUtil");var SDP = require("./SDP");var RTCBrowserType = require("../../service/RTC/RTCBrowserType");+var async = require("async");// Jingle stufffunction JingleSession(me, sid, connection, service) {@@ -52,6 +53,7 @@ function JingleSession(me, sid, connection, service) {* by the application logic.*/this.videoMuteByUser = false;+ this.modifySourcesQueue = async.queue(this._modifySources.bind(this), 1);}//TODO: this array must be removed when firefox implement multistream support@@ -774,7 +776,7 @@ JingleSession.prototype.addSource = function (elem, fromJid) {});sdp.raw = sdp.session + sdp.media.join('');});- this.modifySources();+ this.modifySourcesQueue.push();};JingleSession.prototype.removeSource = function (elem, fromJid) {@@ -835,11 +837,12 @@ JingleSession.prototype.removeSource = function (elem, fromJid) {});sdp.raw = sdp.session + sdp.media.join('');});- this.modifySources();+ this.modifySourcesQueue.push();};-JingleSession.prototype.modifySources = function (successCallback) {+JingleSession.prototype._modifySources = function (successCallback, queueCallback) {var self = this;+if (this.peerconnection.signalingState == 'closed') return;if (!(this.addssrc.length || this.removessrc.length || this.pendingop !== null || this.switchstreams)){// There is nothing to do since scheduled job might have been executed by another succeeding call@@ -847,21 +850,7 @@ JingleSession.prototype.modifySources = function (successCallback) {if(successCallback){successCallback();}- return;- }-- // FIXME: this is a big hack- // https://code.google.com/p/webrtc/issues/detail?id=2688- // ^ has been fixed.- if (!(this.peerconnection.signalingState == 'stable' && this.peerconnection.iceConnectionState == 'connected')) {- console.warn('modifySources not yet', this.peerconnection.signalingState, this.peerconnection.iceConnectionState);- this.wait = true;- window.setTimeout(function() { self.modifySources(successCallback); }, 250);- return;- }- if (this.wait) {- window.setTimeout(function() { self.modifySources(successCallback); }, 2500);- this.wait = false;+ queueCallback();return;}@@ -901,6 +890,7 @@ JingleSession.prototype.modifySources = function (successCallback) {if(self.signalingState == 'closed') {console.error("createAnswer attempt on closed state");+ queueCallback("createAnswer attempt on closed state");return;}@@ -937,23 +927,28 @@ JingleSession.prototype.modifySources = function (successCallback) {if(successCallback){successCallback();}+ queueCallback();},function(error) {console.error('modified setLocalDescription failed', error);+ queueCallback(error);});},function(error) {console.error('modified answer failed', error);+ queueCallback(error);});},function(error) {console.error('modify failed', error);+ queueCallback(error);});};+/*** Switches video streams.* @param new_stream new stream that will be used as video of this session.@@ -984,7 +979,7 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success}self.switchstreams = true;- self.modifySources(function() {+ self.modifySourcesQueue.push(function() {console.log('modify sources done');success_callback();@@ -1092,7 +1087,7 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {this.hardMuteVideo(mute);- this.modifySources(callback(mute));+ this.modifySourcesQueue.push(callback(mute));};JingleSession.prototype.hardMuteVideo = function (muted) {diff --git a/package.json b/package.jsonindex 732078416e..09c1404c61 100644--- a/package.json+++ b/package.json@@ -19,7 +19,8 @@"pako": "*","i18next-client": "1.7.7","sdp-interop": "jitsi/sdp-interop#f65fedfe57a",- "sdp-transform": "1.3.0"+ "sdp-transform": "1.3.0",+ "async": "0.9.0"},"devDependencies": {},