[linux-dvb] [patch] release the capture buffers on device closing

Oliver Endriss o.endriss at gmx.de
Sun Apr 22 01:32:01 CEST 2007


e9hack wrote:
> 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. 

>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);

Hm, I'm not sure: Is it safe to call videobuf_read_stop()
if capturing was never active?

CU
Oliver

-- 
--------------------------------------------------------
VDR Remote Plugin 0.3.9 available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------




More information about the linux-dvb mailing list