Audio bitrate support (#1439)

* Audio bitrate support

Note: not implemented for VoiceBroadcasts

* Fix default args, auto bitrate

* Late night typos are the best

* Changes bitrate to kbps for VoiceChannel stuff

* Add methods to manipulate bitrate while encoding
This commit is contained in:
aemino
2017-07-26 01:06:40 -07:00
committed by Crawl
parent 7eb9e65c41
commit 4342ed29a8
9 changed files with 97 additions and 58 deletions

View File

@@ -119,6 +119,16 @@ class StreamDispatcher extends VolumeInterface {
this.emit('speaking', value);
}
/**
* Set the bitrate of the current Opus encoder.
* @param {number} bitrate New bitrate, in kbps.
* If set to 'auto', the voice channel's bitrate will be used
*/
setBitrate(bitrate) {
this.player.setBitrate(bitrate);
}
sendBuffer(buffer, sequence, timestamp, opusPacket) {
opusPacket = opusPacket || this.player.opusEncoder.encode(buffer);
const packet = this.createPacket(sequence, timestamp, opusPacket);