RtcpSdesChunk { protected int decode(byte[] rawData, int 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; while (true) { RtcpSdesItem sdesItem = new RtcpSdesItem(); offSet = sdesItem.decode(rawData, offSet); addRtcpSdesItem(sdesItem); if (RtcpSdesItem.RTCP_SDES_END == sdesItem.getType()) { break; } } return offSet; } RtcpSdesChunk(long ssrc); protected  RtcpSdesChunk(); void addRtcpSdesItem(RtcpSdesItem rtcpSdesItem); long getSsrc(); String getCname(); RtcpSdesItem[] getRtcpSdesItems(); int getItemCount(); @Override String toString(); static final int MAX_ITEMS; }
@Test public void testDecode() { RtcpSdesChunk rtcpSdesChunk = new RtcpSdesChunk(); rtcpSdesChunk.decode(p, 0); assertEquals(233393951, rtcpSdesChunk.getSsrc()); assertEquals(2, rtcpSdesChunk.getItemCount()); RtcpSdesItem rtcpSdesItem = rtcpSdesChunk.getRtcpSdesItems()[0]; assertNotNull(rtcpSdesItem); assertEquals(RtcpSdesItem.RTCP_SDES_CNAME, rtcpSdesItem.getType()); assertEquals(24, rtcpSdesItem.getLength()); assertEquals("abhayani@abhayani-laptop", rtcpSdesItem.getText()); rtcpSdesItem = rtcpSdesChunk.getRtcpSdesItems()[1]; assertNotNull(rtcpSdesItem); assertEquals(RtcpSdesItem.RTCP_SDES_END, rtcpSdesItem.getType()); }