Переглянути джерело

fix(conference.js): prevent multiple GUM calls on presenter unmute

Chain _mutePresenterVideo async calls in order to prevent calling GUM
multiple times.
master
paweldomas 5 роки тому
джерело
коміт
f810483ff6
1 змінених файлів з 23 додано та 1 видалено
  1. 23
    1
      conference.js

+ 23
- 1
conference.js Переглянути файл

@@ -130,6 +130,15 @@ const eventEmitter = new EventEmitter();
130 130
 let room;
131 131
 let connection;
132 132
 
133
+/**
134
+ * This promise is used for chaining mutePresenterVideo calls in order to avoid  calling GUM multiple times if it takes
135
+ * a while to finish.
136
+ *
137
+ * @type {Promise<void>}
138
+ * @private
139
+ */
140
+let _prevMutePresenterVideo = Promise.resolve();
141
+
133 142
 /*
134 143
  * Logic to open a desktop picker put on the window global for
135 144
  * lib-jitsi-meet to detect and invoke
@@ -447,6 +456,7 @@ export default {
447 456
 
448 457
     /**
449 458
      * The local presenter video track (if any).
459
+     * @type {JitsiLocalTrack|null}
450 460
      */
451 461
     localPresenterVideo: null,
452 462
 
@@ -858,7 +868,10 @@ export default {
858 868
         }
859 869
 
860 870
         if (this.isSharingScreen) {
861
-            return this._mutePresenterVideo(mute);
871
+            // Chain _mutePresenterVideo calls
872
+            _prevMutePresenterVideo = _prevMutePresenterVideo.then(() => this._mutePresenterVideo(mute));
873
+
874
+            return;
862 875
         }
863 876
 
864 877
         // If not ready to modify track's state yet adjust the base/media
@@ -1636,6 +1649,15 @@ export default {
1636 1649
             APP.store.dispatch(notifyCameraError(error));
1637 1650
         };
1638 1651
 
1652
+        // Check for NO-OP
1653
+        if (mute && (!this.localPresenterVideo || this.localPresenterVideo.isMuted())) {
1654
+
1655
+            return;
1656
+        } else if (!mute && this.localPresenterVideo && !this.localPresenterVideo.isMuted()) {
1657
+
1658
+            return;
1659
+        }
1660
+
1639 1661
         if (!this.localPresenterVideo && !mute) {
1640 1662
             // create a new presenter track and apply the presenter effect.
1641 1663
             let { height } = this.localVideo.track.getSettings();

Завантаження…
Відмінити
Зберегти