Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

keep a reference to the datachannel to avoid buggy garbage collection

Philipp Hancke310e36d1282b
diff --git a/data_channels.js b/data_channels.js
index ac6ce4dd18..9470f6153e 100644
--- a/data_channels.js
+++ b/data_channels.js
@@ -1,9 +1,15 @@
/* global connection, Strophe, updateLargeVideo, focusedVideoSrc*/
+
+// cache datachannels to avoid garbage collection
+// https://code.google.com/p/chromium/issues/detail?id=405545
+var _dataChannels = [];
+
/**
* Callback triggered by PeerConnection when new data channel is opened
* on the bridge.
* @param event the event info object.
*/
+
function onDataChannel(event)
{
var dataChannel = event.channel;
@@ -82,7 +88,11 @@ function onDataChannel(event)
dataChannel.onclose = function ()
{
console.info("The Data Channel closed", dataChannel);
+ var idx = _dataChannels.indexOf(dataChannel);
+ if (idx > -1)
+ _dataChannels = _dataChannels.splice(idx, 1);
};
+ _dataChannels.push(dataChannel);
}
/**