Selaa lähdekoodia

Merge branch 'master' into reloads

master
hristoterezov 9 vuotta sitten
vanhempi
commit
04ee9419a6

+ 12
- 5
JitsiConference.js Näytä tiedosto

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

+ 14
- 7
modules/RTC/DataChannels.js Näytä tiedosto

51
 DataChannels.prototype.onDataChannel = function (event) {
51
 DataChannels.prototype.onDataChannel = function (event) {
52
     var dataChannel = event.channel;
52
     var dataChannel = event.channel;
53
     var self = this;
53
     var self = this;
54
-    var lastSelectedEndpoint = null;
54
+    var selectedEndpoint = null;
55
 
55
 
56
     dataChannel.onopen = function () {
56
     dataChannel.onopen = function () {
57
         logger.info("Data channel opened by the Videobridge!", dataChannel);
57
         logger.info("Data channel opened by the Videobridge!", dataChannel);
68
         // selections so that it can do adaptive simulcast,
68
         // selections so that it can do adaptive simulcast,
69
         // we want the notification to trigger even if userJid is undefined,
69
         // we want the notification to trigger even if userJid is undefined,
70
         // or null.
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
     dataChannel.onerror = function (error) {
75
     dataChannel.onerror = function (error) {
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 Näytä tiedosto

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

+ 36
- 0
modules/xmpp/JingleSessionPC.js Näytä tiedosto

35
     this.modifyingLocalStreams = false;
35
     this.modifyingLocalStreams = false;
36
     this.modifiedSSRCs = {};
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
      * A map that stores SSRCs of remote streams. And is used only locally
49
      * A map that stores SSRCs of remote streams. And is used only locally
40
      * We store the mapping when jingle is received, and later is used
50
      * We store the mapping when jingle is received, and later is used
78
             // complete.
88
             // complete.
79
             return;
89
             return;
80
         }
90
         }
91
+        // XXX this is broken, candidate is not parsed.
81
         var candidate = ev.candidate;
92
         var candidate = ev.candidate;
82
         if (candidate) {
93
         if (candidate) {
83
             // Discard candidates of disabled protocols.
94
             // Discard candidates of disabled protocols.
773
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
784
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
774
         queueCallback(err);
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
     this.peerconnection.setRemoteDescription(
795
     this.peerconnection.setRemoteDescription(
777
         new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
796
         new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
778
         function() {
797
         function() {
794
                     answer.sdp = modifiedAnswer.raw;
813
                     answer.sdp = modifiedAnswer.raw;
795
                     self.localSDP = new SDP(answer.sdp);
814
                     self.localSDP = new SDP(answer.sdp);
796
                     answer.sdp = self.localSDP.raw;
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
                     self.peerconnection.setLocalDescription(answer,
822
                     self.peerconnection.setLocalDescription(answer,
798
                         function() {
823
                         function() {
799
                             successCallback && successCallback();
824
                             successCallback && successCallback();
1431
     return desc;
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
 module.exports = JingleSessionPC;
1470
 module.exports = JingleSessionPC;

+ 1
- 1
package.json Näytä tiedosto

40
   "scripts": {
40
   "scripts": {
41
     "install": "npm run browserify && npm run version && npm run uglifyjs",
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
     "version": "VERSION=`./get-version.sh` && echo lib-jitsi-meet version is:${VERSION} && sed -i'' -e s/{#COMMIT_HASH#}/${VERSION}/g lib-jitsi-meet.js",
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
     "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",
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
     "watch": "watchify JitsiMeetJS.js -s JitsiMeetJS -o lib-jitsi-meet.js -v",
46
     "watch": "watchify JitsiMeetJS.js -s JitsiMeetJS -o lib-jitsi-meet.js -v",

+ 7
- 1
service/xmpp/XMPPEvents.js Näytä tiedosto

162
     START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
162
     START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
163
     // Designates an event indicating that the subject of the XMPP MUC has
163
     // Designates an event indicating that the subject of the XMPP MUC has
164
     // changed.
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
 module.exports = XMPPEvents;
173
 module.exports = XMPPEvents;

Loading…
Peruuta
Tallenna