From 5be3a77e08161dbef9ff3831985ff4a7cbd35439 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Sun, 22 Jun 2014 11:13:02 +0200 Subject: [PATCH 1/4] protocol changes --- libs/strophe/strophe.jingle.adapter.js | 4 ++-- libs/strophe/strophe.jingle.js | 4 ++-- libs/strophe/strophe.jingle.sessionbase.js | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.js index 2e8e1e209..670827e6e 100644 --- a/libs/strophe/strophe.jingle.adapter.js +++ b/libs/strophe/strophe.jingle.adapter.js @@ -208,7 +208,7 @@ TraceablePeerConnection.prototype.addSource = function (elem) { $(elem).each(function (idx, content) { var name = $(content).attr('name'); var lines = ''; - tmp = $(content).find('>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); + tmp = $(content).find('>description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); 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('>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); + tmp = $(content).find('>description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]'); tmp.each(function () { var ssrc = $(this).attr('ssrc'); // This should never happen, but can be useful for bug detection diff --git a/libs/strophe/strophe.jingle.js b/libs/strophe/strophe.jingle.js index 4e096adb9..f99812246 100644 --- a/libs/strophe/strophe.jingle.js +++ b/libs/strophe/strophe.jingle.js @@ -150,10 +150,10 @@ Strophe.addConnectionPlugin('jingle', { $(document).trigger('unmute.jingle', [sess.sid, affected]); } break; - case 'addsource': // FIXME: proprietary + case 'source-add': // FIXME: proprietary sess.addSource($(iq).find('>jingle>content'), fromJid); break; - case 'removesource': // FIXME: proprietary + case 'source-remove': // FIXME: proprietary sess.removeSource($(iq).find('>jingle>content'), fromJid); break; default: diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.js index d38d7304f..35fa50aa3 100644 --- a/libs/strophe/strophe.jingle.sessionbase.js +++ b/libs/strophe/strophe.jingle.sessionbase.js @@ -156,7 +156,7 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator, var modify = $iq({to: toJid, type: 'set'}) .c('jingle', { xmlns: 'urn:xmpp:jingle:1', - action: isAdd ? 'addsource' : 'removesource', + action: isAdd ? 'source-add' : 'source-remove', initiator: initiator, sid: sid } @@ -168,6 +168,8 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator, modified = true; var channel = sdpMediaSsrcs[channelNum]; 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 // generate sources from lines 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 description modify.up(); // end of content }); if (modified) { @@ -220,4 +223,4 @@ SessionBase.prototype.toggleVideoMute = function (callback) { this.peerconnection.hardMuteVideo(!ismuted); this.modifySources(callback(!ismuted)); -}; \ No newline at end of file +}; From a4614b7cb2d1f97d7e01433e50be4c10f9c97d29 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Sun, 22 Jun 2014 12:43:33 +0200 Subject: [PATCH 2/4] support both variants, js focus still sends "old" protocol --- libs/strophe/strophe.jingle.adapter.js | 4 ++-- libs/strophe/strophe.jingle.js | 2 ++ libs/strophe/strophe.jingle.sessionbase.js | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.js index 670827e6e..9683f30ee 100644 --- a/libs/strophe/strophe.jingle.adapter.js +++ b/libs/strophe/strophe.jingle.adapter.js @@ -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 diff --git a/libs/strophe/strophe.jingle.js b/libs/strophe/strophe.jingle.js index f99812246..21addf163 100644 --- a/libs/strophe/strophe.jingle.js +++ b/libs/strophe/strophe.jingle.js @@ -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; diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.js index 35fa50aa3..4643bd0ee 100644 --- a/libs/strophe/strophe.jingle.sessionbase.js +++ b/libs/strophe/strophe.jingle.sessionbase.js @@ -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) { From 86b4355704835b742aaea0b00d58101eac4036c3 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Sat, 23 Aug 2014 13:29:57 +0200 Subject: [PATCH 3/4] change in focus protocol, use new proprietary variant --- libs/strophe/strophe.jingle.sessionbase.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.js index 4643bd0ee..662deb306 100644 --- a/libs/strophe/strophe.jingle.sessionbase.js +++ b/libs/strophe/strophe.jingle.sessionbase.js @@ -156,8 +156,7 @@ 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', -- not yet - action: isAdd ? 'addsource' : 'removesource', + action: isAdd ? 'source-add' : 'source-remove', -- not yet initiator: initiator, sid: sid } @@ -170,7 +169,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}); -- not yet + 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 // generate sources from lines Object.keys(channel.ssrcs).forEach(function(ssrcNum) { @@ -192,7 +191,7 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator, }); modify.up(); // end of source }); - // modify.up(); // end of description -- not yet + modify.up(); // end of description modify.up(); // end of content }); if (modified) { From dc3a2548b531dee2d2968a0804ee4c048c0d1c30 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Sat, 23 Aug 2014 13:41:42 +0200 Subject: [PATCH 4/4] that happens when you forget to npm i precommit-hook --- libs/strophe/strophe.jingle.sessionbase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.js index 662deb306..35fa50aa3 100644 --- a/libs/strophe/strophe.jingle.sessionbase.js +++ b/libs/strophe/strophe.jingle.sessionbase.js @@ -156,7 +156,7 @@ 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', -- not yet + action: isAdd ? 'source-add' : 'source-remove', initiator: initiator, sid: sid }