probably just a minor bug that didn't hurt and probably will never hurt
In RawPacket please have a look at the following methods and the lines marked
with ***** WD ***** in the code snippet below.
In both case IMHO this should be shifitng by 8, not by 4. It's a conversion
network-to-host order and host-to-network order. Bytes are 8 bits, not 4, aren't they ?
If it's ok I'll fix it during the next days when I do some more stuff to integrate
the SRTCP enhancements and I need to slightly modify RawPacket (adding just two
new methods) to handle RTCP packets.
public int getExtensionLength()
//the extension length comes after the RTP header, the CSRC list, and
//after two bytes in the extension header called "defined by profile"
int extLenIndex = offset
+ getCsrcCount()*4 + 2;
return ((buffer[extLenIndex] << 4) | buffer[extLenIndex + 1]) * 4; ***** WD *****
public void addExtension(byte extBuff, int newExtensionLen)
int newBuffLen = length + offset + newExtensionLen;
int bufferOffset = offset;
int newBufferOffset = offset;
int lengthToCopy = FIXED_HEADER_SIZE + getCsrcCount()*4;
boolean extensionBit = getExtensionBit();
//if there was no extension previously, we also need to consider adding
//the extension header.
// without copying the extension length value, will set it later
lengthToCopy += EXT_HEADER_SIZE - 2;
newBuffLen += EXT_HEADER_SIZE;
byte newBuffer = new byte[ newBuffLen ];
// length field counts the number of 32-bit words in the extension
int lengthInWords = (totalExtensionLen + 3)/4;
newBuffer[newBufferOffset++] = (byte)(lengthInWords >>4); ***** WD *****
newBuffer[newBufferOffset++] = (byte)lengthInWords;