From 95e964a089721b1c2c80455f963cd6152311a131 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 6 Aug 2015 13:51:56 +0200 Subject: [PATCH] Fixes bugs in VideoSSRCHack. Additional log messages. --- modules/xmpp/JingleSession.js | 4 +++- modules/xmpp/VideoSSRCHack.js | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/xmpp/JingleSession.js b/modules/xmpp/JingleSession.js index 5b02be580..4179dc13e 100644 --- a/modules/xmpp/JingleSession.js +++ b/modules/xmpp/JingleSession.js @@ -1138,6 +1138,7 @@ JingleSession.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) { remove = VideoSSRCHack.processSourceRemove(remove); if (removed && remove) { + console.info("Sending source-remove", remove); this.connection.sendIQ(remove, function (res) { console.info('got remove result', res); @@ -1167,7 +1168,8 @@ JingleSession.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) { if (added) add = VideoSSRCHack.processSourceAdd(add); - if (added & add) { + if (added && add) { + console.info("Sending source-add", add); this.connection.sendIQ(add, function (res) { console.info('got add result', res); diff --git a/modules/xmpp/VideoSSRCHack.js b/modules/xmpp/VideoSSRCHack.js index 9e28d82d9..562873359 100644 --- a/modules/xmpp/VideoSSRCHack.js +++ b/modules/xmpp/VideoSSRCHack.js @@ -36,16 +36,17 @@ var localVideoSSRC; * other SSRCs left to be signaled after removing it. */ var filterOutSource = function (modifyIq, actionName) { - if (!localVideoSSRC) - return modifyIq; - var modifyIqTree = $(modifyIq.tree()); + + if (!localVideoSSRC) + return modifyIqTree[0]; + var videoSSRC = modifyIqTree.find( '>jingle>content[name="video"]' + '>description>source[ssrc="' + localVideoSSRC + '"]'); if (!videoSSRC.length) { - return modifyIqTree; + return modifyIqTree[0]; } console.info( @@ -55,7 +56,7 @@ var filterOutSource = function (modifyIq, actionName) { // Check if any sources still left to be added/removed if (modifyIqTree.find('>jingle>content>description>source').length) { - return modifyIqTree; + return modifyIqTree[0]; } else { return null; }