diff mbox

[yavta] Fix requeue of last buffers

Message ID 1453823106-24777-1-git-send-email-ttomov@mm-sol.com (mailing list archive)
State New, archived
Headers show

Commit Message

Todor Tomov Jan. 26, 2016, 3:45 p.m. UTC
When capturing n image with p buffers, dequeued buffers don't need to be
requeued in the last p iterations. Currently requeue in iteration
n - p + 1 is skipped only. So skip requeue on all last p iterations.

Also handle correctly the case when n < p.

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
---
 yavta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/yavta.c b/yavta.c
index 49361ad..12f1608 100644
--- a/yavta.c
+++ b/yavta.c
@@ -1696,7 +1696,7 @@  static int video_do_capture(struct device *dev, unsigned int nframes,
 
 		fflush(stdout);
 
-		if (i == nframes - dev->nbufs && !do_requeue_last)
+		if (i + dev->nbufs >= nframes && !do_requeue_last)
 			continue;
 
 		ret = video_queue_buffer(dev, buf.index, fill);