Parcourir la source

#2458 Remove not used isUserStream RTC method. Move isUserStreamById RTC method into RTCUtils in order to fix circular dependency issue.

Require cycle: lib/lib-jitsi-meet/modules/RTC/RTC.js -> lib/lib-jitsi-meet/modules/RTC/TraceablePeerConnection.js -> lib/lib-jitsi-meet/modules/RTC/RTC.js
release-8443
Roman Melnyk il y a 1 an
Parent
révision
56952c20c4

+ 0
- 33
modules/RTC/RTC.js Voir le fichier

@@ -654,39 +654,6 @@ export default class RTC extends Listenable {
654 654
         return RTCUtils.setAudioOutputDevice(deviceId);
655 655
     }
656 656
 
657
-    /**
658
-     * Returns <tt>true<tt/> if given WebRTC MediaStream is considered a valid
659
-     * "user" stream which means that it's not a "receive only" stream nor a
660
-     * "mixed" JVB stream.
661
-     *
662
-     * Clients that implement Unified Plan, such as Firefox use recvonly
663
-     * "streams/channels/tracks" for receiving remote stream/tracks, as opposed
664
-     * to Plan B where there are only 3 channels: audio, video and data.
665
-     *
666
-     * @param {MediaStream} stream The WebRTC MediaStream instance.
667
-     * @returns {boolean}
668
-     */
669
-    static isUserStream(stream) {
670
-        return RTC.isUserStreamById(stream.id);
671
-    }
672
-
673
-    /**
674
-     * Returns <tt>true<tt/> if a WebRTC MediaStream identified by given stream
675
-     * ID is considered a valid "user" stream which means that it's not a
676
-     * "receive only" stream nor a "mixed" JVB stream.
677
-     *
678
-     * Clients that implement Unified Plan, such as Firefox use recvonly
679
-     * "streams/channels/tracks" for receiving remote stream/tracks, as opposed
680
-     * to Plan B where there are only 3 channels: audio, video and data.
681
-     *
682
-     * @param {string} streamId The id of WebRTC MediaStream.
683
-     * @returns {boolean}
684
-     */
685
-    static isUserStreamById(streamId) {
686
-        return streamId && streamId !== 'mixedmslabel'
687
-            && streamId !== 'default';
688
-    }
689
-
690 657
     /**
691 658
      * Allows to receive list of available cameras/microphones.
692 659
      * @param {function} callback Would receive array of devices as an

+ 20
- 4
modules/RTC/RTCUtils.js Voir le fichier

@@ -834,16 +834,32 @@ class RTCUtils extends Listenable {
834 834
     getEventDataForActiveDevice(device) {
835 835
         const deviceList = [];
836 836
         const deviceData = {
837
-            'deviceId': device.deviceId,
838
-            'kind': device.kind,
839
-            'label': device.label,
840
-            'groupId': device.groupId
837
+            deviceId: device.deviceId,
838
+            kind: device.kind,
839
+            label: device.label,
840
+            groupId: device.groupId
841 841
         };
842 842
 
843 843
         deviceList.push(deviceData);
844 844
 
845 845
         return { deviceList };
846 846
     }
847
+
848
+    /**
849
+     * Returns <tt>true<tt/> if a WebRTC MediaStream identified by given stream
850
+     * ID is considered a valid "user" stream which means that it's not a
851
+     * "receive only" stream nor a "mixed" JVB stream.
852
+     *
853
+     * Clients that implement Unified Plan, such as Firefox use recvonly
854
+     * "streams/channels/tracks" for receiving remote stream/tracks, as opposed
855
+     * to Plan B where there are only 3 channels: audio, video and data.
856
+     *
857
+     * @param {string} streamId The id of WebRTC MediaStream.
858
+     * @returns {boolean}
859
+     */
860
+    isUserStreamById(streamId) {
861
+        return streamId && streamId !== 'mixedmslabel' && streamId !== 'default';
862
+    }
847 863
 }
848 864
 
849 865
 const rtcUtils = new RTCUtils();

+ 4
- 4
modules/RTC/TraceablePeerConnection.js Voir le fichier

@@ -21,7 +21,7 @@ import SdpSimulcast from '../sdp/SdpSimulcast';
21 21
 import { SdpTransformWrap } from '../sdp/SdpTransformUtil';
22 22
 
23 23
 import JitsiRemoteTrack from './JitsiRemoteTrack';
24
-import RTC from './RTC';
24
+import RTCUtils from './RTCUtils';
25 25
 import { TPCUtils } from './TPCUtils';
26 26
 
27 27
 // FIXME SDP tools should end up in some kind of util module
@@ -857,7 +857,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
857 857
     const mediaType = track.kind;
858 858
 
859 859
     // Do not create remote tracks for 'mixed' JVB SSRCs (used by JVB for RTCP termination).
860
-    if (!this.isP2P && !RTC.isUserStreamById(streamId)) {
860
+    if (!this.isP2P && !RTCUtils.isUserStreamById(streamId)) {
861 861
         return;
862 862
     }
863 863
     logger.info(`${this} Received track event for remote stream[id=${streamId},type=${mediaType}]`);
@@ -1016,7 +1016,7 @@ TraceablePeerConnection.prototype._remoteTrackRemoved = function(stream, track)
1016 1016
     const trackId = track?.id;
1017 1017
 
1018 1018
     // Ignore stream removed events for JVB "mixed" sources (used for RTCP termination).
1019
-    if (!RTC.isUserStreamById(streamId)) {
1019
+    if (!RTCUtils.isUserStreamById(streamId)) {
1020 1020
         return;
1021 1021
     }
1022 1022
 
@@ -2454,7 +2454,7 @@ TraceablePeerConnection.prototype.close = function() {
2454 2454
     this._dtmfTonesQueue = [];
2455 2455
 
2456 2456
     if (!this.rtc._removePeerConnection(this)) {
2457
-        logger.error(`${this} RTC._removePeerConnection returned false`);
2457
+        logger.error(`${this} rtc._removePeerConnection returned false`);
2458 2458
     }
2459 2459
     if (this.statsinterval !== null) {
2460 2460
         window.clearInterval(this.statsinterval);

+ 0
- 2
types/hand-crafted/modules/RTC/RTC.d.ts Voir le fichier

@@ -32,8 +32,6 @@ export default class RTC extends Listenable {
32 32
   static getCurrentlyAvailableMediaDevices: () => unknown[]; // TODO:
33 33
   static getEventDataForActiveDevice: () => MediaDeviceInfo;
34 34
   static setAudioOutputDevice: ( deviceId: string ) => Promise<unknown>; // TODO:
35
-  static isUserStream: ( stream: MediaStream ) => boolean;
36
-  static isUserStreamById: ( streamId: string ) => boolean;
37 35
   static enumerateDevices: ( callback: () => unknown ) => void; // TODO:
38 36
   static stopMediaStream: ( mediaStream: MediaStream ) => void;
39 37
   static isDesktopSharingEnabled: () => boolean;

+ 1
- 0
types/hand-crafted/modules/RTC/RTCUtils.d.ts Voir le fichier

@@ -15,6 +15,7 @@ declare class RTCUtils extends Listenable {
15 15
   getCurrentlyAvailableMediaDevices: () => unknown[]; // TODO:
16 16
   getEventDataForActiveDevice: ( device: MediaDeviceInfo ) => unknown; // TODO:
17 17
   arePermissionsGrantedForAvailableDevices: () => boolean;
18
+  isUserStreamById: ( streamId: string ) => boolean;
18 19
 }
19 20
 
20 21
 declare const rtcUtils: RTCUtils;

Chargement…
Annuler
Enregistrer