[wdmaudiodev] Re: AVStream driver: Filter dispatch methods & automation methods synchronization

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 20 Jun 2016 10:52:31 -0700

Alexander Ivash wrote:

Is any kind of synchronization required between KSMethod which I'm
using to pass the data into ringbuffer and Filter::Process which
consumes the data from that ringbuffer?

Are these coming from different processes?  If so, then there is no
synchronization.


Right after introducing ring buffer (without any locks inside) I was
pretty sure I'll get a BSOD instantly but for some reasons I haven't.
Does it mean AVStream framework synchronizes calls internally or this
is just coincidence?

If you design a circular buffer properly, with one reader and one
writer, no locks are ever needed.  Each side only moves one of the
pointers ("in" or "out").  The only time they need the other pointer is
to compute the amount of available data or empty space.  In that case,
it doesn't really matter that the pointer moved immediately after I read
it.  It just means there's more data to catch next time.  That's one of
the beauties of a circular buffer.


Also, in the case of several filters, how Filter::Process gets
executed: sequentially or 'in parallel' ?

If there are different processes, then these are ioctls on different
file handles, and they can come in any order.  However, in general, it
doesn't matter, because each filter has its own context data. 
Synchronization is only required when you're sharing data.

-- 
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: