- Java code
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); }
这个是对RTP包数据解析的一个过程,
请教一下其中
- Java code
int cc = srcData[0] & 0x0F;
- Java code
sequenceNum = srcData[2] * 0x100 | (srcData[3] & 0xFF); int x = srcData[0] & 0x10;
- Java code
int headerExtensionLength = srcData[iPlayDataIndx + 2] * 0x100 | (srcData[iPlayDataIndx + 3] & 0xFF);
这些位运算是什么意思?小弟对位运算不是很通,请高手指点一下
------解决方案--------------------------------------------------------
这个你去看书比我们说的肯定清楚...
这几个是位与,一般用来做位匹配的