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

Jean-Marc Valin jean-marc.valin at
Thu Jan 25 10:21:42 PST 2007

Tom Grandgent a écrit :
> 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:

Tom, can you give an example of how Speex can enter a "bad state"? I
don't see how that could happen, but if you have an example, I can
probably fix it.

> 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.

I'd like to add something for everyone: *please* try and reproduce the
problem with speexenc/speexdec instead of your own code. It's less
likely to be buggy and a bug that can be reproduced from those will get
my attention *much* more quickly.

> 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.

Again, do you have examples of that happening.



> Good luck,
> Tom
> 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
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at

More information about the Speex-dev mailing list