support both variants, js focus still sends "old" protocol

This commit is contained in:
Philipp Hancke 2014-06-22 12:43:33 +02:00
parent 5be3a77e08
commit a4614b7cb2
3 changed files with 8 additions and 5 deletions

View File

@ -208,7 +208,7 @@ TraceablePeerConnection.prototype.addSource = function (elem) {
$(elem).each(function (idx, content) {
var name = $(content).attr('name');
var lines = '';
tmp = $(content).find('>description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
tmp = $(content).find('source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); // can handle both >source and >description>source
tmp.each(function () {
var ssrc = $(this).attr('ssrc');
if(mySdp.containsSSRC(ssrc)){
@ -254,7 +254,7 @@ TraceablePeerConnection.prototype.removeSource = function (elem) {
$(elem).each(function (idx, content) {
var name = $(content).attr('name');
var lines = '';
tmp = $(content).find('>description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
tmp = $(content).find('source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); // can handle both >source and >description>source
tmp.each(function () {
var ssrc = $(this).attr('ssrc');
// This should never happen, but can be useful for bug detection

View File

@ -150,9 +150,11 @@ Strophe.addConnectionPlugin('jingle', {
$(document).trigger('unmute.jingle', [sess.sid, affected]);
}
break;
case 'addsource': // FIXME: proprietary, un-jingleish
case 'source-add': // FIXME: proprietary
sess.addSource($(iq).find('>jingle>content'), fromJid);
break;
case 'removesource': // FIXME: proprietary, un-jingleish
case 'source-remove': // FIXME: proprietary
sess.removeSource($(iq).find('>jingle>content'), fromJid);
break;

View File

@ -156,7 +156,8 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator,
var modify = $iq({to: toJid, type: 'set'})
.c('jingle', {
xmlns: 'urn:xmpp:jingle:1',
action: isAdd ? 'source-add' : 'source-remove',
//action: isAdd ? 'source-add' : 'source-remove', -- not yet
action: isAdd ? 'addsource' : 'removesource',
initiator: initiator,
sid: sid
}
@ -169,7 +170,7 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator,
var channel = sdpMediaSsrcs[channelNum];
modify.c('content', {name: channel.mediaType});
modify.c('description', {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: channel.mediaType});
// modify.c('description', {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: channel.mediaType}); -- not yet
// FIXME: not completly sure this operates on blocks and / or handles different ssrcs correctly
// generate sources from lines
Object.keys(channel.ssrcs).forEach(function(ssrcNum) {
@ -191,7 +192,7 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator,
});
modify.up(); // end of source
});
modify.up(); // end of description
// modify.up(); // end of description -- not yet
modify.up(); // end of content
});
if (modified) {