[linux-dvb] [PATCH] 2/3: implement DMX_SET_BUFFER_SIZE for dvr

Andrea mariofutire at googlemail.com
Sat Mar 22 01:22:16 CET 2008

This patch implements the ioctl DMX_SET_BUFFER_SIZE for the dvr.

The ioctl used to be supported but not yet implemented.

The way it works is that it replaces the ringbuffer with a new one.
Beforehand it flushes the old buffer.
This means that part of the stream is lost, and reading errors (like overflow) are cleaned.
The flushing is not a problem since this operation usually occurs at beginning before start reading.

Since the dvr is *always* up and running this change has to be done while the buffer is written:

1) On the userspace side, it is as safe as dvb_dvr_read is now:
	- dvb_dvr_set_buffer_size locks the mutex
	- dvb_dvr_read does *not* lock the mutex (the code is there commented out)

So as long as one does not call read simultaneously it works properly.
Maybe the mutex should be enforced in dvb_dvr_read.

2) On the kernel side
The only thing I am not 100% sure about is whether the spin_lock I've used is enough to guarantee
synchronization between the new function dvb_dvr_set_buffer_size (which uses spin_lock_irq) and
dvb_dmxdev_ts_callback and dvb_dmxdev_section_callback (using spin_lock).
But this looks to me the same as all other functions do.

I would like to change documentation about DMX_SET_BUFFER_SIZE, but I could not find the source of


-------------- next part --------------
A non-text attachment was scrubbed...
Name: size.diff
Type: text/x-patch
Size: 1497 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20080322/25a119ea/attachment.bin 

More information about the linux-dvb mailing list