SV: [Speex-dev] How to detect SpeexBits corruption

Tom Grandgent tgrand at
Thu Jan 25 06:24:09 PST 2007

You might not be doing anything wrong.  Speex is stateful and can 
get into a bad state sometimes.  It's happened to me too, but not 
recently.  And I've seen such bugs reported on this list and fixed.  
I suggest several approaches to solving the problem:

1) Try compiling Speex without compiler optimizations and see if the 
problem still occurs.  Most likely it will, but this is an essential 
sanity check.

2) Try to make the problem trivially reproducible for others so that 
the bug (if it exists) can be tracked down and fixed.  You must 
identify exactly which version of Speex you're using and provide 
sample data, code, and instructions so that someone else can 
reproduce the problem with minimal effort.

3) Try to be nice to Speex.  Don't feed the decoder corrupted data, 
out of order data, data with gaps, etc.  Put extra checks in your 
code/protocol to make sure you're decoding exactly the data that 
the encoder produced.  You might be surprised at the result.  Also 
keep in mind that the nature of the audio data itself may be 
triggering the problem, especially if it is unusual in some way.

Good luck,


jesus <jmorion at> wrote:
> thank you, i will explain it more detailed:
> I use libspeex in an activeX project compiled on Visual C++ 2003 
> (Windows XP).
> I have one array of SpeexBits and other of decoder states. The first 
> time a user speaks, i create and initialize the elements of those arrays 
> who correspond to his user_id. Next packets of this user are decoded 
> using those elements. The decoder instance is always the same for every 
> user packets.
> It works fine most time, but sometimes one user begins to sound like 
> voice hits and the others still sounds ok. At that point, if i destroy 
> his elements of the two arrays and re-create and initialize, it solves.
> OK, I will read speechenc/dec just one more time.
> Thank you.
> Jonas Tärnström wrote:
> > You're doing something wrong.
> > Read the documentation and check speechenc/dec just one more time.
> >
> > If that wouldn't help I'd suggest posting samples of your source code
> > and describe what platform/compiler/os you're using.
> >
> > //JT
> >
> >
> > -----Ursprungligt meddelande-----
> > Från: speex-dev-bounces at [mailto:speex-dev-bounces at] För
> > jesus
> > Skickat: den 22 januari 2007 19:43
> > Till: speex-dev at
> > Ämne: [Speex-dev] How to detect SpeexBits corruption
> >
> > Hello,
> >
> > im using speex library on my vo ip project, but some times, after it 
> > works ok, it begins to play noises (like voice hits) decoding the 
> > packets of one source (the others sound ok).
> >
> > I finally found that reseting SpeexBits and decoder state it solves.
> >
> > If i cant avoid this problem, i wish to solve when it occours, but ¿how 
> > to detect this?
> >
> > Please, if anyone has experiment this issue i will thank any help.
> >
> > by MJM.
> > _______________________________________________
> > Speex-dev mailing list
> > Speex-dev at
> >
> >  
> >
> >
> >   
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at

More information about the Speex-dev mailing list