RecordingPacketConsumer


@ExperimentalApi
public final class RecordingPacketConsumer implements PacketConsumer


A PacketConsumer implementation that holds a reference to all queued packets, and optionally releases the underlying frames.

Summary

Public constructors

RecordingPacketConsumer(boolean releaseIncomingFrames)

Public methods

final @NonNull List<@NonNull List<@NonNull GlTextureFrame>>
void

Queues a Packet for processing, suspending the caller if the consumer is at capacity.

void

Releases all resources.

boolean

Attempts to queue a Packet for processing without blocking.

Public constructors

RecordingPacketConsumer

public RecordingPacketConsumer(boolean releaseIncomingFrames)

Public methods

getQueuedPackets

public final @NonNull List<@NonNull List<@NonNull GlTextureFrame>> getQueuedPackets()

queuePacket

public void queuePacket(
    @NonNull PacketConsumer.Packet<@NonNull List<@NonNull GlTextureFrame>> packet
)

Queues a Packet for processing, suspending the caller if the consumer is at capacity.

Once this method returns, the ownership of the packet is transferred to this PacketConsumer, and the caller should not modify the packet.

Parameters
@NonNull PacketConsumer.Packet<@NonNull List<@NonNull GlTextureFrame>> packet

The Packet to process.

release

public void release()

Releases all resources.

tryQueuePacket

public boolean tryQueuePacket(
    @NonNull PacketConsumer.Packet<@NonNull List<@NonNull GlTextureFrame>> packet
)

Attempts to queue a Packet for processing without blocking.

If this method returns true, the ownership of the packet is transferred to this PacketConsumer and the caller must not modify the packet.

Parameters
@NonNull PacketConsumer.Packet<@NonNull List<@NonNull GlTextureFrame>> packet

The Packet to process.

Returns
boolean

true if the packet was accepted and queued for processing. Returns false if the consumer is at capacity and cannot accept the packet at this time.