mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
improve broadcasting performance
This commit is contained in:
@@ -169,11 +169,13 @@ class VoiceBroadcast extends EventEmitter {
|
|||||||
buffer = this.applyVolume(buffer);
|
buffer = this.applyVolume(buffer);
|
||||||
|
|
||||||
for (const x of this.dispatchers.entries()) {
|
for (const x of this.dispatchers.entries()) {
|
||||||
const [volume, container] = x;
|
setImmediate(() => {
|
||||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
const [volume, container] = x;
|
||||||
for (const dispatcher of container.values()) {
|
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||||
setImmediate(() => dispatcher.process(buffer, true, opusPacket));
|
for (const dispatcher of container.values()) {
|
||||||
}
|
setImmediate(() => dispatcher.process(buffer, true, opusPacket));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ class StreamDispatcher extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSpeaking(value) {
|
setSpeaking(value) {
|
||||||
|
if (this.speaking === value) return;
|
||||||
this.speaking = value;
|
this.speaking = value;
|
||||||
/**
|
/**
|
||||||
* Emitted when the dispatcher starts/stops speaking
|
* Emitted when the dispatcher starts/stops speaking
|
||||||
|
|||||||
Reference in New Issue
Block a user