RtcpSenderReport extends RtcpReport { 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))); rawData[offSet++] = ((byte) ((this.ntpSec & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.ntpSec & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.ntpSec & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.ntpSec & 0x000000FF))); rawData[offSet++] = ((byte) ((this.ntpFrac & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.ntpFrac & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.ntpFrac & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.ntpFrac & 0x000000FF))); rawData[offSet++] = ((byte) ((this.rtpTs & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.rtpTs & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.rtpTs & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.rtpTs & 0x000000FF))); rawData[offSet++] = ((byte) ((this.psent & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.psent & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.psent & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.psent & 0x000000FF))); rawData[offSet++] = ((byte) ((this.osent & 0xFF000000) >> 24)); rawData[offSet++] = ((byte) ((this.osent & 0x00FF0000) >> 16)); rawData[offSet++] = ((byte) ((this.osent & 0x0000FF00) >> 8)); rawData[offSet++] = ((byte) ((this.osent & 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  RtcpSenderReport();  RtcpSenderReport(boolean padding, long ssrc, long ntpSec, long ntpFrac, long rtpTs, long psent, long osent); long getNtpSec(); long getNtpFrac(); long getNtpTs(); long getRtpTs(); long getPsent(); long getOsent(); @Override boolean isSender(); @Override String toString();  }
@Test public void testEncode() { RtcpSenderReport rtcpSenderReport = new RtcpSenderReport(false, 266283887, 3471178652l, 133143986, 1586529211, 1, 11); byte[] rawData = new byte[256]; int length = rtcpSenderReport.encode(rawData, 0); assertEquals(p.length, length); for (int i = 0; i < p.length; i++) { assertEquals(p[i], rawData[i]); } }