mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
improve broadcasting performance
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user