|
@@ -42,6 +42,9 @@ function ColibriFocus(connection, bridgejid) {
|
42
|
42
|
|
43
|
43
|
this.peerconnection = null;
|
44
|
44
|
|
|
45
|
+ // media types of the conference
|
|
46
|
+ this.media = ['audio', 'video'];
|
|
47
|
+
|
45
|
48
|
this.sid = Math.random().toString(36).substr(2, 12);
|
46
|
49
|
this.connection.jingle.sessions[this.sid] = this;
|
47
|
50
|
this.mychannel = [];
|
|
@@ -151,14 +154,7 @@ ColibriFocus.prototype._makeConference = function () {
|
151
|
154
|
elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri'});
|
152
|
155
|
|
153
|
156
|
var stream = this.connection.jingle.localStream;
|
154
|
|
- var types = [];
|
155
|
|
- if (connection.jingle.localStream.getAudioTracks().length > 0) {
|
156
|
|
- types.push('audio');
|
157
|
|
- }
|
158
|
|
- if (connection.jingle.localStream.getVideoTracks().length > 0) {
|
159
|
|
- types.push('video');
|
160
|
|
- }
|
161
|
|
- types.forEach(function (name) {
|
|
157
|
+ this.media.forEach(function (name) {
|
162
|
158
|
elem.c('content', {name: name});
|
163
|
159
|
elem.c('channel', {initiator: 'true', expire: '15'}).up();
|
164
|
160
|
for (var j = 0; j < self.peers.length; j++) {
|
|
@@ -652,14 +648,18 @@ ColibriFocus.prototype.setRemoteDescription = function (session, elem, desctype)
|
652
|
648
|
this.remotessrc[session.peerjid] = [];
|
653
|
649
|
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
654
|
650
|
//if (channel == 0) continue; FIXME: does not work as intended
|
655
|
|
- this.remotessrc[session.peerjid][channel] = SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
|
651
|
+ if (SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').length) {
|
|
652
|
+ this.remotessrc[session.peerjid][channel] = SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
|
653
|
+ }
|
656
|
654
|
}
|
657
|
655
|
|
658
|
656
|
// ACT 4: add new a=ssrc lines to local remotedescription
|
659
|
657
|
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
660
|
658
|
//if (channel == 0) continue; FIXME: does not work as intended
|
661
|
659
|
if (!this.addssrc[channel]) this.addssrc[channel] = '';
|
662
|
|
- this.addssrc[channel] += SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
|
660
|
+ if (SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').length) {
|
|
661
|
+ this.addssrc[channel] += SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
|
662
|
+ }
|
663
|
663
|
}
|
664
|
664
|
this.modifySources();
|
665
|
665
|
};
|
|
@@ -843,10 +843,10 @@ ColibriFocus.prototype.modifySources = function () {
|
843
|
843
|
console.log('setModifiedRemoteDescription ok');
|
844
|
844
|
self.peerconnection.createAnswer(
|
845
|
845
|
function (modifiedAnswer) {
|
846
|
|
- console.log('modifiedAnswer created', modifiedAnswer.sdp);
|
|
846
|
+ console.log('modifiedAnswer created');
|
847
|
847
|
// FIXME: pushing down an answer while ice connection state
|
848
|
848
|
// is still checking is bad...
|
849
|
|
- console.log(self.peerconnection.iceConnectionState);
|
|
849
|
+ //console.log(self.peerconnection.iceConnectionState);
|
850
|
850
|
|
851
|
851
|
// trying to work around another chrome bug
|
852
|
852
|
//modifiedAnswer.sdp = modifiedAnswer.sdp.replace(/a=setup:active/g, 'a=setup:actpass');
|
|
@@ -856,17 +856,17 @@ ColibriFocus.prototype.modifySources = function () {
|
856
|
856
|
$(document).trigger('setLocalDescription.jingle', [self.sid]);
|
857
|
857
|
},
|
858
|
858
|
function (error) {
|
859
|
|
- console.log('setModifiedLocalDescription failed');
|
|
859
|
+ console.log('setModifiedLocalDescription failed', error);
|
860
|
860
|
}
|
861
|
861
|
);
|
862
|
862
|
},
|
863
|
863
|
function (error) {
|
864
|
|
- console.log('createModifiedAnswer failed');
|
|
864
|
+ console.log('createModifiedAnswer failed', error);
|
865
|
865
|
}
|
866
|
866
|
);
|
867
|
867
|
},
|
868
|
868
|
function (error) {
|
869
|
|
- console.log('setModifiedRemoteDescription failed');
|
|
869
|
+ console.log('setModifiedRemoteDescription failed', error);
|
870
|
870
|
}
|
871
|
871
|
);
|
872
|
872
|
/*
|
|
@@ -900,7 +900,6 @@ ColibriFocus.prototype.modifySources = function () {
|
900
|
900
|
*/
|
901
|
901
|
};
|
902
|
902
|
|
903
|
|
-
|
904
|
903
|
// A colibri session is similar to a jingle session, it just implements some things differently
|
905
|
904
|
// FIXME: inherit jinglesession, see https://github.com/legastero/Jingle-RTCPeerConnection/blob/master/index.js
|
906
|
905
|
function ColibriSession(me, sid, connection) {
|