message: Fix speaker deallocation
diff: @@ -68,12 +68,20 @@ class ActiveSpeakerMultiplexer
  };
  //The listener for attached tracks end event
  this.onOutgoingTrackStopped = (outgoingTrack) => {
  - //Get transponder
  - const transponder = outgoingTrack.getTransponder();
  - //If it still has it
  - if (transponder)
  + //Find track from multiplex
  + for (const [multiplexId,multiplex] of this.multiplex)
  + {
  + //If same track
  + if (multiplex.track == outgoingTrack)
  + {
  //Remove from multiplexer
  - this.multiplexer.RemoveRTPStreamTransponder(transponder.transponder);
  + this.multiplexer.RemoveRTPStreamTransponder(multiplex.transponder);
  + //remove it
  + this.multiplex.delete(multiplexId);
  + //Done
  + break;
  + }
  + }
  };
  //Create native multiplexer
  @@ -164,6 +172,7 @@ class ActiveSpeakerMultiplexer
  //Generate a new id
  const id = this.maxId++;
  +
  //Store on maps
  this.ids.set(track,id);
  this.speakers.set(id,track);
  @@ -191,6 +200,8 @@ class ActiveSpeakerMultiplexer
  //Delete id
  this.ids.delete(track);
  + //Delete speaker
  + this.speakers.delete(id);
  //Get first source
  const source = track.encodings.values().next().value.source;
  @@ -265,20 +276,19 @@ class ActiveSpeakerMultiplexer
  //Remove outgoing track listener
  for (const [multiplexId,multiplex] of this.multiplex)
  - //Remove event
  - multiplex.outgoingTrack.off("stopped",this.onOutgoingTrackStopped);
  -
  - //Remove speaker track listener
  - for (const [speakerId,track] of this.speakers)
  {
  - //Signal dettached
  - track.detached();
  + //Remove from multiplexer
  + this.multiplexer.RemoveRTPStreamTransponder(multiplex.transponder.transponder);
  //Remove event
  - track.off("stopped",this.onTrackStopped);
  + multiplex.outgoingTrack.off("stopped",this.onOutgoingTrackStopped);
  }
  + //Cleare multiplexed
  + this.multiplex.clear();
  - //Stop multiplexed
  - this.multiplexer.Stop();
  + //Remove speakers
  + for (const [speakerId,track] of this.speakers)
  + //Remove it
  + this.removeSpeaker(track)
  /**
  * ActiveSpeakerMultiplexer stopped event
  @@ -290,6 +300,9 @@ class ActiveSpeakerMultiplexer
  */
  this.emitter.emit("stopped");
  + //Stop multiplexer
  + this.multiplexer.Stop();
  +
  //Remove native reference, so destructor is called on GC
  this.multiplexer = null;
  this.multiplex = null;
  