HardwareBufferFrameQueue


@RequiresApi(value = 26)
@ExperimentalApi
public interface HardwareBufferFrameQueue

Known direct subclasses
PacketConsumerHardwareBufferFrameQueue

An implementation of HardwareBufferFrameQueue that manages a fixed-capacity pool of HardwareBuffers, that are forwarded to a downstream PacketConsumer.


A provider for HardwareBufferFrame instances that manages allocating the underlying HardwareBuffer instances, and forwards frames downstream for processing.

Summary

Nested types

Defines the configuration parameters required for a HardwareBuffer.

Public methods

abstract @Nullable HardwareBufferFrame
dequeue(
    HardwareBufferFrameQueue.FrameFormat format,
    Runnable wakeupListener
)

Attempts to dequeue a HardwareBufferFrame matching the specified format.

abstract void

Queues a HardwareBufferFrame for consumption by the downstream component.

abstract void

Signals that no more frames will be queued.

Public methods

dequeue

abstract @Nullable HardwareBufferFrame dequeue(
    HardwareBufferFrameQueue.FrameFormat format,
    Runnable wakeupListener
)

Attempts to dequeue a HardwareBufferFrame matching the specified format.

If the queue has reached its capacity and no buffers are available for reuse, this method returns null. In this case, the wakeupListener will be invoked when a buffer is eventually returned to the pool.

Parameters
HardwareBufferFrameQueue.FrameFormat format

The required format for the dequeued buffer.

Runnable wakeupListener

A callback to notify the caller when a buffer becomes available.

Returns
@Nullable HardwareBufferFrame

A HardwareBufferFrame, or null if the queue is currently full.

queue

abstract void queue(HardwareBufferFrame frame)

Queues a HardwareBufferFrame for consumption by the downstream component.

Implementations may override release of the queued frame.

The implementation is responsible for ensuring the buffer is correctly reused or released once the downstream component has finished processing it.

Parameters
HardwareBufferFrame frame

The frame to be processed.

signalEndOfStream

abstract void signalEndOfStream()

Signals that no more frames will be queued.

This propagates an end-of-stream signal to the downstream consumer.