CapturingFrameProcessor


@RequiresApi(value = 26)
@ExperimentalApi
public class CapturingFrameProcessor implements FrameProcessor


A FrameProcessor that delegates to an underlying FrameProcessor and records queued frames and EOS signals for testing.

Summary

Nested types

Marker class representing a signalEndOfStream call.

Marker interface for ordering frames and EOS signals.

A factory for CapturingFrameProcessor instances.

Holds the frames queued in a queue call.

Public methods

void

Blocks until all resources are released.

ImmutableList<ImmutableList<Long>>

Returns a list of timestamp lists for all queued events.

ImmutableList<CapturingFrameProcessor.Event>

Returns an ImmutableList of all queued events.

boolean

Returns true if the last Event queued was an EosEvent.

boolean

Attempts to queue a List of frames for processing.

void

Notifies this processor that the current stream has ended.

Inherited methods

From java.lang.AutoCloseable
abstract void

Public methods

close

public void close()

Blocks until all resources are released.

getQueuedContentTimesUs

public ImmutableList<ImmutableList<Long>> getQueuedContentTimesUs()

Returns a list of timestamp lists for all queued events. The list for an EOS event contains a single TIME_UNSET value.

getQueuedEvents

public ImmutableList<CapturingFrameProcessor.Event> getQueuedEvents()

Returns an ImmutableList of all queued events.

isEnded

public boolean isEnded()

Returns true if the last Event queued was an EosEvent.

queue

public boolean queue(List<AsyncFrame> frames)

Attempts to queue a List of frames for processing.

All frames provided in a single invocation of this method represent the exact same point in time.

If this consumer is at capacity, this method returns false and the onWakeup will be invoked when capacity becomes available.

If this method returns true, onFrameProcessed must be called once with every input frame instance queued, once the FrameProcessor has finished processing the frames.

Parameters
List<AsyncFrame> frames

The frames to queue.

Returns
boolean

true if the frames were queued, false if the consumer is at capacity.

signalEndOfStream

public void signalEndOfStream()

Notifies this processor that the current stream has ended.

More frames may be queued after calling this method, if the current stream changes.