Skip to content

Commit

Permalink
V4L/DVB (8491): stkwebcam: Always reuse last queued buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jaime Velasco Juan authored and Mauro Carvalho Chehab committed Jul 26, 2008
1 parent f78d92c commit b185590
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions drivers/media/video/stk-webcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
fb = list_first_entry(&dev->sio_avail,
struct stk_sio_buffer, list);
fb->v4lbuf.bytesused = 0;
fill = fb->buffer;
}
} else {
framelen -= 4;
Expand Down

0 comments on commit b185590

Please sign in to comment.