mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
Add setPLP and setFEC
This commit is contained in:
@@ -120,7 +120,7 @@ class StreamDispatcher extends Writable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the bitrate of the current Opus encoder.
|
* Set the bitrate of the current Opus encoder if using a compatible Opus stream.
|
||||||
* @param {number} value New bitrate, in kbps
|
* @param {number} value New bitrate, in kbps
|
||||||
* If set to 'auto', the voice channel's bitrate will be used
|
* If set to 'auto', the voice channel's bitrate will be used
|
||||||
* @returns {boolean} true if the bitrate has been successfully changed.
|
* @returns {boolean} true if the bitrate has been successfully changed.
|
||||||
@@ -132,6 +132,28 @@ class StreamDispatcher extends Writable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the expected packet loss percentage if using a compatible Opus stream.
|
||||||
|
* @param {number} value between 0 and 1
|
||||||
|
* @returns {boolean} Returns true if it was successfully set.
|
||||||
|
*/
|
||||||
|
setPLP(value) {
|
||||||
|
if (!this.bitrateEditable) return false;
|
||||||
|
this.streams.opus.setPLP(value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or disables forward error correction if using a compatible Opus stream.
|
||||||
|
* @param {boolean} enabled true to enable
|
||||||
|
* @returns {boolean} Returns true if it was successfully set.
|
||||||
|
*/
|
||||||
|
setFEC(enabled) {
|
||||||
|
if (!this.bitrateEditable) return false;
|
||||||
|
this.streams.opus.setPLP(enabled);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
_step(done) {
|
_step(done) {
|
||||||
if (this.pausedSince) {
|
if (this.pausedSince) {
|
||||||
this._writeCallback = done;
|
this._writeCallback = done;
|
||||||
|
|||||||
Reference in New Issue
Block a user