voice: update prism and fix framesize to work for opusscript

This commit is contained in:
Amish Shah
2018-03-05 19:30:18 +00:00
parent b637c9c220
commit e263063ba6
3 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@
"unpkg": "./webpack/discord.min.js",
"dependencies": {
"pako": "^1.0.0",
"prism-media": "hydrabolt/prism-media",
"prism-media": "^0.2.0",
"snekfetch": "^3.6.0",
"tweetnacl": "^1.0.0",
"ws": "^4.0.0"

View File

@@ -56,7 +56,7 @@ class BasePlayer extends EventEmitter {
playPCMStream(stream, options, streams = {}) {
this.destroyDispatcher();
const opus = streams.opus = new prism.opus.Encoder({ channels: 2, rate: 48000, frameSize: 1920 });
const opus = streams.opus = new prism.opus.Encoder({ channels: 2, rate: 48000, frameSize: 960 });
if (options && options.volume === false) {
stream.pipe(opus);
return this.playOpusStream(opus, options, streams);

View File

@@ -44,7 +44,7 @@ class VoiceReceiver extends EventEmitter {
if (!user) throw new Error('VOICE_USER_MISSING');
const stream = this.packets.makeStream(user.id);
if (mode === 'pcm') {
const decoder = new prism.opus.Decoder({ channels: 2, rate: 48000, frameSize: 1920 });
const decoder = new prism.opus.Decoder({ channels: 2, rate: 48000, frameSize: 960 });
stream.pipe(decoder);
return decoder;
}