CircularEncoderBuffer

Holds encoded video data in a circular buffer.

This is actually a pair of circular buffers, one for the raw data and one for the meta-data (flags and PTS).

Not thread-safe.

Constructors

Link copied to clipboard
constructor(bitRate: Int, frameRate: Int, desiredSpanSec: Int)
Allocates the circular buffers we use for encoded data and meta-data.

Functions

Link copied to clipboard
open fun add(buf: ByteBuffer, flags: Int, ptsUsec: Long)
Adds a new encoded data packet to the buffer.
Link copied to clipboard
Computes the amount of time spanned by the buffered data, based on the presentation time stamps.
Link copied to clipboard
open fun getChunk(index: Int, info: MediaCodec.BufferInfo): ByteBuffer
Returns a reference to a "direct" ByteBuffer with the data, and fills in the BufferInfo.
Link copied to clipboard
open fun getFirstIndex(): Int
Returns the index of the oldest sync frame.
Link copied to clipboard
open fun getNextIndex(index: Int): Int
Returns the index of the next packet, or -1 if we've reached the end.