[Ffmpeg-devel] alsa input / output

Michael Niedermayer michaelni
Sun Mar 25 05:26:16 CEST 2007


On Sat, Mar 24, 2007 at 08:43:04PM +0100, Reimar D?ffinger wrote:
> Hello,
> 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
> wptr.
> 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...

could you show one example where volatile makes a difference in practice?

> 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.

locking doesnt belong into fifo.* IMHO
also i dont see where it would be needed that is i dont see how reordering
the memory access could cause problems but iam pretty tired so likely
iam just missing something ...

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070325/40962f4c/attachment.pgp>

More information about the ffmpeg-devel mailing list