Class ByteBufferPool


  • public class ByteBufferPool
    extends Object
    Represents a pool of ByteBuffers which reduces the allocations and deallocations of ByteBuffers in the Java heap and of native memory in the native heap.
    Author:
    Lyubomir Marinov
    • Constructor Detail

      • ByteBufferPool

        public ByteBufferPool()
    • Method Detail

      • drain

        public void drain()
        Drains this ByteBufferPool i.e. frees the ByteBuffers that it contains.
      • getBuffer

        public ByteBuffer getBuffer​(int capacity)
        Gets a ByteBuffer out of this pool of ByteBuffers which is capable to receiving at least capacity number of bytes.
        Parameters:
        capacity - the minimal number of bytes that the returned ByteBuffer is to be capable of receiving
        Returns:
        a ByteBuffer which is ready for writing captured media data into and which is capable of receiving at least capacity number of bytes