소스 검색

feat(ReceiveVideoController): Add the ability to send constraints in the new format.

Add the ability to send the bridge messages for the receiver video constraints in the new format directly.
dev1
Jaya Allamsetty 4 년 전
부모
커밋
d1505231a5
2개의 변경된 파일54개의 추가작업 그리고 0개의 파일을 삭제
  1. 21
    0
      JitsiConference.js
  2. 33
    0
      modules/qualitycontrol/ReceiveVideoController.js

+ 21
- 0
JitsiConference.js 파일 보기

3369
     return this.speakerStatsCollector.getStats();
3369
     return this.speakerStatsCollector.getStats();
3370
 };
3370
 };
3371
 
3371
 
3372
+/**
3373
+ * Sets the constraints for the video that is requested from the bridge.
3374
+ *
3375
+ * @param {Object} videoConstraints The constraints which are specified in the
3376
+ * following format. The message updates the fields that are present and leaves the
3377
+ * rest unchanged on the bridge. Therefore, any field that is not applicable anymore
3378
+ * should be cleared by passing an empty object or list (whatever is applicable).
3379
+ * {
3380
+ *      'lastN': 20,
3381
+ *      'selectedEndpoints': ['A', 'B', 'C'],
3382
+ *      'onStageEndpoints': ['A'],
3383
+ *      'defaultConstraints': { 'maxHeight': 180 },
3384
+ *      'constraints': {
3385
+ *          'A': { 'maxHeight': 720 }
3386
+ *      }
3387
+ * }
3388
+ */
3389
+JitsiConference.prototype.setReceiverConstraints = function(videoConstraints) {
3390
+    this.receiveVideoController.setReceiverConstraints(videoConstraints);
3391
+};
3392
+
3372
 /**
3393
 /**
3373
  * Sets the maximum video size the local participant should receive from remote
3394
  * Sets the maximum video size the local participant should receive from remote
3374
  * participants.
3395
  * participants.

+ 33
- 0
modules/qualitycontrol/ReceiveVideoController.js 파일 보기

1
 import { getLogger } from 'jitsi-meet-logger';
1
 import { getLogger } from 'jitsi-meet-logger';
2
+import isEqual from 'lodash.isequal';
2
 
3
 
3
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
4
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
4
 
5
 
123
         return changed;
124
         return changed;
124
     }
125
     }
125
 
126
 
127
+    /**
128
+     * Updates the receiver constraints sent to the bridge.
129
+     *
130
+     * @param {Object} videoConstraints
131
+     * @returns {boolean} Returns true if the the value has been updated, false otherwise.
132
+     */
133
+    updateReceiverVideoConstraints(videoConstraints) {
134
+        const changed = !isEqual(this._receiverVideoConstraints, videoConstraints);
135
+
136
+        if (changed) {
137
+            this._receiverVideoConstraints = videoConstraints;
138
+            logger.debug(`Updating ReceiverVideoConstraints ${JSON.stringify(videoConstraints)}`);
139
+        }
140
+
141
+        return changed;
142
+    }
143
+
126
     /**
144
     /**
127
      * Updates the list of selected endpoints.
145
      * Updates the list of selected endpoints.
128
      *
146
      *
257
             }
275
             }
258
         }
276
         }
259
     }
277
     }
278
+
279
+    /**
280
+     * Sets the receiver constraints for the conference.
281
+     *
282
+     * @param {Object} constraints The video constraints.
283
+     */
284
+    setReceiverConstraints(constraints) {
285
+        if (!this._receiverVideoConstraints) {
286
+            this._receiverVideoConstraints = new ReceiverVideoConstraints();
287
+        }
288
+
289
+        const constraintsChanged = this._receiverVideoConstraints.updateReceiverVideoConstraints(constraints);
290
+
291
+        constraintsChanged && this._rtc.setNewReceiverVideoConstraints(constraints);
292
+    }
260
 }
293
 }

Loading…
취소
저장