From c4df4a037138a2f1f16bbf1762aa72bcf1ae11f5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 7 Nov 2024 15:42:33 +0100 Subject: [PATCH] v4l2: improve debug a little --- spa/plugins/v4l2/v4l2-utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 0c97628c3..95f74da96 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1415,6 +1415,8 @@ static int mmap_read(struct impl *this) if (xioctl(dev->fd, VIDIOC_DQBUF, &buf) < 0) return -errno; + spa_log_trace(this->log, "v4l2 %p: have output %d/%d", this, buf.index, buf.sequence); + /* Drop the first frame in order to work around common firmware * timestamp issues */ if (port->first_buffer) { @@ -1425,7 +1427,6 @@ static int mmap_read(struct impl *this) } pts = SPA_TIMEVAL_TO_NSEC(&buf.timestamp); - spa_log_trace(this->log, "v4l2 %p: have output %d", this, buf.index); if (this->clock) { /* FIXME, we should follow the driver clock and target_ values. @@ -1474,6 +1475,7 @@ static void v4l2_on_fd_events(struct spa_source *source) struct spa_io_buffers *io; struct port *port = &this->out_ports[0]; struct buffer *b; + int res; if (source->rmask & SPA_IO_ERR) { struct port *port = &this->out_ports[0]; @@ -1488,8 +1490,10 @@ static void v4l2_on_fd_events(struct spa_source *source) return; } - if (mmap_read(this) < 0) + if ((res = mmap_read(this)) < 0) { + spa_log_warn(this->log, "v4l2 %p: mmap read error:%s", this, spa_strerror(res)); return; + } if (spa_list_is_empty(&port->queue)) return;