[Speex-dev] rtp payload lenth

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Tue Sep 18 03:21:57 PDT 2007

Hi, (moving back to the list as some bits can be useful to everyone)

> I am sure that 75 is the length of payload only.


> I also don't have idea for the package containing data of a length 46.
> To make everything more clear, Payload type in rtp packages is 97.
> SDP defines the stream as
> a=rtpmap: 97 SPEEX/8000

That's a dynamic payload number, so it doesn't really change anything.

> As a attachment I am sending both binary and hexdump:
>    whole packets   (hexdump of packets ip/udp/rtp/data)
>          speex_payload-length75.txt
>          speex_payload-length46.txt
>    binary files with payload of length 75  (only data):
>         speex_payload-length75.bin
>    binary files with payload of length 46(only data):
>         speex_payload-length46.bin

OK, so I was able to identify the 75-byte and the 46-byte payloads. The
75-byte one actually contains two frames encoded with the 15 kbps mode,
while the 46-byte payload is simply one frame encoded with the 18.2 kbps
mode. The trick is to look at the first 5 bits in the payload (starting
from the MSB). The first one should normally be zero. The next four are
the id of the mode being used. In the case of the 75-byte payload, the
first byte was "2b", which means the first 5 bits are 00101=5. Mode 5 is
15 kbps. At 15 kbps, each frame is 37.5 bytes. Advancing in the payload
by 37.5 bytes, we see another 2b sequence, except that this one is split
across two bytes. So that's how you tell the content of a Speex frame.
If anyone wants to build that knowledge into wireshark, I'd be willing
to help by providing the rest of the knowledge required.



> Regards,
>    Pawel Cyrta
> Jean-Marc Valin pisze:
>> Not sure what a payload of 75 bytes could be. Are you sure that doesn't
>> include the 12-byte RTP header? Other than that, maybe it's using
>> wideband (although there's nothing that corresponds exactly to 75 bytes.
>> If you send me the hexdump for one packet, I may be able to find out
>> what it is.
>>     Jean-Marc
>> Pawel Cyrta wrote:
>>> Hello to all speex developers,
>>> I have question regarding payload length of narrowband speex in RTP.
>>> I were watching tcpdump of the xlite softphone and have found that
>>> it uses weird payload length namely 75 Bytes
>>> I went through various source and without success.
>>> To be clear:
>>> For 8000Hz sample in 20 ms that is 160 samples per frame.
>>> This makes 50 frames per sec.
>>> modes     bit-rate    8 kbit/s    (narrowband mode 3) = 20 bytes per
>>> frame
>>> 11 kbit/s (narrowband mode 4)  = 28 bytes per frame
>>> 15 kbit/s (narrowband mode 5)  = 38 bytes per frame
>>> 18,2 kbit/s (narrowband mode 6)  = 46 bytes per frame
>>> 24,6 kbit/s (narrowband mode 7)  = 62 bytes per frame
>>> And for VBR   frame size is from a set of {6,11,16,21,29,39}
>>> So, X-lite uses 75 Bytes and this does not look as multiplication of 2
>>> frames.
>>> Additionally, timestamp between consecutive rtp frames is exactly
>>> 20ms, so
>>> this implies that this 75 Bytes is only one frame plus maybe bits of
>>> padding.
>>> Can one of you tell me what kind of mode this is?
>>> Thank you in advance.
>>> Pawel
>>> ps. IMHO  some kind of table that I've shown should be included in RFC
>>> so in Table 1 in draft-ietf-avt-rtp-speex-03 there should be additional
>>> column.
>>> Namely frame size.
>>>     Pawel Cyrta <pawel at cyrta.com <mailto:pawel at cyrta.com>>
>>> _______________________________________________
>>> Speex-dev mailing list
>>> Speex-dev at xiph.org
>>> http://lists.xiph.org/mailman/listinfo/speex-dev

More information about the Speex-dev mailing list