Преглед на файлове

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
 let room;
130
 let room;
131
 let connection;
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
  * Logic to open a desktop picker put on the window global for
143
  * Logic to open a desktop picker put on the window global for
135
  * lib-jitsi-meet to detect and invoke
144
  * lib-jitsi-meet to detect and invoke
447
 
456
 
448
     /**
457
     /**
449
      * The local presenter video track (if any).
458
      * The local presenter video track (if any).
459
+     * @type {JitsiLocalTrack|null}
450
      */
460
      */
451
     localPresenterVideo: null,
461
     localPresenterVideo: null,
452
 
462
 
858
         }
868
         }
859
 
869
 
860
         if (this.isSharingScreen) {
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
         // If not ready to modify track's state yet adjust the base/media
877
         // If not ready to modify track's state yet adjust the base/media
1636
             APP.store.dispatch(notifyCameraError(error));
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
         if (!this.localPresenterVideo && !mute) {
1661
         if (!this.localPresenterVideo && !mute) {
1640
             // create a new presenter track and apply the presenter effect.
1662
             // create a new presenter track and apply the presenter effect.
1641
             let { height } = this.localVideo.track.getSettings();
1663
             let { height } = this.localVideo.track.getSettings();

Loading…
Отказ
Запис