mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
improve broadcasting performance
This commit is contained in:
parent
fb1d0a3e74
commit
3109accf87
2 changed files with 8 additions and 5 deletions
|
|
@ -169,11 +169,13 @@ class VoiceBroadcast extends EventEmitter {
|
|||
buffer = this.applyVolume(buffer);
|
||||
|
||||
for (const x of this.dispatchers.entries()) {
|
||||
const [volume, container] = x;
|
||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||
for (const dispatcher of container.values()) {
|
||||
setImmediate(() => dispatcher.process(buffer, true, opusPacket));
|
||||
}
|
||||
setImmediate(() => {
|
||||
const [volume, container] = x;
|
||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||
for (const dispatcher of container.values()) {
|
||||
setImmediate(() => dispatcher.process(buffer, true, opusPacket));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ class StreamDispatcher extends EventEmitter {
|
|||
}
|
||||
|
||||
setSpeaking(value) {
|
||||
if (this.speaking === value) return;
|
||||
this.speaking = value;
|
||||
/**
|
||||
* Emitted when the dispatcher starts/stops speaking
|
||||
|
|
|
|||
Loading…
Reference in a new issue