fix(hwcodec): release V4L2M2M packets before delivery

Copy compressed V4L2M2M output before asynchronous delivery.
This releases driver capture buffers and prevents encoder stalls.

Signed-off-by: BigfootACA <bigfoot@radxa.com>
This commit is contained in:
BigfootACA
2026-08-06 10:52:13 +08:00
committed by SilentWind
parent 1d48d45592
commit db7a845d3b

View File

@@ -592,6 +592,16 @@ impl Encoder {
Some(Encoder::packet_callback),
);
if result == -11 || result == 0 {
if self.ctx.name.contains("v4l2m2m") {
return Ok(frames
.into_iter()
.map(|frame| EncodeBytesFrame {
data: Bytes::copy_from_slice(frame.data.as_ref()),
pts: frame.pts,
key: frame.key,
})
.collect());
}
return Ok(frames);
}
Err(result)