diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index dcc7bb3ad..d8a0ca4ff 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -75,6 +75,7 @@ struct port { bool alloc_buffers; bool probed_expbuf; bool have_expbuf; + bool first_buffer; uint32_t max_buffers; bool next_fmtdesc; diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index a30a09512..0c97628c3 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1417,8 +1417,10 @@ static int mmap_read(struct impl *this) /* Drop the first frame in order to work around common firmware * timestamp issues */ - if (buf.sequence == 0) { - xioctl(dev->fd, VIDIOC_QBUF, &buf); + if (port->first_buffer) { + port->first_buffer = false; + if (xioctl(dev->fd, VIDIOC_QBUF, &buf) < 0) + spa_log_warn(this->log, "v4l2 %p: error qbuf: %m", this); return 0; } @@ -1807,6 +1809,8 @@ static int spa_v4l2_stream_on(struct impl *this) spa_log_debug(this->log, "starting"); + port->first_buffer = true; + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (xioctl(dev->fd, VIDIOC_STREAMON, &type) < 0) { spa_log_error(this->log, "'%s' VIDIOC_STREAMON: %m", this->props.device);