Make FEC and PLP non-default (#1372)

I considered it might be useful to have something exposed that allows the end-user to set these if they want, but our current code doesn't allow for that. It'll remain an internal feature for the time being.
This commit is contained in:
aemino
2017-04-11 21:30:48 -07:00
committed by Crawl
parent 5dea21ba80
commit 39f7dc018a
2 changed files with 16 additions and 11 deletions

View File

@@ -1,20 +1,25 @@
class BaseOpus {
constructor(player) {
this.player = player;
/**
* @param {Object} [options] The options to apply to the Opus engine
* @param {boolean} [options.fec] Whether to enable forward error correction (defaults to false)
* @param {number} [options.plp] The expected packet loss percentage (0-1 inclusive, defaults to 0)
*/
constructor(options = {}) {
this.ctl = {
FEC: 4012,
PLP: 4014,
};
this.options = options;
}
init() {
try {
// Enable FEC (forward error correction)
this.setFEC(true);
// Set FEC (forward error correction)
if (this.options.fec) this.setFEC(this.options.fec);
// Set PLP (expected packet loss percentage) to 15%
this.setPLP(0.15);
// Set PLP (expected packet loss percentage)
if (this.options.plp) this.setPLP(this.options.plp);
} catch (err) {
// Opus engine likely has no support for libopus CTL
}