[Ffmpeg-devel] alsa input / output
Sat Mar 24 20:43:04 CET 2007
On Sat, Mar 24, 2007 at 07:15:32PM +0100, Michael Niedermayer wrote:
> On Sat, Mar 24, 2007 at 10:57:33AM +0100, Reimar D?ffinger wrote:
> > Btw. is there a ringbuffer implementation in ffmpeg that allows reader
> > and write to be a different thread (aka. the lock-free
> > partially-threadsafe variant)?
> i dunno, check fifo.c/h if its not partially threadsafe, making it so is
> welcome ...
Looks mostly ok, since read does not touch rptr and write does not touch
Seems only two things are missing: rptr and wptr must be volatile and
there needs to be another function that returns how much space there is
free in the buffer.
I should also note that such a lock-free implementation depends on
volatile keyword working "well enough" and pointer reads and writes being
atomic on the architecture...
If we don't want to depend on it, it might be a good idea to use
different functions that add locking for the cases that need it.
More information about the ffmpeg-devel