[FFmpeg-devel] [PATCH v5 6/7] avcodec/v4l2_context: sync v4l2 context status with driver.

Ming Qian ming.qian at nxp.com
Tue Jan 4 11:08:35 EET 2022


Check v4l2 context before call VIDIOC_STREAMON() or
VIDIOC_STREAMOFF().

Signed-off-by: Ming Qian <ming.qian at nxp.com>
---
 libavcodec/v4l2_context.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index b7b584dfbef6..8910ae08d3a5 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -562,6 +562,9 @@ int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd)
     int type = ctx->type;
     int ret;
 
+    if (ctx->streamon == (cmd == VIDIOC_STREAMON))
+        return 0;
+
     ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type);
     if (ret < 0)
         return AVERROR(errno);
-- 
2.33.0



More information about the ffmpeg-devel mailing list