[Speex-dev] Detecting bitrate mode

Software Engineer dspcph at yahoo.dk
Mon Aug 29 19:49:13 PDT 2011

Is there anybody out there who can tell me how to solve the following problem:
An RTP payload of encoded speex data is received. The length of the payload is
N bytes. The length corresponds to 20ms * K of encoded audio where K is an
unknown integer. The audio was encoded by an encoder in wideband mode.
How do I partition the payload when I don't know which bitrate mode of the
encoder? I want to hand over 20ms of encoded audio to the decoder, but to be
able to do that I need to know how many bytes of the payload corresponds to
I read that the bitrate mode and the wideband bit is embedded in the first byte, but
that is not what I actually see. What I see is that the MSB of the first encoded byte
is 0 and the following bits do not correspond to the bitrate mode that was used when
encoding the audio.
So I am wondering what I am doing wrong.
Is it because the first part of the payload is a narrowband bitstream ? And I need to 
extract the narrowband bitrate mode first, figure out how many bytes (M) that mode
corresponds to and skip M bytes ahead to get the wideband
bitrate mode? 
Or is there a quicker way of doing it?
Can somebody please shed some light on this??
Thank you!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20110830/edf51a0d/attachment.htm 

More information about the Speex-dev mailing list