wasapi: Allow opening devices in exclusive mode
authorNirbheek Chauhan <nirbheek@centricular.com>
Tue, 6 Feb 2018 18:10:49 +0000 (23:40 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Thu, 8 Feb 2018 06:34:20 +0000 (12:04 +0530)
commit6ecbb7556a2f86976ca30442f4b4088999c403ad
treef2d477c0b25479144d1585534750b983be13b4f5
parent4b388814af946d89d651fa97872330352f09cf35
wasapi: Allow opening devices in exclusive mode

This provides much lower latency compared to opening in shared mode,
but it also means that the device cannot be opened by any other
application. The advantage is that the achievable latency is much
lower.

In shared mode, WASAPI's engine period is 10ms, and so that is the
lowest latency achievable.

In exclusive mode, the limit is the device period itself, which in my
testing with USB DACs, on-board PCI sound-cards, and HDMI cards is
between 2ms and 3.33ms.

We set our audioringbuffer limits to match the device, so the
achievable sink latency is 6-9ms. Further improvements can be made if
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
sys/wasapi/gstwasapisink.c
sys/wasapi/gstwasapisink.h
sys/wasapi/gstwasapisrc.c
sys/wasapi/gstwasapisrc.h
sys/wasapi/gstwasapiutil.c
sys/wasapi/gstwasapiutil.h