mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-16 11:28:18 +00:00
Add FEC and PLP support for Opus encoding (#1264)
* Add FEC and PLP support for Opus encoding * Silently fail if the Opus engine doesn't support CTL * Fixed inversed max/min functions
This commit is contained in:
@@ -11,6 +11,15 @@ class NodeOpusEngine extends OpusEngine {
|
||||
throw err;
|
||||
}
|
||||
this.encoder = new opus.OpusEncoder(48000, 2);
|
||||
super.init();
|
||||
}
|
||||
|
||||
setFEC(enabled) {
|
||||
this.encoder.applyEncoderCTL(this.ctl.FEC, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
setPLP(percent) {
|
||||
this.encoder.applyEncoderCTL(this.ctl.PLP, Math.min(100, Math.max(0, percent * 100)));
|
||||
}
|
||||
|
||||
encode(buffer) {
|
||||
|
||||
Reference in New Issue
Block a user