PacketBuffer { public void setOutputStreamFactory(OutputStreamFactory outputStreamFactory) { notNull(outputStreamFactory, "outputStreamFactory must be non-null"); this.outputStreamFactory = outputStreamFactory; } PacketBuffer(); void setTempFileGenerator(TempFileGenerator tempFileGenerator); void setOutputStreamFactory(OutputStreamFactory outputStreamFactory); void setMaxIncompleteFrameBytes(long maxIncompleteFrameBytes); @Override String toString(); void reset(); long getAge(); long getByteCount(); void write(byte[] rawPacket); void frameComplete(FrameType frameType); RotateResult rotate(RolloverCondition rolloverCondition); RotateResult flushAndRotate(); void cancelTimer(); static final long ACTIVITY_TIMEOUT; }
@Test public void testWriteWithVideoData1() { packetBuffer.setOutputStreamFactory((file, append) -> os); completeVideoSequence( new byte[] {0x01, 0x02, 0x03, 0x01, 0x02, 0x03, 0x01, 0x02, 0x03, 0x01, 0x02, 0x03}); assertThat( os.toByteArray(), is(new byte[] {0x01, 0x02, 0x03, 0x01, 0x02, 0x03, 0x01, 0x02, 0x03})); }
@Test public void testWriteWithVideoData2() { packetBuffer.setOutputStreamFactory((file, append) -> os); writePacket((byte) 0x01); writePacket((byte) 0x02); writePacket((byte) 0x03); idr(); writePacket((byte) 0x01); writePacket((byte) 0x02); writePacket((byte) 0x03); nonidr(); writePacket((byte) 0x01); writePacket((byte) 0x02); writePacket((byte) 0x03); nonidr(); assertThat(os.toByteArray(), is(new byte[] {})); }