Add opus sanity check

This commit is contained in:
meew0
2015-12-27 17:25:04 +01:00
parent b927b223bb
commit 0921484ef6
2 changed files with 24 additions and 0 deletions

View File

@@ -189,6 +189,14 @@ export default class VoiceConnection extends EventEmitter {
self.client.emit("debug", "Tried to use node-opus, but opus not available - install it!");
return;
}
if (!self.encoder.sanityCheck()) {
self.playing = false;
self.emit("error", "Opus sanity check failed!");
self.client.emit("debug", "Opus sanity check failed - opus is installed but not correctly! Please reinstall opus and make sure it's installed correctly.");
return;
}
var buffer = self.encoder.opusBuffer(rawbuffer);
var packet = new VoicePacket(buffer, sequence, timestamp, self.vWSData.ssrc);
return self.sendPacket(packet, callback);