Browse Source

fix(RTC): Remove stream effect before disposing the track.

Remove the effect instead of stopping it so that the original stream is restored on both the local track and on the peerconnection. Fixes issues when a stream with effect applied is replaced on the pc after it is muted, also fixes https://github.com/jitsi/lib-jitsi-meet/issues/1537.
dev1
Jaya Allamsetty 4 years ago
parent
commit
e2333c6c2a
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      modules/RTC/JitsiLocalTrack.js

+ 8
- 4
modules/RTC/JitsiLocalTrack.js View File

352
             this._streamEffect.stopEffect();
352
             this._streamEffect.stopEffect();
353
             this._setStream(this._originalStream);
353
             this._setStream(this._originalStream);
354
             this._originalStream = null;
354
             this._originalStream = null;
355
-            this.track = this.stream.getTracks()[0];
355
+            this.track = this.stream ? this.stream.getTracks()[0] : null;
356
         }
356
         }
357
     }
357
     }
358
 
358
 
684
      * @returns {Promise}
684
      * @returns {Promise}
685
      */
685
      */
686
     dispose() {
686
     dispose() {
687
-        this._switchStreamEffect();
688
-
689
         let promise = Promise.resolve();
687
         let promise = Promise.resolve();
690
 
688
 
689
+        // Remove the effect instead of stopping it so that the original stream is restored
690
+        // on both the local track and on the peerconnection.
691
+        if (this._streamEffect) {
692
+            promise = this.setEffect();
693
+        }
694
+
691
         if (this.conference) {
695
         if (this.conference) {
692
-            promise = this.conference.removeTrack(this);
696
+            promise = promise.then(() => this.conference.removeTrack(this));
693
         }
697
         }
694
 
698
 
695
         if (this.stream) {
699
         if (this.stream) {

Loading…
Cancel
Save