日期:2014-05-20 浏览次数:20958 次
private int sequenceNum; private byte[] audioData; public static final int MIN_HEAD = 12; public RtpPacket(byte[] srcData) throws IOException { int iPlayDataIndx = MIN_HEAD; int cc = srcData[0] & 0x0F; iPlayDataIndx += cc * 4; sequenceNum = srcData[2] * 0x100 | (srcData[3] & 0xFF); int x = srcData[0] & 0x10; if (1 == x) //有拓展头 { int headerExtensionLength = srcData[iPlayDataIndx + 2] * 0x100 | (srcData[iPlayDataIndx + 3] & 0xFF); iPlayDataIndx += 4; iPlayDataIndx += headerExtensionLength; } audioData = new byte[srcData.length - iPlayDataIndx]; System .arraycopy(srcData, iPlayDataIndx, audioData, 0, audioData.length); }
int cc = srcData[0] & 0x0F;
sequenceNum = srcData[2] * 0x100 | (srcData[3] & 0xFF); int x = srcData[0] & 0x10;
int headerExtensionLength = srcData[iPlayDataIndx + 2] * 0x100 | (srcData[iPlayDataIndx + 3] & 0xFF);