Skip to content

Zero-copy v4l2 frame reading #24

@dexterlb

Description

@dexterlb

It is extremely funny that the go4vl library advertises "zero-copy IO using memory mapped buffers" and yet explicitly calls copy() on each frame.

I think this can be remedied:

  • Do not call Start() at all. Instead, call InitBuffers and MapMemoryBuffers manually, by creating a custom FrameAllocator that does this and using that frame allocator for the v4l source
  • The frame forwarder should be modified to allow more than one frame to be in the "writing" state
  • The number of allocated frames should be split in two: some frames in the v4l writing queue (Nw), and some frames available for readers (Nr)
  • On source startup, get Nw frames from the frame forwarder for writing and enqueue them into v4l
  • On each dequeue, call FinishedWriting on the frame, get a new frame for writing and enqueue it

This would basically be a zero-copy, sequential rewrite of the current v4l stream loop that should be much faster

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions