Skip to content

media: venus: wait for the first source change in G_FMT(CAPTURE) - #52

Merged
Xenolphthalein merged 1 commit into
sm8250/7.2from
fix/venus-first-source-change-wait
Nov 18, 2026
Merged

Xenolphthalein merged 1 commit into
sm8250/7.2from
fix/venus-first-source-change-wait

Conversation

@Xenolphthalein

Copy link
Copy Markdown
Contributor

For overpressure/phoenix#29.

FFmpeg's v4l2m2m decoders ask for the capture format before the source change event. Venus answered -EINVAL until the firmware had read the headers, and FFmpeg dropped a packet on every failed attempt, so most runs decoded a stream with holes or nothing at all (FFmpeg's trac #8774). While the stream is queued, Venus now waits for the firmware's first source change before it answers, like iris does at capture STREAMON. In practice that's about 0.5 ms.

Tested on the headset, on 7.2-5 with this commit on top:

  • FFmpeg's hevc_v4l2m2m (with and without B-frames), h264_v4l2m2m, vp8_v4l2m2m and vp9_v4l2m2m: every frame equal to software decoding in 25 of 25 runs, where 7.2-5 got 1 of 15 right. GStreamer's v4l2h265dec is unchanged, 2 of 2.
  • Steam Link from the PC, worn: picture fine, no decode errors. Its client waits for the event before it asks, so it never reaches the wait.
  • dev check passes.

FFmpeg's v4l2m2m decoders queue the stream, start OUTPUT and ask for the
CAPTURE format before the source change event. With the event subscribed,
Venus answers -EINVAL until the firmware has parsed the headers, about 2 ms
later. FFmpeg takes that as fatal for its capture setup and drops the packet
it holds, then the next one, until the format is known: in one run 36 of 60
packets never reached the decoder, so every later frame referenced pictures
it never got, and when the window lasted to the end of the file nothing came
out at all. GStreamer waits for the event and is not affected.

While OUTPUT streams with buffers handed to the firmware, wait up to 1 s for
the first source change, as iris does at CAPTURE STREAMON, and answer with
the parsed format. Without a stream the error stays.

On the PICO 4, FFmpeg's hevc_v4l2m2m (with and without B-frames),
h264_v4l2m2m and vp8_v4l2m2m decode 60 frames of 1080p60 and vp9_v4l2m2m
60 frames of 720p30, every frame equal to software decoding in five runs
each, where before one of fifteen runs did.
@Xenolphthalein
Xenolphthalein merged commit a47ef53 into sm8250/7.2 Nov 18, 2026
5 checks passed
@Xenolphthalein
Xenolphthalein deleted the fix/venus-first-source-change-wait branch November 18, 2026 11:11
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.

1 participant