Merge pull request #82 from jitsi/jingle-protocol-changes

protocol changes
This commit is contained in:
Philipp Hancke 2014-08-24 19:14:22 +02:00
commit 7f9bf974fb
3 changed files with 11 additions and 6 deletions

View File

@ -208,7 +208,7 @@ TraceablePeerConnection.prototype.addSource = function (elem) {
$(elem).each(function (idx, content) { $(elem).each(function (idx, content) {
var name = $(content).attr('name'); var name = $(content).attr('name');
var lines = ''; var lines = '';
tmp = $(content).find('>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 () { tmp.each(function () {
var ssrc = $(this).attr('ssrc'); var ssrc = $(this).attr('ssrc');
if(mySdp.containsSSRC(ssrc)){ if(mySdp.containsSSRC(ssrc)){
@ -254,7 +254,7 @@ TraceablePeerConnection.prototype.removeSource = function (elem) {
$(elem).each(function (idx, content) { $(elem).each(function (idx, content) {
var name = $(content).attr('name'); var name = $(content).attr('name');
var lines = ''; var lines = '';
tmp = $(content).find('>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 () { tmp.each(function () {
var ssrc = $(this).attr('ssrc'); var ssrc = $(this).attr('ssrc');
// This should never happen, but can be useful for bug detection // This should never happen, but can be useful for bug detection

View File

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

View File

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