V4L/DVB: gspca - main: Restart streaming after reqbuf
authorJean-François Moine <moinejf@free.fr>
Fri, 9 Apr 2010 09:07:58 +0000 (06:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:57:56 +0000 (12:57 -0300)
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index 4fb031cfb64fe573c0fdf06aa67e59de94ac9486..9c9d7ea7e626b3d82241bfe64e43a106f5b2117f 100644 (file)
@@ -1503,7 +1503,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
                          struct v4l2_requestbuffers *rb)
 {
        struct gspca_dev *gspca_dev = priv;
-       int i, ret = 0;
+       int i, ret = 0, streaming;
 
        switch (rb->memory) {
        case GSPCA_MEMORY_READ:                 /* (internal call) */
@@ -1538,7 +1538,8 @@ static int vidioc_reqbufs(struct file *file, void *priv,
        }
 
        /* stop streaming */
-       if (gspca_dev->streaming) {
+       streaming = gspca_dev->streaming;
+       if (streaming) {
                mutex_lock(&gspca_dev->usb_lock);
                gspca_dev->usb_err = 0;
                gspca_stream_off(gspca_dev);
@@ -1557,6 +1558,8 @@ static int vidioc_reqbufs(struct file *file, void *priv,
        if (ret == 0) {
                rb->count = gspca_dev->nframes;
                gspca_dev->capt_file = file;
+               if (streaming)
+                       ret = gspca_init_transfer(gspca_dev);
        }
 out:
        mutex_unlock(&gspca_dev->queue_lock);