@Test public void testAppend() { boolean marker = false; byte payloadType = 9; int seqNumber = 13717; int timestamp = 1234897; long ssrc = 1438967189; byte[] bin = new byte[12]; bin[0] = (byte) (0x80); bin[1] = marker ? (byte) (payloadType | 0x80) : (byte) (payloadType & 0x7f); bin[2] = ((byte) ((seqNumber & 0xFF00) >> 8)); bin[3] = ((byte) (seqNumber & 0x00FF)); bin[4] = ((byte) ((timestamp & 0xFF000000) >> 24)); bin[5] = ((byte) ((timestamp & 0x00FF0000) >> 16)); bin[6] = ((byte) ((timestamp & 0x0000FF00) >> 8)); bin[7] = ((byte) ((timestamp & 0x000000FF))); bin[8] = ((byte) ((ssrc & 0xFF000000) >> 24)); bin[9] = ((byte) ((ssrc & 0x00FF0000) >> 16)); bin[10] = ((byte) ((ssrc & 0x0000FF00) >> 8)); bin[11] = ((byte) ((ssrc & 0x000000FF))); RtpHeader h2 = new RtpHeader(); int i = 0; while (!h2.isFilled()) { h2.append(bin, i++, 1); } assertEquals(marker, h2.getMarker()); assertEquals(payloadType, h2.getPayloadType()); assertEquals(seqNumber, h2.getSeqNumber()); assertEquals(timestamp, h2.getTimestamp()); assertEquals(ssrc, h2.getSsrc()); }
protected int append(byte[] data, int offset, int len) { int remainder = Math.min(12 - pos, len); System.arraycopy(data, offset, bin, pos, remainder); pos += remainder; if (pos == 12) { init(bin); filled = true; } return len - remainder; }
RtpHeader implements Serializable { protected int append(byte[] data, int offset, int len) { int remainder = Math.min(12 - pos, len); System.arraycopy(data, offset, bin, pos, remainder); pos += remainder; if (pos == 12) { init(bin); filled = true; } return len - remainder; } }
RtpHeader implements Serializable { protected int append(byte[] data, int offset, int len) { int remainder = Math.min(12 - pos, len); System.arraycopy(data, offset, bin, pos, remainder); pos += remainder; if (pos == 12) { init(bin); filled = true; } return len - remainder; }  }
RtpHeader implements Serializable { protected int append(byte[] data, int offset, int len) { int remainder = Math.min(12 - pos, len); System.arraycopy(data, offset, bin, pos, remainder); pos += remainder; if (pos == 12) { init(bin); filled = true; } return len - remainder; }  void RtpHeader(); boolean isFilled(); void init(byte[] bin); int getPayloadType(); int getSeqNumber(); long getTimestamp(); int getVersion(); boolean isPadding(); boolean isExtensions(); int getCc(); long getSsrc(); byte[] toByteArray(); boolean getMarker(); void setMarker(boolean marker); void init(boolean marker, byte payloadType, int seqNumber, int timestamp, long ssrc); void init(byte payloadType, int seqNumber, int timestamp, long ssrc); @Override String toString(); }
RtpHeader implements Serializable { protected int append(byte[] data, int offset, int len) { int remainder = Math.min(12 - pos, len); System.arraycopy(data, offset, bin, pos, remainder); pos += remainder; if (pos == 12) { init(bin); filled = true; } return len - remainder; }  void RtpHeader(); boolean isFilled(); void init(byte[] bin); int getPayloadType(); int getSeqNumber(); long getTimestamp(); int getVersion(); boolean isPadding(); boolean isExtensions(); int getCc(); long getSsrc(); byte[] toByteArray(); boolean getMarker(); void setMarker(boolean marker); void init(boolean marker, byte payloadType, int seqNumber, int timestamp, long ssrc); void init(byte payloadType, int seqNumber, int timestamp, long ssrc); @Override String toString();  }