public sealed class VideoFramePoolWhere frames come from, so that playing a video allocates nothing per frame.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A 1080p 4:2:0 frame is three megabytes. At sixty a second that is 180 MB/s through the allocator and into gen 2, for buffers that are all exactly the same size and all dead within four frames — the textbook case for pooling, and one of the few places in the engine where the garbage collector would genuinely be the bottleneck.
Not thread-safe, and it does not need to be. One player owns one pool: its decode thread rents and its presentation returns, and the queue between them is what crosses the thread boundary. A lock here would be taken twice a frame to protect a list two threads are already coordinating around.
Fields and properties (3)
public int CapacityThe most frames it will hold onto.
public int AvailableHow many frames are available without allocating.
public int AllocationsHow many frames the pool has ever had to allocate.
Methods (4)
public VideoFramePool(int capacity = 8)Creates a pool that will hold at most a number of frames.
public VideoFrame Rent(in VideoFormat format)Takes a frame sized for a format.
public void Return(VideoFrame frame)Gives a frame back.
public void Clear()Drops everything it is holding.
Used by (2)
- VideoFrameTestsVixen.Video.Tests
- VideoPlayerVixen.Video