Do not allow selection of WASAPI devices

Dino would have to resample it own audio, do more book keeping and
somehow find out manually which is the default device.
This commit is contained in:
LAGonauta 2021-05-09 10:42:41 -03:00
parent 064541dd2b
commit ee11a2dbcf

View file

@ -49,6 +49,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
device_monitor.start(); device_monitor.start();
foreach (Gst.Device device in device_monitor.get_devices()) { foreach (Gst.Device device in device_monitor.get_devices()) {
if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) continue; if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) continue;
if (device.properties.get_string("device.api") == "wasapi") continue;
if (device.properties.get_string("device.class") == "monitor") continue; if (device.properties.get_string("device.class") == "monitor") continue;
if (devices.any_match((it) => it.matches(device))) continue; if (devices.any_match((it) => it.matches(device))) continue;
devices.add(new Device(this, device)); devices.add(new Device(this, device));
@ -186,6 +187,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
case Gst.MessageType.DEVICE_ADDED: case Gst.MessageType.DEVICE_ADDED:
message.parse_device_added(out device); message.parse_device_added(out device);
if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE; if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE;
if (device.properties.get_string("device.api") == "wasapi") return Source.CONTINUE;
if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE; if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE;
if (devices.any_match((it) => it.matches(device))) return Source.CONTINUE; if (devices.any_match((it) => it.matches(device))) return Source.CONTINUE;
devices.add(new Device(this, device)); devices.add(new Device(this, device));
@ -194,6 +196,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
case Gst.MessageType.DEVICE_CHANGED: case Gst.MessageType.DEVICE_CHANGED:
message.parse_device_changed(out device, out old_device); message.parse_device_changed(out device, out old_device);
if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE; if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE;
if (device.properties.get_string("device.api") == "wasapi") return Source.CONTINUE;
if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE; if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE;
old = devices.first_match((it) => it.matches(old_device)); old = devices.first_match((it) => it.matches(old_device));
if (old != null) old.update(device); if (old != null) old.update(device);
@ -202,6 +205,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
case Gst.MessageType.DEVICE_REMOVED: case Gst.MessageType.DEVICE_REMOVED:
message.parse_device_removed(out device); message.parse_device_removed(out device);
if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE; if (device.properties.has_name("pipewire-proplist") && device.device_class.has_prefix("Audio/")) return Source.CONTINUE;
if (device.properties.get_string("device.api") == "wasapi") return Source.CONTINUE;
if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE; if (device.properties.get_string("device.class") == "monitor") return Source.CONTINUE;
old = devices.first_match((it) => it.matches(device)); old = devices.first_match((it) => it.matches(device));
if (old != null) devices.remove(old); if (old != null) devices.remove(old);