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:
aemino
2017-04-02 10:43:46 -07:00
committed by Crawl
parent 2ff1f3dcde
commit 8716702b59
3 changed files with 35 additions and 0 deletions

View File

@@ -1,6 +1,23 @@
class BaseOpus {
constructor(player) {
this.player = player;
this.ctl = {
FEC: 4012,
PLP: 4014,
};
}
init() {
try {
// enable FEC (forward error correction)
this.setFEC(true);
// set PLP (expected packet loss percentage) to 15%
this.setPLP(0.15);
} catch (err) {
// Opus engine likely has no support for libopus CTL
}
}
encode(buffer) {