RtcpReceiverReport extends RtcpReport { @Override protected int encode(byte[] rawData, int offSet) { int startPosition = offSet; offSet = super.encode(rawData, offSet); rawData[offSet++] = ((byte) ((this.ssrc & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.ssrc & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.ssrc & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.ssrc & 0x000000FF))); for (RtcpReportBlock report : this.reportBlocks) { if (report != null) { offSet = report.encode(rawData, offSet); } else { break; } } this.length = (offSet - startPosition - 4) / 4; rawData[startPosition + 2] = ((byte) ((this.length & 0xFF00) >> 8)); rawData[startPosition + 3] = ((byte) (this.length & 0x00FF)); return offSet; } protected  RtcpReceiverReport();  RtcpReceiverReport(boolean padding, long ssrc); @Override boolean isSender(); @Override String toString();  }
@Test public void testEncode() { RtcpReceiverReport rtcpReceptionReport = new RtcpReceiverReport(false, 233393951); RtcpReportBlock rtcpReceptionReportItem = new RtcpReportBlock(266283887, 0, 0, 0, 17250, 57, 4221306863l, 263851); rtcpReceptionReport.addReceiverReport(rtcpReceptionReportItem); byte[] rawData = new byte[256]; int length = rtcpReceptionReport.encode(rawData, 0); assertEquals(p.length, length); assertEquals(1, rtcpReceptionReport.getCount()); for (int i = 0; i < p.length; i++) { assertEquals(p[i], rawData[i]); } }