[wdmaudiodev] Re: Shared mode recording doesn't work if CurrentCount is nonzero

  • From: Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 21 Aug 2014 23:52:18 +0000

> What undesired could happen in such case?

Well, for example, there might be two hardware pin factories - say a line in 
and a mic - which feed the same streaming pin factory, with a mux to control 
the source.

A direct KS client sets the mux to "microphone" and captures from the streaming 
endpoint. The current instance count goes from 0 to 1.

Now an app tries to capture from the line in. The Windows audio engine would 
normally set the mux to "line in" and open a pin instance on the streaming pin. 
This would cause the Direct KS client to mysteriously start capturing data from 
the line in as well, which would be undesired. But since the Windows audio 
engine notices that the current instance count is 1 already, it stops and 
reports a "device in use" error.

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Eugene Muzychenko
Sent: Thursday, August 14, 2014 9:42 AM
To: Matthew van Eerde
Subject: [wdmaudiodev] Re: Shared mode recording doesn't work if CurrentCount 
is nonzero

Hello Matthew,

> I believe the intent of this audio subsystem check is to ensure it's 
> not stepping on any DirectKS clients' toes.

What undesired could happen in such case? If a driver exposes a pin supporting 
a single instance only, there is no problem. If a pin exposed allows multiple 
instances, a driver knows how to handle them correctly.

> Can you help me understand the scenario that requires simultaneous 
> DirectKS and audio subsystem clients for a given pin?

A simplest example is an ASIO application working with a plain WDM/KS device 
without its proprietary ASIO driver. In such case, ASIO4ALL proxy is used, 
becoming a KS client. Since ASIO4ALL allocates the first pin instance, no MME, 
DirectSound or WASAPI clients can access the pin. The only workaround is to 
start MME/DirectSound/WASAPI client first and then start ASIO client.

Some applications offer their own KS interfaces for recording to ensure 
reliability (WASAPI exclusive mode implementation has at least one known bug in 
Win7 that had been fixed in Win8).

Regards,
Eugene

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

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/

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

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: