partial audio-only focus support. lacks SRD/SLD cycle to trigger keyframe
This commit is contained in:
parent
7ecb5f7962
commit
2f7b21588c
4
app.js
4
app.js
|
@ -249,9 +249,11 @@ $(document).bind('setLocalDescription.jingle', function (event, sid) {
|
||||||
var localSDP = new SDP(sess.peerconnection.localDescription.sdp);
|
var localSDP = new SDP(sess.peerconnection.localDescription.sdp);
|
||||||
localSDP.media.forEach(function (media) {
|
localSDP.media.forEach(function (media) {
|
||||||
var type = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
|
var type = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
|
||||||
|
if (SDPUtil.find_line(media, 'a=ssrc:')) {
|
||||||
var ssrc = SDPUtil.find_line(media, 'a=ssrc:').substring(7).split(' ')[0];
|
var ssrc = SDPUtil.find_line(media, 'a=ssrc:').substring(7).split(' ')[0];
|
||||||
// assumes a single local ssrc
|
// assumes a single local ssrc
|
||||||
newssrcs[type] = ssrc;
|
newssrcs[type] = ssrc;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
console.log('new ssrcs', newssrcs);
|
console.log('new ssrcs', newssrcs);
|
||||||
|
|
||||||
|
@ -260,7 +262,9 @@ $(document).bind('setLocalDescription.jingle', function (event, sid) {
|
||||||
i++;
|
i++;
|
||||||
connection.emuc.addMediaToPresence(i, mtype, newssrcs[mtype]);
|
connection.emuc.addMediaToPresence(i, mtype, newssrcs[mtype]);
|
||||||
});
|
});
|
||||||
|
if (i > 0) {
|
||||||
connection.emuc.sendPresence();
|
connection.emuc.sendPresence();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('joined.muc', function (event, jid, info) {
|
$(document).bind('joined.muc', function (event, jid, info) {
|
||||||
|
|
|
@ -42,6 +42,9 @@ function ColibriFocus(connection, bridgejid) {
|
||||||
|
|
||||||
this.peerconnection = null;
|
this.peerconnection = null;
|
||||||
|
|
||||||
|
// media types of the conference
|
||||||
|
this.media = ['audio', 'video'];
|
||||||
|
|
||||||
this.sid = Math.random().toString(36).substr(2, 12);
|
this.sid = Math.random().toString(36).substr(2, 12);
|
||||||
this.connection.jingle.sessions[this.sid] = this;
|
this.connection.jingle.sessions[this.sid] = this;
|
||||||
this.mychannel = [];
|
this.mychannel = [];
|
||||||
|
@ -151,14 +154,7 @@ ColibriFocus.prototype._makeConference = function () {
|
||||||
elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri'});
|
elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri'});
|
||||||
|
|
||||||
var stream = this.connection.jingle.localStream;
|
var stream = this.connection.jingle.localStream;
|
||||||
var types = [];
|
this.media.forEach(function (name) {
|
||||||
if (connection.jingle.localStream.getAudioTracks().length > 0) {
|
|
||||||
types.push('audio');
|
|
||||||
}
|
|
||||||
if (connection.jingle.localStream.getVideoTracks().length > 0) {
|
|
||||||
types.push('video');
|
|
||||||
}
|
|
||||||
types.forEach(function (name) {
|
|
||||||
elem.c('content', {name: name});
|
elem.c('content', {name: name});
|
||||||
elem.c('channel', {initiator: 'true', expire: '15'}).up();
|
elem.c('channel', {initiator: 'true', expire: '15'}).up();
|
||||||
for (var j = 0; j < self.peers.length; j++) {
|
for (var j = 0; j < self.peers.length; j++) {
|
||||||
|
@ -652,15 +648,19 @@ ColibriFocus.prototype.setRemoteDescription = function (session, elem, desctype)
|
||||||
this.remotessrc[session.peerjid] = [];
|
this.remotessrc[session.peerjid] = [];
|
||||||
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
||||||
//if (channel == 0) continue; FIXME: does not work as intended
|
//if (channel == 0) continue; FIXME: does not work as intended
|
||||||
|
if (SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').length) {
|
||||||
this.remotessrc[session.peerjid][channel] = SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
this.remotessrc[session.peerjid][channel] = SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ACT 4: add new a=ssrc lines to local remotedescription
|
// ACT 4: add new a=ssrc lines to local remotedescription
|
||||||
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
for (channel = 0; channel < this.channels[participant].length; channel++) {
|
||||||
//if (channel == 0) continue; FIXME: does not work as intended
|
//if (channel == 0) continue; FIXME: does not work as intended
|
||||||
if (!this.addssrc[channel]) this.addssrc[channel] = '';
|
if (!this.addssrc[channel]) this.addssrc[channel] = '';
|
||||||
|
if (SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').length) {
|
||||||
this.addssrc[channel] += SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
this.addssrc[channel] += SDPUtil.find_lines(remoteSDP.media[channel], 'a=ssrc:').join('\r\n') + '\r\n';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.modifySources();
|
this.modifySources();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -843,10 +843,10 @@ ColibriFocus.prototype.modifySources = function () {
|
||||||
console.log('setModifiedRemoteDescription ok');
|
console.log('setModifiedRemoteDescription ok');
|
||||||
self.peerconnection.createAnswer(
|
self.peerconnection.createAnswer(
|
||||||
function (modifiedAnswer) {
|
function (modifiedAnswer) {
|
||||||
console.log('modifiedAnswer created', modifiedAnswer.sdp);
|
console.log('modifiedAnswer created');
|
||||||
// FIXME: pushing down an answer while ice connection state
|
// FIXME: pushing down an answer while ice connection state
|
||||||
// is still checking is bad...
|
// is still checking is bad...
|
||||||
console.log(self.peerconnection.iceConnectionState);
|
//console.log(self.peerconnection.iceConnectionState);
|
||||||
|
|
||||||
// trying to work around another chrome bug
|
// trying to work around another chrome bug
|
||||||
//modifiedAnswer.sdp = modifiedAnswer.sdp.replace(/a=setup:active/g, 'a=setup:actpass');
|
//modifiedAnswer.sdp = modifiedAnswer.sdp.replace(/a=setup:active/g, 'a=setup:actpass');
|
||||||
|
@ -856,17 +856,17 @@ ColibriFocus.prototype.modifySources = function () {
|
||||||
$(document).trigger('setLocalDescription.jingle', [self.sid]);
|
$(document).trigger('setLocalDescription.jingle', [self.sid]);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log('setModifiedLocalDescription failed');
|
console.log('setModifiedLocalDescription failed', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log('createModifiedAnswer failed');
|
console.log('createModifiedAnswer failed', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log('setModifiedRemoteDescription failed');
|
console.log('setModifiedRemoteDescription failed', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
|
@ -900,7 +900,6 @@ ColibriFocus.prototype.modifySources = function () {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// A colibri session is similar to a jingle session, it just implements some things differently
|
// A colibri session is similar to a jingle session, it just implements some things differently
|
||||||
// FIXME: inherit jinglesession, see https://github.com/legastero/Jingle-RTCPeerConnection/blob/master/index.js
|
// FIXME: inherit jinglesession, see https://github.com/legastero/Jingle-RTCPeerConnection/blob/master/index.js
|
||||||
function ColibriSession(me, sid, connection) {
|
function ColibriSession(me, sid, connection) {
|
||||||
|
|
Loading…
Reference in New Issue