|
|
@@ -119,6 +119,14 @@ export default function TraceablePeerConnection(
|
|
119
|
119
|
*/
|
|
120
|
120
|
this.localTracks = new Map();
|
|
121
|
121
|
|
|
|
122
|
+ /**
|
|
|
123
|
+ * Keeps tracks of the WebRTC <tt>MediaStream</tt>s that have been added to
|
|
|
124
|
+ * the underlying WebRTC PeerConnection.
|
|
|
125
|
+ * @type {Set}
|
|
|
126
|
+ * @private
|
|
|
127
|
+ */
|
|
|
128
|
+ this._addedStreams = new Set();
|
|
|
129
|
+
|
|
122
|
130
|
/**
|
|
123
|
131
|
* @typedef {Object} TPCGroupInfo
|
|
124
|
132
|
* @property {string} semantics the SSRC groups semantics
|
|
|
@@ -1291,6 +1299,7 @@ TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
|
|
1291
|
1299
|
*/
|
|
1292
|
1300
|
TraceablePeerConnection.prototype._addStream = function(mediaStream) {
|
|
1293
|
1301
|
this.peerconnection.addStream(mediaStream);
|
|
|
1302
|
+ this._addedStreams.add(mediaStream);
|
|
1294
|
1303
|
};
|
|
1295
|
1304
|
|
|
1296
|
1305
|
/**
|
|
|
@@ -1303,6 +1312,7 @@ TraceablePeerConnection.prototype._removeStream = function(mediaStream) {
|
|
1303
|
1312
|
} else {
|
|
1304
|
1313
|
this.peerconnection.removeStream(mediaStream);
|
|
1305
|
1314
|
}
|
|
|
1315
|
+ this._addedStreams.delete(mediaStream);
|
|
1306
|
1316
|
};
|
|
1307
|
1317
|
|
|
1308
|
1318
|
/**
|
|
|
@@ -1328,6 +1338,16 @@ TraceablePeerConnection.prototype._assertTrackBelongs
|
|
1328
|
1338
|
return doesBelong;
|
|
1329
|
1339
|
};
|
|
1330
|
1340
|
|
|
|
1341
|
+/**
|
|
|
1342
|
+ * Tells if the given WebRTC <tt>MediaStream</tt> has been added to
|
|
|
1343
|
+ * the underlying WebRTC PeerConnection.
|
|
|
1344
|
+ * @param {MediaStream} mediaStream
|
|
|
1345
|
+ * @returns {boolean}
|
|
|
1346
|
+ */
|
|
|
1347
|
+TraceablePeerConnection.prototype.isMediaStreamInPc = function(mediaStream) {
|
|
|
1348
|
+ return this._addedStreams.has(mediaStream);
|
|
|
1349
|
+};
|
|
|
1350
|
+
|
|
1331
|
1351
|
/**
|
|
1332
|
1352
|
* Remove local track from this TPC.
|
|
1333
|
1353
|
* @param {JitsiLocalTrack} localTrack the track to be removed from this TPC.
|
|
|
@@ -1761,6 +1781,8 @@ TraceablePeerConnection.prototype.close = function() {
|
|
1761
|
1781
|
}
|
|
1762
|
1782
|
this.remoteTracks.clear();
|
|
1763
|
1783
|
|
|
|
1784
|
+ this._addedStreams.clear();
|
|
|
1785
|
+
|
|
1764
|
1786
|
if (!this.rtc._removePeerConnection(this)) {
|
|
1765
|
1787
|
logger.error('RTC._removePeerConnection returned false');
|
|
1766
|
1788
|
}
|