aijingsun6 / nspeex Goto Github PK
View Code? Open in Web Editor NEWNSpeex - Speex for .Net(http://nspeex.codeplex.com/)
NSpeex - Speex for .Net(http://nspeex.codeplex.com/)
Hi,
i'm trying to write here because i have an issue that have been stopping the dev of my app for weeks.
I'm writing a realtime voice chat application, with a centralized server (dedicated) architecture, using C# (dedicated server is a .net core app while for the client i'm using C# to script the game engine Unity3D).
For the encoding/decoding part i'm using NSpeex.
Basically, it works like this:
Client records from the microphone/soundcard PCM samples and put them in chunks of X samples each.
These chunks are then passed to the encoder, when one chuck has been encoded (async on another thread) a callback is received and the compressed [] is put in a queue for the network
delivery. Each chunk is 554 bytes.
The dedicated server receives the data and broadcasts to other clients (TCP stream).
The client receives the chunk and makes the opposite: every byte received is put in a List which is the first buffer.
When i've got enough bytes to start decoding (554 bytes), the segment is taken and sent to the decoder.
Once it has been decoded, i take the resulting PCM samples and pass them to the playing buffer which sends them to the soundcard when i have enough data to start playing.
Now, it works GOOD! Most of the time...
but from time to time, out of the blue and totally random, the decoder (and only the decoder) throws an Exception like: "more than two sidebands found" or "invalid sideband mode" and
simply stops working, making my app unable to continue working.
From my understanding of the Speex library, this means that the decoder doesn't find the bits where it expect them to be... but WHY it happens only from time to time?!
I've seen it happen when i feed the encoder/decoder with segments of the wrong size but in this case i've debugged the hell out of it and i'm sure i'm passing always the same data amount.
..could this be a network related problem? I don't think so, i'm using reliable TCP and i'm sure every packet reachs the destination and in the correct order.
What could it be? How should i proceed to debug the problem further?
Thanks in advance,
Davide
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.