diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index 4d71abe3be..2d1edf7994 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -654,39 +654,6 @@ export default class RTC extends Listenable { return RTCUtils.setAudioOutputDevice(deviceId); } - /** - * Returns true if given WebRTC MediaStream is considered a valid - * "user" stream which means that it's not a "receive only" stream nor a - * "mixed" JVB stream. - * - * Clients that implement Unified Plan, such as Firefox use recvonly - * "streams/channels/tracks" for receiving remote stream/tracks, as opposed - * to Plan B where there are only 3 channels: audio, video and data. - * - * @param {MediaStream} stream The WebRTC MediaStream instance. - * @returns {boolean} - */ - static isUserStream(stream) { - return RTC.isUserStreamById(stream.id); - } - - /** - * Returns true if a WebRTC MediaStream identified by given stream - * ID is considered a valid "user" stream which means that it's not a - * "receive only" stream nor a "mixed" JVB stream. - * - * Clients that implement Unified Plan, such as Firefox use recvonly - * "streams/channels/tracks" for receiving remote stream/tracks, as opposed - * to Plan B where there are only 3 channels: audio, video and data. - * - * @param {string} streamId The id of WebRTC MediaStream. - * @returns {boolean} - */ - static isUserStreamById(streamId) { - return streamId && streamId !== 'mixedmslabel' - && streamId !== 'default'; - } - /** * Allows to receive list of available cameras/microphones. * @param {function} callback Would receive array of devices as an diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index c60a26b383..04a5848b48 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -834,16 +834,32 @@ class RTCUtils extends Listenable { getEventDataForActiveDevice(device) { const deviceList = []; const deviceData = { - 'deviceId': device.deviceId, - 'kind': device.kind, - 'label': device.label, - 'groupId': device.groupId + deviceId: device.deviceId, + kind: device.kind, + label: device.label, + groupId: device.groupId }; deviceList.push(deviceData); return { deviceList }; } + + /** + * Returns true if a WebRTC MediaStream identified by given stream + * ID is considered a valid "user" stream which means that it's not a + * "receive only" stream nor a "mixed" JVB stream. + * + * Clients that implement Unified Plan, such as Firefox use recvonly + * "streams/channels/tracks" for receiving remote stream/tracks, as opposed + * to Plan B where there are only 3 channels: audio, video and data. + * + * @param {string} streamId The id of WebRTC MediaStream. + * @returns {boolean} + */ + isUserStreamById(streamId) { + return streamId && streamId !== 'mixedmslabel' && streamId !== 'default'; + } } const rtcUtils = new RTCUtils(); diff --git a/modules/RTC/TraceablePeerConnection.js b/modules/RTC/TraceablePeerConnection.js index d331e3aecb..cc039c2cff 100644 --- a/modules/RTC/TraceablePeerConnection.js +++ b/modules/RTC/TraceablePeerConnection.js @@ -21,7 +21,7 @@ import SdpSimulcast from '../sdp/SdpSimulcast'; import { SdpTransformWrap } from '../sdp/SdpTransformUtil'; import JitsiRemoteTrack from './JitsiRemoteTrack'; -import RTC from './RTC'; +import RTCUtils from './RTCUtils'; import { TPCUtils } from './TPCUtils'; // FIXME SDP tools should end up in some kind of util module @@ -857,7 +857,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr const mediaType = track.kind; // Do not create remote tracks for 'mixed' JVB SSRCs (used by JVB for RTCP termination). - if (!this.isP2P && !RTC.isUserStreamById(streamId)) { + if (!this.isP2P && !RTCUtils.isUserStreamById(streamId)) { return; } logger.info(`${this} Received track event for remote stream[id=${streamId},type=${mediaType}]`); @@ -1016,7 +1016,7 @@ TraceablePeerConnection.prototype._remoteTrackRemoved = function(stream, track) const trackId = track?.id; // Ignore stream removed events for JVB "mixed" sources (used for RTCP termination). - if (!RTC.isUserStreamById(streamId)) { + if (!RTCUtils.isUserStreamById(streamId)) { return; } @@ -2454,7 +2454,7 @@ TraceablePeerConnection.prototype.close = function() { this._dtmfTonesQueue = []; if (!this.rtc._removePeerConnection(this)) { - logger.error(`${this} RTC._removePeerConnection returned false`); + logger.error(`${this} rtc._removePeerConnection returned false`); } if (this.statsinterval !== null) { window.clearInterval(this.statsinterval); diff --git a/types/hand-crafted/modules/RTC/RTC.d.ts b/types/hand-crafted/modules/RTC/RTC.d.ts index 0a32ec062b..14e0e2b3cd 100644 --- a/types/hand-crafted/modules/RTC/RTC.d.ts +++ b/types/hand-crafted/modules/RTC/RTC.d.ts @@ -32,8 +32,6 @@ export default class RTC extends Listenable { static getCurrentlyAvailableMediaDevices: () => unknown[]; // TODO: static getEventDataForActiveDevice: () => MediaDeviceInfo; static setAudioOutputDevice: ( deviceId: string ) => Promise; // TODO: - static isUserStream: ( stream: MediaStream ) => boolean; - static isUserStreamById: ( streamId: string ) => boolean; static enumerateDevices: ( callback: () => unknown ) => void; // TODO: static stopMediaStream: ( mediaStream: MediaStream ) => void; static isDesktopSharingEnabled: () => boolean; diff --git a/types/hand-crafted/modules/RTC/RTCUtils.d.ts b/types/hand-crafted/modules/RTC/RTCUtils.d.ts index 9f76230a94..caa3f1ce0a 100644 --- a/types/hand-crafted/modules/RTC/RTCUtils.d.ts +++ b/types/hand-crafted/modules/RTC/RTCUtils.d.ts @@ -15,6 +15,7 @@ declare class RTCUtils extends Listenable { getCurrentlyAvailableMediaDevices: () => unknown[]; // TODO: getEventDataForActiveDevice: ( device: MediaDeviceInfo ) => unknown; // TODO: arePermissionsGrantedForAvailableDevices: () => boolean; + isUserStreamById: ( streamId: string ) => boolean; } declare const rtcUtils: RTCUtils;