Skip to content

media: vcam: set capture buffer sequence numbers#55

Open
grawis wants to merge 1 commit into
sysprog21:masterfrom
grawis:fix-buffer-sequence
Open

media: vcam: set capture buffer sequence numbers#55
grawis wants to merge 1 commit into
sysprog21:masterfrom
grawis:fix-buffer-sequence

Conversation

@grawis

@grawis grawis commented Jun 18, 2026

Copy link
Copy Markdown

This patch sets the V4L2 capture buffer sequence number for each completed
frame.

Before this change, applications using VIDIOC_DQBUF always observed
buf.sequence == 0, even though frames were being streamed successfully. This
made it impossible for userspace to track frame order through the standard
V4L2 buffer metadata.

The fix adds a per-device sequence counter, resets it when streaming starts,
and assigns it to each completed capture buffer before calling
vb2_buffer_done().

Tested with a local MMAP streaming test:

Frame  Index  Sequence  Bytesused  Timestamp(us)
    0      0         0     921600     ...
    1      1         1     921600     ...
    2      2         2     921600     ...
    3      0         3     921600     ...
Sequence: PASS
Timestamp: PASS
Bytesused: PASS

Fixes #54.


Summary by cubic

Set V4L2 capture buffer sequence numbers so VIDIOC_DQBUF returns increasing buf.sequence and apps can track frame order. Fixes the issue where all frames reported sequence 0.

  • Bug Fixes
    • Added per-device sequence counter to vcam_device, reset on stream start.
    • Set vb.sequence before vb2_buffer_done() in both submit paths.

Written for commit 6e18f1f. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V4L2 buffer sequence number is not updated during streaming

1 participant