mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
Fix setFEC bug and use bitrateEditable in setBitrate
This commit is contained in:
@@ -151,7 +151,7 @@ class StreamDispatcher extends Writable {
|
|||||||
* @returns {boolean} true if the bitrate has been successfully changed.
|
* @returns {boolean} true if the bitrate has been successfully changed.
|
||||||
*/
|
*/
|
||||||
setBitrate(value) {
|
setBitrate(value) {
|
||||||
if (!value || !this.streams.opus || !this.streams.opus.setBitrate) return false;
|
if (!value || !this.bitrateEditable) return false;
|
||||||
const bitrate = value === 'auto' ? this.player.voiceConnection.channel.bitrate : value;
|
const bitrate = value === 'auto' ? this.player.voiceConnection.channel.bitrate : value;
|
||||||
this.streams.opus.setBitrate(bitrate * 1000);
|
this.streams.opus.setBitrate(bitrate * 1000);
|
||||||
return true;
|
return true;
|
||||||
@@ -175,7 +175,7 @@ class StreamDispatcher extends Writable {
|
|||||||
*/
|
*/
|
||||||
setFEC(enabled) {
|
setFEC(enabled) {
|
||||||
if (!this.bitrateEditable) return false;
|
if (!this.bitrateEditable) return false;
|
||||||
this.streams.opus.setPLP(enabled);
|
this.streams.opus.setFEC(enabled);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user