Comments (4)
Up, thanks for your answer, but can you provide a code example to solve the problem ?
from opus.
You need to make sure that the length of the argument to encoder.encode() is a multiple of 2.5ms. Since you are encoding with 16000 and two channels (!) that would be multiple of 1622.5 = 80 frames that is 160 bytes. A good normal window size is 20ms, so that would make you have the data buffer at 8*160 bytes exactly.
That said, then the implementation does not check for the return value of int compressedLength = opus_encode(this->encoder, pcm, frameSize, &(this->outOpus[0]), MAX_PACKET_SIZE);
. If the data buffer is not exactly aligned it returns -1 which in unsigned form is 0x100000000 and that generates the error as the code tries to allocate a buffer right after this call with the compressedLength.
from opus.
im currently not working on that project anymore but i will need it in the near future, so im thankful for your answer! i will close this issue when i get to try this!
from opus.
You need to make sure that the length of the argument to encoder.encode() is a multiple of 2.5ms. Since you are encoding with 16000 and two channels (!) that would be multiple of 16_2_2.5 = 80 frames that is 160 bytes. A good normal window size is 20ms, so that would make you have the data buffer at 8*160 bytes exactly.
That said, then the implementation does not check for the return value of
int compressedLength = opus_encode(this->encoder, pcm, frameSize, &(this->outOpus[0]), MAX_PACKET_SIZE);
. If the data buffer is not exactly aligned it returns -1 which in unsigned form is 0x100000000 and that generates the error as the code tries to allocate a buffer right after this call with the compressedLength.
and how i can fix it?
from opus.
Related Issues (20)
- Can't install on CentOs HOT 1
- Can't install opus on my M1 Mac
- Support for Raspberry pi 4
- Not installing in mac m1 (macOs 11.2)
- [SECURITY] DoS in @discordjs/opus due to invalid encoders/buffers (CVE-2022-25345) HOT 1
- Can not install @discordjs/opus in build/local environment HOT 6
- Where 0.5.0 version? My project broken because it not exist anymore HOT 1
- Add JSDoc to decode method HOT 1
- question: NPM wont install ubuntu
- Json decoder error HOT 2
- I can't download opus on djs 14 HOT 1
- Unable to NPM Install HOT 1
- dyld[53422]: missing symbol called on `decode`. HOT 5
- unable to npm install macOS HOT 8
- Add Glibc 2.36 in the precompiled binaries
- @discordjs/opus does not support nodejs versions > v18.18.2 HOT 13
- Cannot decode opus that came from openAI (Data corrupted) HOT 1
- NPM Install Failure 404 HOT 2
- [Bun] Cannot find module "@discordjs/opus/prebuild/node-v115-napi-v3-linux-x64-glibc-2.29/opus.node"
- Support for Node 20 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opus.