Browse Source

fix(qualitycontrol): Cleanup old receiver constraints.

Endpoint based receiver constraints and other endpoint based bridge signaling messages are no longer supported by latest JVB after the switch to source-name signaling.
Rename method names 'sendNewReceiverVideoConstraintsMessage'->'sendReceiverVideoConstraintsMessage', 'setNewReceiverVideoConstraints'->'setReceiverVideoConstraints'
dev1
Jaya Allamsetty 2 years ago
parent
commit
e275d886b2

+ 0
- 32
JitsiConference.js View File

@@ -1581,38 +1581,6 @@ JitsiConference.prototype.unlock = function() {
1581 1581
     return this.lock();
1582 1582
 };
1583 1583
 
1584
-/**
1585
- * Elects the participant with the given id to be the selected participant in
1586
- * order to receive higher video quality (if simulcast is enabled).
1587
- * Or cache it if channel is not created and send it once channel is available.
1588
- * @param participantId the identifier of the participant
1589
- * @throws NetworkError or InvalidStateError or Error if the operation fails.
1590
- * @returns {void}
1591
- */
1592
-JitsiConference.prototype.selectParticipant = function(participantId) {
1593
-    this.selectParticipants([ participantId ]);
1594
-};
1595
-
1596
-/*
1597
- * Elects participants with given ids to be the selected participants in order
1598
- * to receive higher video quality (if simulcast is enabled). The argument
1599
- * should be an array of participant id strings or an empty array; an error will
1600
- * be thrown if a non-array is passed in. The error is thrown as a layer of
1601
- * protection against passing an invalid argument, as the error will happen in
1602
- * the bridge and may not be visible in the client.
1603
- *
1604
- * @param {Array<strings>} participantIds - An array of identifiers for
1605
- * participants.
1606
- * @returns {void}
1607
- */
1608
-JitsiConference.prototype.selectParticipants = function(participantIds) {
1609
-    if (!Array.isArray(participantIds)) {
1610
-        throw new Error('Invalid argument; participantIds must be an array.');
1611
-    }
1612
-
1613
-    this.receiveVideoController.selectEndpoints(participantIds);
1614
-};
1615
-
1616 1584
 /**
1617 1585
  * Obtains the current value for "lastN". See {@link setLastN} for more info.
1618 1586
  * @returns {number}

+ 2
- 55
modules/RTC/BridgeChannel.js View File

@@ -232,42 +232,12 @@ export default class BridgeChannel {
232 232
         });
233 233
     }
234 234
 
235
-    /**
236
-     * Sends a "selected endpoints changed" message via the channel.
237
-     *
238
-     * @param {Array<string>} endpointIds - The ids of the selected endpoints.
239
-     * @throws NetworkError or InvalidStateError from RTCDataChannel#send (@see
240
-     * {@link https://developer.mozilla.org/docs/Web/API/RTCDataChannel/send})
241
-     * or from WebSocket#send or Error with "No opened channel" message.
242
-     */
243
-    sendSelectedEndpointsMessage(endpointIds) {
244
-        logger.log(`Sending selected endpoints: ${endpointIds}.`);
245
-
246
-        this._send({
247
-            colibriClass: 'SelectedEndpointsChangedEvent',
248
-            selectedEndpoints: endpointIds
249
-        });
250
-    }
251
-
252
-    /**
253
-     * Sends a "receiver video constraint" message via the channel.
254
-     * @param {Number} maxFrameHeightPixels the maximum frame height,
255
-     * in pixels, this receiver is willing to receive
256
-     */
257
-    sendReceiverVideoConstraintMessage(maxFrameHeightPixels) {
258
-        logger.log(`Sending ReceiverVideoConstraint with maxFrameHeight=${maxFrameHeightPixels}px`);
259
-        this._send({
260
-            colibriClass: 'ReceiverVideoConstraint',
261
-            maxFrameHeight: maxFrameHeightPixels
262
-        });
263
-    }
264
-
265 235
     /**
266 236
      * Sends a 'ReceiverVideoConstraints' message via the bridge channel.
267 237
      *
268 238
      * @param {ReceiverVideoConstraints} constraints video constraints.
269 239
      */
