Browse Source

Merge branch 'master' into reloads

master
hristoterezov 9 years ago
parent
commit
04ee9419a6
6 changed files with 73 additions and 17 deletions
  1. 12
    5
      JitsiConference.js
  2. 14
    7
      modules/RTC/DataChannels.js
  3. 3
    3
      modules/RTC/RTC.js
  4. 36
    0
      modules/xmpp/JingleSessionPC.js
  5. 1
    1
      package.json
  6. 7
    1
      service/xmpp/XMPPEvents.js

+ 12
- 5
JitsiConference.js View File

@@ -585,7 +585,7 @@ JitsiConference.prototype.unlock = function () {
585 585
  */
586 586
 JitsiConference.prototype.selectParticipant = function(participantId) {
587 587
     if (this.rtc) {
588
-        this.rtc.selectedEndpoint(participantId);
588
+        this.rtc.selectEndpoint(participantId);
589 589
     }
590 590
 };
591 591
 
@@ -1155,7 +1155,14 @@ JitsiConference.prototype._reportAudioProblem = function (ssrc) {
1155 1155
         new Error(JSON.stringify(errorContent)));
1156 1156
     logger.error("Audio problem detected. The audio is received but not played",
1157 1157
         errorContent);
1158
-}
1158
+};
1159
+
1160
+/**
1161
+ * Logs an "application log" message
1162
+ */
1163
+JitsiConference.prototype.sendApplicationLog = function(message) {
1164
+    Statistics.sendLog(message);
1165
+};
1159 1166
 
1160 1167
 /**
1161 1168
  * Setups the listeners needed for the conference.
@@ -1165,7 +1172,7 @@ JitsiConference.prototype._setupListeners = function () {
1165 1172
     this.eventManager.setupChatRoomListeners();
1166 1173
     this.eventManager.setupRTCListeners();
1167 1174
     this.eventManager.setupStatisticsListeners();
1168
-}
1175
+};
1169 1176
 
1170 1177
 /**
1171 1178
  * Checks if the user identified by given <tt>mucJid</tt> is the conference
@@ -1175,7 +1182,7 @@ JitsiConference.prototype._setupListeners = function () {
1175 1182
  */
1176 1183
 JitsiConference.prototype._isFocus = function (mucJid) {
1177 1184
     return this.room.isFocus(mucJid);
1178
-}
1185
+};
1179 1186
 
1180 1187
 /**
1181 1188
  * Fires CONFERENCE_FAILED event with INCOMPATIBLE_SERVER_VERSIONS parameter
@@ -1183,6 +1190,6 @@ JitsiConference.prototype._isFocus = function (mucJid) {
1183 1190
 JitsiConference.prototype._fireIncompatibleVersionsEvent = function () {
1184 1191
     this.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
1185 1192
         JitsiConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS);
1186
-}
1193
+};
1187 1194
 
1188 1195
 module.exports = JitsiConference;

+ 14
- 7
modules/RTC/DataChannels.js View File

@@ -51,7 +51,7 @@ function DataChannels(peerConnection, emitter) {
51 51
 DataChannels.prototype.onDataChannel = function (event) {
52 52
     var dataChannel = event.channel;
53 53
     var self = this;
54
-    var lastSelectedEndpoint = null;
54
+    var selectedEndpoint = null;
55 55
 
56 56
     dataChannel.onopen = function () {
57 57
         logger.info("Data channel opened by the Videobridge!", dataChannel);
@@ -68,7 +68,8 @@ DataChannels.prototype.onDataChannel = function (event) {
68 68
         // selections so that it can do adaptive simulcast,
69 69
         // we want the notification to trigger even if userJid is undefined,
70 70
         // or null.
71
-        self.handleSelectedEndpointEvent(self.lastSelectedEndpoint);
71
+        // XXX why do we not do the same for pinned endpoints?
72
+        self.sendSelectedEndpointMessage(self.selectedEndpoint);
72 73
     };
73 74
 
74 75
     dataChannel.onerror = function (error) {
@@ -173,13 +174,19 @@ DataChannels.prototype.closeAllChannels = function () {
173 174
     });
174 175
 };
175 176
 
176
-DataChannels.prototype.handleSelectedEndpointEvent = function (userResource) {
177
-    this.lastSelectedEndpoint = userResource;
178
-    this._onXXXEndpointChanged("selected", userResource);
177
+/**
178
+ * Sends a "selected endpoint changed" message via the data channel.
179
+ */
180
+DataChannels.prototype.sendSelectedEndpointMessage = function (endpointId) {
181
+    this.selectedEndpoint = endpointId;
182
+    this._onXXXEndpointChanged("selected", endpointId);
179 183
 };
180 184
 
