Clean up a bunch of new voice stuff

This commit is contained in:
Schuyler Cebulskie
2016-10-25 20:26:57 -04:00
parent a04094f0ff
commit d1e9d15a1c
9 changed files with 57 additions and 76 deletions

View File

@@ -25,17 +25,20 @@ class VoiceReceiver extends EventEmitter {
this.queues = new Map();
this.pcmStreams = new Map();
this.opusStreams = new Map();
/**
* Whether or not this receiver has been destroyed.
* @type {boolean}
*/
this.destroyed = false;
/**
* The VoiceConnection that instantiated this
* @type {VoiceConnection}
*/
this.voiceConnection = connection;
this._listener = (msg => {
this._listener = msg => {
const ssrc = +msg.readUInt32BE(8).toString(10);
const user = this.voiceConnection.ssrcMap.get(ssrc);
if (!user) {
@@ -50,7 +53,7 @@ class VoiceReceiver extends EventEmitter {
}
this.handlePacket(msg, user);
}
}).bind(this);
};
this.voiceConnection.sockets.udp.socket.on('message', this._listener);
}