in src/main/java/com/amazonaws/kinesisvideo/parser/utilities/H264FrameEncoder.java [51:81]
public H264FrameEncoder(final int width, final int height, final int bitRate) {
this.encoder = new H264Encoder(new H264FixedRateControl(bitRate));
this.out = ByteBuffer.allocate(width * height * 6);
this.frameNumber = 0;
final Size size = new Size(width, height);
sps = this.encoder.initSPS(size);
pps = this.encoder.initPPS();
final ByteBuffer spsBuffer = ByteBuffer.allocate(512);
this.sps.write(spsBuffer);
spsBuffer.flip();
final ByteBuffer serialSps = ByteBuffer.allocate(512);
this.sps.write(serialSps);
serialSps.flip();
H264Utils.escapeNALinplace(serialSps);
final ByteBuffer serialPps = ByteBuffer.allocate(512);
this.pps.write(serialPps);
serialPps.flip();
H264Utils.escapeNALinplace(serialPps);
final ByteBuffer serialAvcc = ByteBuffer.allocate(512);
final AvcCBox avcC = AvcCBox.createAvcCBox(this.sps.profileIdc, 0, this.sps.levelIdc, 4,
asList(serialSps), asList(serialPps));
avcC.doWrite(serialAvcc);
serialAvcc.flip();
cpd = new byte[serialAvcc.remaining()];
serialAvcc.get(cpd);
}