Package limn.video
Interface VideoFrame.Recycler
- All Known Implementing Classes:
FramePool
- Enclosing class:
VideoFrame
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
How a producer gets a released frame's memory back. The pool lives entirely on the producer's
side: this carries
VideoFrame.slot() and never an address, so a native producer's
implementation is one call passing that integer across the boundary and a pure-Java
producer's is that integer pushed onto a free list.
Invoked once per released frame, on whichever thread released it, so implementations must be thread-safe. It must not wait for anything: a producer blocked for a free slot stays blocked until this returns.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final VideoFrame.RecyclerRecycles nothing, and exists for frames backed by ordinary garbage-collected memory whose producer will never refill the slot. -
Method Summary
Modifier and TypeMethodDescriptionvoidrecycle(VideoFrame frame) Takes back the memory of a frame whose consumer has just released it.
-
Field Details
-
NONE
Recycles nothing, and exists for frames backed by ordinary garbage-collected memory whose producer will never refill the slot.VideoFrame.release()is still required against this: it is what stops the planes being readable, and a consumer that omits it here will omit it against a real producer too.
-
-
Method Details
-
recycle
Takes back the memory of a frame whose consumer has just released it. The slot is already marked free when this runs, soVideoFrame.plane(int)throws here and the frame is usable only throughVideoFrame.slot()and the descriptive accessors, which is everything a free list or a native handback needs.- Parameters:
frame- the frame whose slot came free; never null
-