V4L/DVB (8491): stkwebcam: Always reuse last queued buffer

Previous thread: V4L/DVB (8490): s2255drv Sensoray 2255 driver fixes by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:03 am. (1 message)

Next thread: V4L/DVB (8492): Add support for the ATI TV Wonder HD 600 by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:03 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:03 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b18559...
Commit:     b18559076a31ab0be2d980ce2beff8e32504e080
Parent:     f78d92c9ffcda7451b5943ab491c087f1ec7e08d
Author:     Jaime Velasco Juan <jsagarribay@gmail.com>
AuthorDate: Tue Jul 22 12:28:36 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@infradead.org>
CommitDate: Sat Jul 26 13:18:15 2008 -0300

    V4L/DVB (8491): stkwebcam: Always reuse last queued buffer
    
    This change keeps the video stream going on when the application
    is slow queuing buffers, instead of spamming dmesg and hanging.
    
    Fixes a problem with aMSN reported by Samed Beyribey <beyribey@gmail.com>
    
    Signed-off-by: Jaime Velasco Juan <jsagarribay@gmail.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
 drivers/media/video/stk-webcam.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 8aa56fe..a8a7276 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -445,18 +445,19 @@ static void stk_isoc_handler(struct urb *urb)
 				fb->v4lbuf.bytesused = 0;
 				fill = fb->buffer;
 			} else if (fb->v4lbuf.bytesused == dev->frame_size) {
-				list_move_tail(dev->sio_avail.next,
-					&dev->sio_full);
-				wake_up(&dev->wait_frame);
-				if (list_empty(&dev->sio_avail)) {
-					(void) (printk_ratelimit() &&
-					STK_ERROR("No buffer available\n"));
-					goto resubmit;
+				if (list_is_singular(&dev->sio_avail)) {
+					/* Always reuse the last buffer */
+					fb->v4lbuf.bytesused = 0;
+					fill = fb->buffer;
+				} else {
+					list_move_tail(dev->sio_avail.next,
+						&dev->sio_full);
+					wake_up(&dev->wait_frame);
+					fb = list_first_entry(&dev->sio_avail,
+						struct stk_sio_buffer, list);
+					fb->v4lbuf.bytesused = 0;
+					fill = fb->buffer;
 ...
Previous thread: V4L/DVB (8490): s2255drv Sensoray 2255 driver fixes by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:03 am. (1 message)

Next thread: V4L/DVB (8492): Add support for the ATI TV Wonder HD 600 by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:03 am. (1 message)