Skip to contentSkip to conversation

stkwebcam: Always reuse last queued buffer

PATCH RESEND New Jaime Velasco Juan 1 participant 1 message Jul 22, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 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 <[email protected]>

---

Hi, this is the third time I send this patch, is there any problem with it?

Regards,
Jaime

 drivers/media/video/stk-webcam.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/media/video/stk-webcam.c +12 -11
index f308c38..fce5d63 100644
@@ -442,18 +442,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;
 				}
-				fb = list_first_entry(&dev->sio_avail,
-					struct stk_sio_buffer, list);
-				fb->v4lbuf.bytesused = 0;
-				fill = fb->buffer;
 			}
 		} else {
 			framelen -= 4;
Signature · 6 lines
1.5.6.2

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list