181
-DataChannels.prototype.handlePinnedEndpointEvent = function (userResource) {
182
-    this._onXXXEndpointChanged("pinnned", userResource);
185
+/**
186
+ * Sends a "pinned endpoint changed" message via the data channel.
187
+ */
188
+DataChannels.prototype.sendPinnedEndpointMessage = function (endpointId) {
189
+    this._onXXXEndpointChanged("pinnned", endpointId);
183 190
 };
184 191
 
185 192
 /**

+ 3
- 3
modules/RTC/RTC.js View File

@@ -86,14 +86,14 @@ RTC.prototype.onIncommingCall = function(event) {
86 86
             this.eventEmitter);
87 87
 };
88 88
 
89
-RTC.prototype.selectedEndpoint = function (id) {
89
+RTC.prototype.selectEndpoint = function (id) {
90 90
     if(this.dataChannels)
91
-        this.dataChannels.handleSelectedEndpointEvent(id);
91
+        this.dataChannels.sendSelectedEndpointMessage(id);
92 92
 };
93 93
 
94 94
 RTC.prototype.pinEndpoint = function (id) {
95 95
     if(this.dataChannels)
96
-        this.dataChannels.handlePinnedEndpointEvent(id);
96
+        this.dataChannels.sendPinnedEndpointMessage(id);
97 97
 };
98 98
 
99 99
 RTC.prototype.addListener = function (type, listener) {

+ 36
- 0
modules/xmpp/JingleSessionPC.js View File

@@ -35,6 +35,16 @@ function JingleSessionPC(me, sid, peerjid, connection,
35 35
     this.modifyingLocalStreams = false;
36 36
     this.modifiedSSRCs = {};
37 37
 
38
+    /**
39
+     * The local ICE username fragment for this session.
40
+     */
41
+    this.localUfrag = null;
42
+
43
+    /**
44
+     * The remote ICE username fragment for this session.
45
+     */
46
+    this.remoteUfrag = null;
47
+
38 48
     /**
39 49
      * A map that stores SSRCs of remote streams. And is used only locally
40 50
      * We store the mapping when jingle is received, and later is used
@@ -78,6 +88,7 @@ JingleSessionPC.prototype.doInitialize = function () {
78 88
             // complete.
79 89
             return;
80 90
         }
91
+        // XXX this is broken, candidate is not parsed.
81 92
         var candidate = ev.candidate;
82 93
         if (candidate) {
83 94
             // Discard candidates of disabled protocols.
@@ -773,6 +784,14 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
773 784
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
774 785
         queueCallback(err);
775 786
     };
787
+
788
+    var ufrag = getUfrag(sdp.raw);
789
+    if (ufrag != self.remoteUfrag) {
790
+        self.remoteUfrag = ufrag;
791
+        self.room.eventEmitter.emit(
792
+                XMPPEvents.REMOTE_UFRAG_CHANGED, ufrag);
793
+    }
794
+
776 795
     this.peerconnection.setRemoteDescription(
777 796
         new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
778 797
         function() {
@@ -794,6 +813,12 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
794 813
                     answer.sdp = modifiedAnswer.raw;
795 814
                     self.localSDP = new SDP(answer.sdp);
796 815
                     answer.sdp = self.localSDP.raw;
816
+                    var ufrag = getUfrag(answer.sdp);
817
+                    if (ufrag != self.localUfrag) {
818
+                        self.localUfrag = ufrag;
819
+                        self.room.eventEmitter.emit(
820
+                                XMPPEvents.LOCAL_UFRAG_CHANGED, ufrag);
821
+                    }
797 822
                     self.peerconnection.setLocalDescription(answer,
798 823
                         function() {
799 824
                             successCallback && successCallback();
@@ -1431,4 +1456,15 @@ function createDescriptionNode(jingle, mtype) {
1431 1456
     return desc;
1432 1457
 }
1433 1458
 
1459
+/**
1460
+ * Extracts the ice username fragment from an SDP string.
1461
+ */
1462
+function getUfrag(sdp) {
1463
+    var ufragLines = sdp.split('\n').filter(function(line) {
1464
+        return line.startsWith("a=ice-ufrag:");});
1465
+    if (ufragLines.length > 0) {
1466
+        return ufragLines[0].substr("a=ice-ufrag:".length)
1467
+    }
1468
+}
1469
+
1434 1470
 module.exports = JingleSessionPC;

+ 1
- 1
package.json View File

@@ -40,7 +40,7 @@
40 40
   "scripts": {
41 41
     "install": "npm run browserify && npm run version && npm run uglifyjs",
42 42
 
43
-    "browserify": "browserify -d JitsiMeetJS.js -s JitsiMeetJS | exorcist lib-jitsi-meet.js.map > lib-jitsi-meet.js ",
43
+    "browserify": "browserify -d JitsiMeetJS.js -s JitsiMeetJS | exorcist lib-jitsi-meet.js.map > lib-jitsi-meet.js && [ -s lib-jitsi-meet.js ]",
44 44
     "version": "VERSION=`./get-version.sh` && echo lib-jitsi-meet version is:${VERSION} && sed -i'' -e s/{#COMMIT_HASH#}/${VERSION}/g lib-jitsi-meet.js",
45 45
     "uglifyjs": "uglifyjs -p relative lib-jitsi-meet.js -o lib-jitsi-meet.min.js --source-map lib-jitsi-meet.min.map --in-source-map lib-jitsi-meet.js.map",
46 46
     "watch": "watchify JitsiMeetJS.js -s JitsiMeetJS -o lib-jitsi-meet.js -v",

+ 7
- 1
service/xmpp/XMPPEvents.js View File

@@ -162,6 +162,12 @@ var XMPPEvents = {
162 162
     START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
163 163
     // Designates an event indicating that the subject of the XMPP MUC has
164 164
     // changed.
165
-    SUBJECT_CHANGED: "xmpp.subject_changed"
165
+    SUBJECT_CHANGED: "xmpp.subject_changed",
166
+    // Designates an event indicating that the local ICE username fragment of
167
+    // the jingle session has changed.
168
+    LOCAL_UFRAG_CHANGED: "xmpp.local_ufrag_changed",
169
+    // Designates an event indicating that the local ICE username fragment of
170
+    // the jingle session has changed.
171
+    REMOTE_UFRAG_CHANGED: "xmpp.remote_ufrag_changed"
166 172
 };
167 173
 module.exports = XMPPEvents;

Loading…
Cancel
Save