270
-    sendNewReceiverVideoConstraintsMessage(constraints) {
240
+    sendReceiverVideoConstraintsMessage(constraints) {
271 241
         logger.log(`Sending ReceiverVideoConstraints with ${JSON.stringify(constraints)}`);
272 242
         this._send({
273 243
             colibriClass: 'ReceiverVideoConstraints',
@@ -276,21 +246,7 @@ export default class BridgeChannel {
276 246
     }
277 247
 
278 248
     /**
279
-     * Sends a 'VideoTypeMessage' message via the bridge channel.
280
-     *
281
-     * @param {string} videoType 'camera', 'desktop' or 'none'.
282
-     * @deprecated to be replaced with sendSourceVideoTypeMessage
283
-     */
284
-    sendVideoTypeMessage(videoType) {
285
-        logger.debug(`Sending VideoTypeMessage with video type as ${videoType}`);
286
-        this._send({
287
-            colibriClass: 'VideoTypeMessage',
288
-            videoType
289
-        });
290
-    }
291
-
292
-    /**
293
-     * Sends a 'VideoTypeMessage' message via the bridge channel.
249
+     * Sends a 'SourceVideoTypeMessage' message via the bridge channel.
294 250
      *
295 251
      * @param {BridgeVideoType} videoType - the video type.
296 252
      * @param {SourceName} sourceName - the source name of the video track.
@@ -377,15 +333,6 @@ export default class BridgeChannel {
377 333
 
378 334
                 break;
379 335
             }
380
-            case 'SenderVideoConstraints': {
381
-                const videoConstraints = obj.videoConstraints;
382
-
383
-                if (videoConstraints) {
384
-                    logger.info(`SenderVideoConstraints: ${JSON.stringify(videoConstraints)}`);
385
-                    emitter.emit(RTCEvents.SENDER_VIDEO_CONSTRAINTS_CHANGED, videoConstraints);
386
-                }
387
-                break;
388
-            }
389 336
             case 'SenderSourceConstraints': {
390 337
                 if (typeof obj.sourceName === 'string' && typeof obj.maxHeight === 'number') {
391 338
                     logger.info(`SenderSourceConstraints: ${obj.sourceName} - ${obj.maxHeight}`);

+ 4
- 108
modules/RTC/RTC.js View File

@@ -1,7 +1,6 @@
1 1
 import { getLogger } from '@jitsi/logger';
2 2
 
3 3
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
4
-import BridgeVideoType from '../../service/RTC/BridgeVideoType';
5 4
 import { MediaType } from '../../service/RTC/MediaType';
6 5
 import RTCEvents from '../../service/RTC/RTCEvents';
7 6
 import browser from '../browser';
@@ -116,14 +115,6 @@ export default class RTC extends Listenable {
116 115
          */
117 116
         this._lastN = undefined;
118 117
 
119
-        /**
120
-         * Defines the last N endpoints list. It can be null or an array once
121
-         * initialised with a channel last N event.
122
-         * @type {Array<string>|null}
123
-         * @private
124
-         */
125
-        this._lastNEndpoints = null;
126
-
127 118
         /**
128 119
          * Defines the forwarded sources list. It can be null or an array once initialised with a channel forwarded
129 120
          * sources event.
@@ -133,37 +124,11 @@ export default class RTC extends Listenable {
133 124
          */
134 125
         this._forwardedSources = null;
135 126
 
136
-        /**
137
-         * The number representing the maximum video height the local client
138
-         * should receive from the bridge.
139
-         *
140
-         * @type {number|undefined}
141
-         * @private
142
-         */
143
-        this._maxFrameHeight = undefined;
144
-
145
-        /**
146
-         * The endpoint IDs of currently selected participants.
147
-         *
148
-         * @type {Array}
149
-         * @private
150
-         */
151
-        this._selectedEndpoints = null;
152
-
153 127
         // The forwarded sources change listener.
154 128
         this._forwardedSourcesChangeListener = this._onForwardedSourcesChanged.bind(this);
155 129
 
156 130
         this._onDeviceListChanged = this._onDeviceListChanged.bind(this);
157
-        this._updateAudioOutputForAudioTracks
158
-            = this._updateAudioOutputForAudioTracks.bind(this);
159
-
160
-        /**
161
-         * The default video type assumed by the bridge.
162
-         * @deprecated this will go away with multiple streams support
163
-         * @type {BridgeVideoType}
164
-         * @private
165
-         */
166
-        this._videoType = BridgeVideoType.NONE;
131
+        this._updateAudioOutputForAudioTracks = this._updateAudioOutputForAudioTracks.bind(this);
167 132
 
168 133
         // Switch audio output device on all remote audio tracks. Local audio
169 134
         // tracks handle this event by themselves.
@@ -240,25 +205,11 @@ export default class RTC extends Listenable {
240 205
             // simulcast, we want the notification to trigger even if userJid is undefined, or null.
241 206
             if (this._receiverVideoConstraints) {
242 207
                 try {
243
-                    this._channel.sendNewReceiverVideoConstraintsMessage(this._receiverVideoConstraints);
208
+                    this._channel.sendReceiverVideoConstraintsMessage(this._receiverVideoConstraints);
244 209
                 } catch (error) {
245 210
                     logError(error, 'ReceiverVideoConstraints', this._receiverVideoConstraints);
246 211
                 }
247 212
             }
248
-            if (this._selectedEndpoints) {
249
-                try {
250
-                    this._channel.sendSelectedEndpointsMessage(this._selectedEndpoints);
251
-                } catch (error) {
252
-                    logError(error, 'SelectedEndpointsChangedEvent', this._selectedEndpoints);
253
-                }
254
-            }
255
-            if (typeof this._maxFrameHeight !== 'undefined') {
256
-                try {
257
-                    this._channel.sendReceiverVideoConstraintMessage(this._maxFrameHeight);
258
-                } catch (error) {
259
-                    logError(error, 'ReceiverVideoConstraint', this._maxFrameHeight);
260
-                }
261
-            }
262 213
             if (typeof this._lastN !== 'undefined' && this._lastN !== -1) {
263 214
                 try {
264 215
                     this._channel.sendSetLastNMessage(this._lastN);
@@ -348,45 +299,11 @@ export default class RTC extends Listenable {
348 299
      * is established.
349 300
      * @param {*} constraints
350 301
      */
351
-    setNewReceiverVideoConstraints(constraints) {
302
+    setReceiverVideoConstraints(constraints) {
352 303
         this._receiverVideoConstraints = constraints;
353 304
 
354 305
         if (this._channel && this._channel.isOpen()) {
355
-            this._channel.sendNewReceiverVideoConstraintsMessage(constraints);
356
-        }
357
-    }
358
-
359
-    /**
360
-     * Sets the maximum video size the local participant should receive from
361
-     * remote participants. Will cache the value and send it through the channel
362
-     * once it is created.
363
-     *
364
-     * @param {number} maxFrameHeightPixels the maximum frame height, in pixels,
365
-     * this receiver is willing to receive.
366
-     * @returns {void}
367
-     */
368
-    setReceiverVideoConstraint(maxFrameHeight) {
369
-        this._maxFrameHeight = maxFrameHeight;
370
-
371
-        if (this._channel && this._channel.isOpen()) {
372
-            this._channel.sendReceiverVideoConstraintMessage(maxFrameHeight);
373
-        }
374
-    }
375
-
376
-    /**
377
-     * Sets the video type and availability for the local video source.
378
-     *
379
-     * @param {string} videoType 'camera' for camera, 'desktop' for screenshare and
380
-     * 'none' for when local video source is muted or removed from the peerconnection.
381
-     * @returns {void}
382
-     */
383
-    setVideoType(videoType) {
384
-        if (this._videoType !== videoType) {
385
-            this._videoType = videoType;
386
-
387
-            if (this._channel && this._channel.isOpen()) {
388
-                this._channel.sendVideoTypeMessage(videoType);
389
-            }
306
+            this._channel.sendReceiverVideoConstraintsMessage(constraints);
390 307
         }
391 308
     }
392 309
 
@@ -401,25 +318,6 @@ export default class RTC extends Listenable {
401 318
         }
402 319
     }
403 320
 
404
-    /**
405
-     * Elects the participants with the given ids to be the selected
406
-     * participants in order to always receive video for this participant (even
407
-     * when last n is enabled). If there is no channel we store it and send it
408
-     * through the channel once it is created.
409
-     *
410
-     * @param {Array<string>} ids - The user ids.
411
-     * @throws NetworkError or InvalidStateError or Error if the operation
412
-     * fails.
413
-     * @returns {void}
414
-     */
415
-    selectEndpoints(ids) {
416
-        this._selectedEndpoints = ids;
417
-
418
-        if (this._channel && this._channel.isOpen()) {
419
-            this._channel.sendSelectedEndpointsMessage(ids);
420
-        }
421
-    }
422
-
423 321
     /**
424 322
      *
425 323
      * @param eventType
@@ -556,7 +454,6 @@ export default class RTC extends Listenable {
556 454
     getLocalVideoTrack() {
557 455
         const localVideo = this.getLocalTracks(MediaType.VIDEO);
558 456
 
559
-
560 457
         return localVideo.length ? localVideo[0] : undefined;
561 458
     }
562 459
 
@@ -575,7 +472,6 @@ export default class RTC extends Listenable {
575 472
     getLocalAudioTrack() {
576 473
         const localAudio = this.getLocalTracks(MediaType.AUDIO);
577 474
 
578
-
579 475
         return localAudio.length ? localAudio[0] : undefined;
580 476
     }
581 477
 

+ 6
- 6
modules/qualitycontrol/ReceiveVideoController.js View File

@@ -194,7 +194,7 @@ export default class ReceiveVideoController {
194 194
             this._receiverVideoConstraints = new ReceiverVideoConstraints();
195 195
             const lastNUpdated = this._receiverVideoConstraints.updateLastN(this._lastN);
196 196
 
197
-            lastNUpdated && this._rtc.setNewReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
197
+            lastNUpdated && this._rtc.setReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
198 198
         } else {
199 199
             this._rtc.setLastN(this._lastN);
200 200
         }
@@ -237,7 +237,7 @@ export default class ReceiveVideoController {
237 237
             mediaSession.setReceiverVideoConstraint(this._maxFrameHeight, this._sourceReceiverConstraints);
238 238
         } else {
239 239
             this._receiverVideoConstraints.updateReceiveResolution(this._maxFrameHeight);
240
-            this._rtc.setNewReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
240
+            this._rtc.setReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
241 241
         }
242 242
     }
243 243
 
@@ -270,7 +270,7 @@ export default class ReceiveVideoController {
270 270
 
271 271
             // Send bridge message only when the constraints change.
272 272
             if (!isEqual(newConstraints, oldConstraints)) {
273
-                this._rtc.setNewReceiverVideoConstraints(newConstraints);
273
+                this._rtc.setReceiverVideoConstraints(newConstraints);
274 274
             }
275 275
 
276 276
             return;
@@ -293,7 +293,7 @@ export default class ReceiveVideoController {
293 293
                 const lastNUpdated = this._receiverVideoConstraints.updateLastN(value);
294 294
 
295 295
                 // Send out the message on the bridge channel if lastN was updated.
296
-                lastNUpdated && this._rtc.setNewReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
296
+                lastNUpdated && this._rtc.setReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
297 297
 
298 298
                 return;
299 299
             }
@@ -319,7 +319,7 @@ export default class ReceiveVideoController {
319 319
                 const resolutionUpdated = this._receiverVideoConstraints.updateReceiveResolution(maxFrameHeight);
320 320
 
321 321
                 resolutionUpdated
322
-                    && this._rtc.setNewReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
322
+                    && this._rtc.setReceiverVideoConstraints(this._receiverVideoConstraints.constraints);
323 323
             }
324 324
         }
325 325
     }
@@ -345,7 +345,7 @@ export default class ReceiveVideoController {
345 345
         if (constraintsChanged) {
346 346
             this._lastN = constraints.lastN ?? this._lastN;
347 347
             this._selectedEndpoints = constraints.selectedEndpoints ?? this._selectedEndpoints;
348
-            this._rtc.setNewReceiverVideoConstraints(constraints);
348
+            this._rtc.setReceiverVideoConstraints(constraints);
349 349
 
350 350
             const p2pSession = this._conference.getMediaSessions().find(session => session.isP2P);
351 351
 

+ 3
- 4
modules/qualitycontrol/ReceiveVideoController.spec.js View File

@@ -40,8 +40,7 @@ export class MockRTC extends Listenable {
40 40
     }
41 41
 
42 42
     // eslint-disable-next-line no-empty-function
43
-    setNewReceiverVideoConstraints() {
44
-
43
+    setReceiverVideoConstraints() {
45 44
     }
46 45
 }
47 46
 
@@ -62,8 +61,8 @@ describe('ReceiveVideoController', () => {
62 61
             FeatureFlags.init({ });
63 62
         });
64 63
 
65
-        it('should call setNewReceiverVideoConstraints with the source names format.', () => {
66
-            const rtcSpy = spyOn(rtc, 'setNewReceiverVideoConstraints');
64
+        it('should call setReceiverVideoConstraints with the source names format.', () => {
65
+            const rtcSpy = spyOn(rtc, 'setReceiverVideoConstraints');
67 66
             const constraints = {
68 67
                 onStageSources: [ 'A_camera_1', 'B_screen_2', 'C_camera_1' ],
69 68
                 selectedSources: [ 'A_camera_1' ]

+ 0
- 2
types/hand-crafted/JitsiConference.d.ts View File

@@ -70,8 +70,6 @@ export default class JitsiConference {
70 70
   isModerator: () => boolean | null;
71 71
   lock: ( password: string ) => Promise<unknown | Error>;
72 72
   unlock: () => Promise<unknown | Error>;
73
-  selectParticipant: ( participantId: string ) => void;
74
-  selectParticipants: ( participantIds: string[] ) => void;
75 73
   getLastN: () => number;
76 74
   setLastN: ( lastN: number ) => void;
77 75
   getParticipants: () => JitsiParticipant[];

+ 3
- 4
types/hand-crafted/modules/RTC/BridgeChannel.d.ts View File

@@ -1,3 +1,5 @@
1
+import { ReceiverVideoConstraints } from "../qualitycontrol/ReceiveVideoController";
2
+
1 3
 export default class BridgeChannel {
2 4
   constructor( peerconnection: unknown, wsUrl: unknown, emitter: unknown ); // TODO:
3 5
   mode: () => null | "datachannel" | "websocket";
@@ -5,9 +7,6 @@ export default class BridgeChannel {
5 7
   isOpen: () => boolean;
6 8
   sendMessage: ( to: string, payload: unknown ) => void; // TODO:
7 9
   sendSetLastNMessage: ( value: number ) => void;
8
-  sendSelectedEndpointsMessage: ( endpointIds: string[] ) => void;
9
-  sendReceiverVideoConstraintMessage: ( maxFrameHeightPixels: number ) => void;
10 10
   sendEndpointStatsMessage: ( payload: unknown ) => void; // TODO:
11
-  sendNewReceiverVideoConstraintsMessage: ( constraints: ReceiverVideoConstraints ) => void; // TODO:
12
-  sendVideoTypeMessage: ( videoType: string ) => void;
11
+  sendReceiverVideoConstraintsMessage: ( constraints: ReceiverVideoConstraints ) => void;
13 12
 }

+ 1
- 4
types/hand-crafted/modules/RTC/RTC.d.ts View File

@@ -12,8 +12,6 @@ export default class RTC extends Listenable {
12 12
   initializeBridgeChannel: ( perrconnection: RTCPeerConnection, wsUrl: string ) => void;
13 13
   onCallEnded: () => void;
14 14
   setDesktopSharingFrameRate: (maxFps: number) => void;
15
-  setReceiverVideoConstraint: ( maxFrameHeight: number ) => void;
16
-  selectEndpoints: ( ids: string[] ) => void;
17 15
   static addListener: ( eventType: string, listener: unknown ) => void; // TODO: this should be typed to an enum of eventTypes with appropriate definition for the listeners
18 16
   static removeListener: ( eventType: string, listener: unknown ) => void; // TODO: this should be typed to an enum of eventTypes with appropriate definition for the listeners
19 17
   static init: ( options: unknown ) => unknown; // TODO:
@@ -44,8 +42,7 @@ export default class RTC extends Listenable {
44 42
   sendChannelMessage: ( to: string, payload: unknown ) => void; // TODO:
45 43
   setLastN: ( value: number ) => void;
46 44
   isInForwardedSources: ( sourceName: string ) => boolean;
47
-  setNewReceiverVideoConstraints: ( constraints: unknown ) => void; // TODO:
48
-  setVideoType: ( videoType: string ) => void;
45
+  setReceiverVideoConstraints: ( constraints: unknown ) => void; // TODO:
49 46
   setVideoMute: ( value: unknown ) => Promise<unknown>; // TODO:
50 47
   arePermissionsGrantedForAvailableDevices: () => boolean;
51 48
   sendEndpointStatsMessage: ( payload: unknown ) => void; // TODO:

Loading…
Cancel
Save