Re: [PATCH 2/2] media: venus: vdec: Resume CAPTURE restarted during a seek
From: Bryan O'Donoghue
Date: Sun Nov 22 2026 - 18:09:52 EST
On 22/11/2026 05:13, EMCP333 via B4 Relay wrote:
From: EMCP333 <emcp@xxxxxxxx>This also looks similar to : https://patchwork.linuxtv.org/project/linux-media/patch/20260928-venus-vdec-eos-v1-2-6e9eb3ce9849@xxxxxxx/
GStreamer's V4L2 decoder handles a flushing seek by calling STREAMOFF on
both queues, then STREAMON on CAPTURE, then STREAMON on OUTPUT when the
first buffer of the new segment arrives. On a OnePlus 6T (SDM845) the
seek never completes: the decoder takes two OUTPUT buffers, produces
nothing, and the pipeline times out waiting for preroll.
The driver loses CAPTURE in that order:
STREAMOFF OUTPUT vdec_stop_output() DECODING -> SEEK, flush
STREAMOFF CAPTURE vdec_stop_capture() SEEK: buffers cancelled
STREAMON CAPTURE vdec_start_capture() streamon_out is 0: return 0,
streamon_cap stays 0
STREAMON OUTPUT vdec_start_output() SEEK -> DECODING, but capture
buffers are queued only if
streamon_cap is set
so the buffers CAPTURE was restarted with stay in the m2m queue and the
firmware has nothing to decode into. A seek that restarts only OUTPUT,
as ffmpeg and mpv do, is not affected.
Remember a CAPTURE restart that happens while OUTPUT is stopped in the
SEEK state, hold the capture buffers queued meanwhile, and hand them to
the firmware together with the DPB buffers when OUTPUT restarts. Clear
the flag whenever CAPTURE is stopped again.
Tested on a OnePlus 6T with this change on the postmarketOS sdm845
kernel (6.18): three flushing seeks through GStreamer's v4l2h264dec, to
5, 2 and 8 s of a 10 s clip, each preroll in 0.04-0.07 s with the first
frame at the exact target timestamp, and playback then runs to
end-of-stream.
The code and this changelog were prepared with the help of an AI coding
assistant. The submitter has reviewed both and takes responsibility for
them.
Fixes: beac82904a87 ("media: venus: make decoder compliant with stateful codec API")
Signed-off-by: EMCP333 <emcp@xxxxxxxx>
Please pick up on David's patches, give Tested-by: as appropriate and propose any additional fixes on top.
---
bod