Validity-tracked handle to a native DMA buffer (dmabuf) file descriptor from the camera capture pool. More...
Functions | |
| bool | isValid () const noexcept |
| Check whether the capture pool that minted this descriptor is still alive. More... | |
| operator bool () const noexcept | |
| Same as isValid(). More... | |
Attributes | |
| int | fd = -1 |
| The dmabuf file descriptor, valid in the current process. -1 if unset. More... | |
| uint64_t | generation = 0 |
| Generation counter of the capture pool that minted this descriptor. More... | |
Validity-tracked handle to a native DMA buffer (dmabuf) file descriptor from the camera capture pool.
On Jetson GMSL cameras captured through the Argus pipeline, the capture pre-allocates a fixed pool of dmabuf buffers at open time and cycles them for the whole capture session. This handle wraps one of those file descriptors together with a liveness hook so that a stale descriptor can be detected after the pool has been retired.
Typical use is a zero-copy publisher/subscriber system: query the full pool once with Camera::getRawBufferPoolFds(), send the descriptors to each subscriber a single time (e.g. over a Unix socket with SCM_RIGHTS), then publish only {generation, fd} per frame through shared memory, with no syscall in the per-frame path. Per-frame handles are available through RawBuffer::getFd() / RawBuffer::getFdRight() and match the pool entries by fd value within the same generation.
generation is allocated. isValid() flips to false before the old descriptors are destroyed. The OS may recycle the same integer fd values for the new pool, so never compare raw fd numbers across generations: re-query the pool and re-share it with subscribers whenever isValid() returns false (or retrieveImage() returns ERROR_CODE::CAMERA_REBOOTING).fd after isValid() returns false, as the integer may have been recycled by the OS for an unrelated resource.
|
inlinenoexcept |
Check whether the capture pool that minted this descriptor is still alive.
fd is set and the pool has not been retired (camera close or internal recovery).
|
inlineexplicitnoexcept |
Same as isValid().
| int fd = -1 |
The dmabuf file descriptor, valid in the current process. -1 if unset.
| uint64_t generation = 0 |
Generation counter of the capture pool that minted this descriptor.
Bumped each time the pool is (re)allocated (open or internal recovery). Use it to tag per-frame messages so subscribers can detect that a descriptor belongs to a retired pool.