[patch] release the capture buffers on device closing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

if the video-device (saa7146 on a FF card) was open for capturing, the close call doesn't release the capture buffers.
The attached patch may fix this problem. Possible there is more cleanup necessary.

- Hartmut


signed-off-by: Hartmut Birr <e9hack@xxxxxxxxx>
- Release the capture buffers on device close

diff -r 1109998234b4 linux/drivers/media/common/saa7146_video.c
--- a/linux/drivers/media/common/saa7146_video.c	Fri Mar 30 10:58:01 2007 -0300
+++ b/linux/drivers/media/common/saa7146_video.c	Sat Mar 31 19:50:55 2007 +0200
@@ -1429,6 +1429,7 @@ static void video_close(struct saa7146_d
 {
 	struct saa7146_fh *fh = (struct saa7146_fh *)file->private_data;
 	struct saa7146_vv *vv = dev->vv_data;
+	struct videobuf_queue *q = &fh->video_q;
 	int err;
 
 	if (IS_CAPTURE_ACTIVE(fh) != 0) {
@@ -1436,6 +1437,11 @@ static void video_close(struct saa7146_d
 	} else if (IS_OVERLAY_ACTIVE(fh) != 0) {
 		err = saa7146_stop_preview(fh);
 	}
+	
+	// release all capture buffers
+	mutex_lock(&q->lock);
+	videobuf_read_stop(q);
+	mutex_unlock(&q->lock);
 
 	/* hmm, why is this function declared void? */
 	/* return err */
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux