mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
v4l2: use a separate flag to skip the first buffer
The buf.sequence value might stay to 0 (v4l2loopback)
This commit is contained in:
parent
cba2fad86b
commit
4c487ea59d
2 changed files with 7 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1409,8 +1409,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;
|
||||
}
|
||||
|
||||
|
|
@ -1799,6 +1801,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue