- the stream must stop when the main application closes the device.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
 
        /* if the file did the capture, free the streaming resources */
        if (gspca_dev->capt_file == file) {
+               if (gspca_dev->streaming) {
+                       mutex_lock(&gspca_dev->usb_lock);
+                       gspca_stream_off(gspca_dev);
+                       mutex_unlock(&gspca_dev->usb_lock);
+               }
                frame_free(gspca_dev);
                gspca_dev->capt_file = NULL;
                gspca_dev->memory = GSPCA_MEMORY_NO;