diff mbox series

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

Message ID 20220104090836.31660-6-ming.qian@nxp.com
State New
Headers show
Series [FFmpeg-devel,v5,1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Ming Qian Jan. 4, 2022, 9:08 a.m. UTC
Check v4l2 context before call VIDIOC_STREAMON() or
VIDIOC_STREAMOFF().

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

Patch

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);