RtcpAppDefined extends RtcpHeader { protected int decode(byte[] rawData, int offSet) { int tmp = offSet; offSet = super.decode(rawData, offSet); this.ssrc |= rawData[offSet++] & 0xFF; this.ssrc <<= 8; this.ssrc |= rawData[offSet++] & 0xFF; this.ssrc <<= 8; this.ssrc |= rawData[offSet++] & 0xFF; this.ssrc <<= 8; this.ssrc |= rawData[offSet++] & 0xFF; byte[] nameBytes = new byte[4]; System.arraycopy(rawData, offSet, nameBytes, 0, 4); offSet+=4; this.name = new String(nameBytes); this.data = new byte[(this.length - 12)]; System.arraycopy(rawData, offSet, this.data, 0, this.data.length); offSet += this.data.length; return offSet; } RtcpAppDefined(); protected  RtcpAppDefined(boolean padding, int subType, long ssrc, String name, byte[] data); byte[] getData(); String getName(); long getSsrc(); int getSubType();  }
@Test public void testDecode() { RtcpAppDefined rtcpAppDefined = new RtcpAppDefined(); int length = rtcpAppDefined.decode(p, 0); assertEquals(p.length, length); assertEquals(2, rtcpAppDefined.getVersion()); assertFalse(rtcpAppDefined.isPadding()); assertEquals(1, rtcpAppDefined.getCount()); assertEquals(RtcpHeader.RTCP_APP, rtcpAppDefined.getPacketType()); assertEquals(266283887, rtcpAppDefined.getSsrc()); assertEquals("qtsi", rtcpAppDefined.getName()); byte[] expected = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x61, 0x74, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14 }; java.util.Arrays.equals(expected, rtcpAppDefined.getData()); }