PacketConsumer


@ExperimentalApi
public interface PacketConsumer<T extends Object>

Known direct subclasses
PacketProcessor

A PacketConsumer that processes Packets and forwards them to a downstream PacketConsumer.

RecordingPacketConsumer

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

RenderingPacketConsumer

A PacketConsumer that renders input Packets to an output O.


A consumer that accepts Packets.

This interface is experimental and will be renamed or removed in a future release.

Parameters
<T extends Object>

The type of Packet.payload being consumed.

Summary

Nested types

public fun interface PacketConsumer.Factory<T extends Object>

A factory for PacketConsumer instances.

public sealed interface PacketConsumer.Packet<T extends Object>

Represents a packet.

A Packet implementation to represent an end of stream (EOS) signal.

public final class PacketConsumer.Packet.Payload<T extends Object> implements PacketConsumer.Packet

A Packet implementation to wrap a payload of type T.

Public methods

abstract void

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

abstract void

Releases all resources.

Public methods

queuePacket

abstract void queuePacket(@NonNull PacketConsumer.Packet<@NonNull T> 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 T> packet

The Packet to process.

release

abstract void release()

Releases all resources.