Marian Kechlibar
2009-Feb-13 09:19 UTC
[Speex-dev] "More than two wideband layers found. The stream is corrupted." problem
Dear Speex developers, I am currently experimenting with Speex on Symbian smartphones. I have compiled the Speex library, and I am now using it in the following way: 1. Record 320-byte buffers of data in PCM16 format, 8000 Hz sampling rate. 2. Feed the resulting buffer to an instance of a narrowband Speex encoder. 3. Send the encoded data over RTP. 4. Upon receiving on the other side, feed the payload to a narrowband Speex decoderd. 5. Play the resulting PCM to the reproductor. However, currently I am stuck in point 4. All of a sudden, the STDOUT window appears and a huge list of the error messages "More than two wideband layers found. The stream is corrupted." flood the screen of the phone (btw: pretty scary sight :-) I found the message in the file nb_celp.c, in this section of code: wideband = speex_bits_unpack_unsigned(bits, 1); if (wideband) { speex_notify("More than two wideband layers found. The stream is corrupted."); return -2; } Does this error look familiar to any of you? How did I manage to corrupt the Speex state? I am using RTP over UDP, and that UDP runs over GPRS/EDGE, so the sequence of the packets is not necessarily kept - is this the problem? Should I use the built-in jitter buffer, or write some kind of my own? Some packets get lost on the way, since GPRS is not a particularly reliable connection. Can this damage the Speex internal state too? Best regards Marian Kechlibar
Jim Crichton
2009-Feb-13 13:42 UTC
[Speex-dev] "More than two wideband layers found. The stream iscorrupted." problem
This error means that the decoder is seeing an invalid header, either because the data is garbage, or the frame is not correctly aligned. This error happens to many of us when first starting out with Speex. Lost packets should not cause this error, as long as the packets contain a single Speex frame, or an integral number of frames. Out of sequence packets should not cause this error if the frame alignment is preserved. To troubleshoot, you can capture the packets and check to make sure that the size agrees with the Speex quality setting that you are using. Since you have a working STDOUT, you can modify the code to dump the frame that causes the error, and compare this to the actual packets. Also, you might try making a test loopback version that just takes the encoded output and feeds this to the decoder on the same machine (see testenc.c for an example), just to verify that is working consistently. Good luck. - Jim Crichton ----- Original Message ----- From: "Marian Kechlibar" <marian.kechlibar at circletech.net> To: <speex-dev at xiph.org> Sent: Friday, February 13, 2009 4:19 AM Subject: [Speex-dev] "More than two wideband layers found. The stream iscorrupted." problem> Dear Speex developers, > > I am currently experimenting with Speex on Symbian smartphones. > > I have compiled the Speex library, and I am now using it in the > following way: > > 1. Record 320-byte buffers of data in PCM16 format, 8000 Hz sampling rate. > 2. Feed the resulting buffer to an instance of a narrowband Speex encoder. > 3. Send the encoded data over RTP. > 4. Upon receiving on the other side, feed the payload to a narrowband > Speex decoderd. > 5. Play the resulting PCM to the reproductor. > > However, currently I am stuck in point 4. All of a sudden, the STDOUT > window appears and a huge list of the error messages > "More than two wideband layers found. The stream is corrupted." > flood the screen of the phone (btw: pretty scary sight :-) > > I found the message in the file nb_celp.c, in this section of code: > > wideband = speex_bits_unpack_unsigned(bits, 1); > if (wideband) > { > speex_notify("More than two wideband layers found. The > stream is corrupted."); > return -2; > } > > Does this error look familiar to any of you? > > How did I manage to corrupt the Speex state? I am using RTP over UDP, > and that UDP runs over GPRS/EDGE, so the sequence of the packets is > not necessarily kept - is this the problem? Should I use the built-in > jitter buffer, or write some kind of my own? Some packets get lost > on the way, since GPRS is not a particularly reliable connection. > Can this damage the Speex internal state too? > > Best regards > > Marian Kechlibar > _______________________________________________ > Speex-dev mailing list > Speex-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev