Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fixes problems with the adaptive simulcast.
George Politisf2f91ff7cfec
diff --git a/app.js b/app.jsindex 61de4dd98e..0b5b9aaeaa 100644--- a/app.js+++ b/app.js@@ -1422,15 +1422,20 @@ $(document).bind('fatalError.jingle',});-$(document).bind("video.selected", function(event, isPresentation, userJid) {- if (!isPresentation && _dataChannels && _dataChannels.length != 0) {+function onSelectedEndpointChanged(userJid)+{+ console.log('selected endpoint changed: ', userJid);+ if (_dataChannels && _dataChannels.length != 0) {_dataChannels[0].send(JSON.stringify({'colibriClass': 'SelectedEndpointChangedEvent',- 'selectedEndpoint': (isPresentation || !userJid)- // TODO(gp) hmm.. I wonder which one of the Strophe methods to use..- ? null : userJid.split('/')[1]+ 'selectedEndpoint': (!userJid || userJid == null)+ ? null : Strophe.getResourceFromJid(userJid)}));}+}++$(document).bind("selectedendpointchanged", function(event, userJid) {+ onSelectedEndpointChanged(userJid);});function callSipButtonClicked()diff --git a/data_channels.js b/data_channels.jsindex ad455fe0c7..200f1857a2 100644--- a/data_channels.js+++ b/data_channels.js@@ -24,9 +24,13 @@ function onDataChannel(event)// Sends 12 bytes binary message to the bridge//dataChannel.send(new ArrayBuffer(12));- // TODO(gp) we are supposed to tell the bridge about video selections- // so that it can do adaptive simulcast, What if a video selection has- // been made while the data channels are down or broken?+ // when the data channel becomes available, tell the bridge about video+ // selections so that it can do adaptive simulcast,+ var largeVideoSrc = $('#largeVideo').attr('src');+ var userJid = getJidFromVideoSrc(largeVideoSrc);+ // we want the notification to trigger even if userJid is undefined,+ // or null.+ onSelectedEndpointChanged(userJid);};dataChannel.onerror = function (error)diff --git a/simulcast.js b/simulcast.jsindex 75d5e22a88..f6f4fbf450 100644--- a/simulcast.js+++ b/simulcast.js@@ -839,11 +839,13 @@ function Simulcast() {var ssrc = simulcastLayer.primarySSRC;var simulcast = new Simulcast();simulcast._startLocalVideoStream(ssrc);+ $(document).trigger('simulcastlayerstarted');});$(document).bind('stopsimulcastlayer', function(event, simulcastLayer) {var ssrc = simulcastLayer.primarySSRC;var simulcast = new Simulcast();simulcast._stopLocalVideoStream(ssrc);+ $(document).trigger('simulcastlayerstopped');});}());diff --git a/videolayout.js b/videolayout.jsindex 29c0bc4938..0dd907c245 100644--- a/videolayout.js+++ b/videolayout.js@@ -3,6 +3,7 @@ var VideoLayout = (function (my) {var currentDominantSpeaker = null;var lastNCount = config.channelLastN;var lastNEndpointsCache = [];+ var largeVideoNewSrc = '';my.changeLocalAudio = function(stream) {connection.jingle.localAudio = stream;@@ -113,6 +114,7 @@ var VideoLayout = (function (my) {console.log('hover in', newSrc);if ($('#largeVideo').attr('src') != newSrc) {+ largeVideoNewSrc = newSrc;var isVisible = $('#largeVideo').is(':visible');@@ -120,6 +122,11 @@ var VideoLayout = (function (my) {// changed.var isDesktop = isVideoSrcDesktop(newSrc);+ var userJid = getJidFromVideoSrc(newSrc);+ // we want the notification to trigger even if userJid is undefined,+ // or null.+ $(document).trigger("selectedendpointchanged", [userJid]);+$('#largeVideo').fadeOut(300, function () {var oldSrc = $(this).attr('src');@@ -213,7 +220,7 @@ var VideoLayout = (function (my) {// Triggers a "video.selected" event. The "false" parameter indicates// this isn't a prezi.- $(document).trigger("video.selected", [false, userJid]);+ $(document).trigger("video.selected", [false]);VideoLayout.updateLargeVideo(videoSrc, 1);@@ -1298,7 +1305,7 @@ var VideoLayout = (function (my) {}});- $(document).bind('startsimulcastlayer', function(event, simulcastLayer) {+ $(document).bind('simulcastlayerstarted', function(event) {var localVideoSelector = $('#' + 'localVideo_' + connection.jingle.localVideo.id);var simulcast = new Simulcast();var stream = simulcast.getLocalVideoStream();@@ -1309,7 +1316,7 @@ var VideoLayout = (function (my) {localVideoSrc = $(localVideoSelector).attr('src');});- $(document).bind('stopsimulcastlayer', function(event, simulcastLayer) {+ $(document).bind('simulcastlayerstopped', function(event) {var localVideoSelector = $('#' + 'localVideo_' + connection.jingle.localVideo.id);var simulcast = new Simulcast();var stream = simulcast.getLocalVideoStream();@@ -1377,7 +1384,7 @@ var VideoLayout = (function (my) {var selRemoteVideo = $(['#', 'remoteVideo_', session.sid, '_', msidParts[0]].join(''));var updateLargeVideo = (ssrc2jid[videoSrcToSsrc[selRemoteVideo.attr('src')]]- == ssrc2jid[videoSrcToSsrc[$('#largeVideo').attr('src')]]);+ == ssrc2jid[videoSrcToSsrc[largeVideoNewSrc]]);var updateFocusedVideoSrc = (selRemoteVideo.attr('src') == focusedVideoSrc);var electedStreamUrl = webkitURL.createObjectURL(electedStream);