Skip to content

Actual capture frame interval differs from VIDIOC_G_PARM #49

@grawis

Description

@grawis

Description

The frame interval reported by VIDIOC_G_PARM does not match the actual
capture timing.

The default timeperframe is 1001/30000 seconds, approximately
33.367 ms per frame. However, reading 61 consecutive frames produces an
average interval of approximately 29.989 ms.

Environment

  • vcam commit: 1b02973
  • Kernel: Linux 6.17.0-35-generic
  • Format: 640x480 RGB24

Result

Format: 640x480 RGB3
Stride/bytesperline: reported=1920 expected=1920 [PASS]
Sizeimage: reported=921600 expected=921600 [PASS]
Frame interval: reported=33.367 ms measured=29.989 ms error=10.1% [FAIL]

Expected behavior

The actual capture interval should be close to the value reported by
VIDIOC_G_PARM.

Cause

dev->output_fps stores a V4L2 timeperframe value in seconds per frame,
despite its name suggesting frames per second.

submitter_thread() currently calculates:

timeout_ms = dev->output_fps.denominator /
             dev->output_fps.numerator;

For 1001/30000, this produces approximately 29.97 frames per second, but
the result is subsequently treated as milliseconds. This causes the actual
capture speed to differ from the configured and reported frame interval.

The variable should be renamed to reflect its actual meaning, and the timing
calculation should be corrected so that the configured value, reported value,
and observed capture speed are consistent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions