aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2022-02-12 14:35:44 +0100
committerMarvin W <git@larma.de>2022-02-12 14:36:26 +0100
commit369d0c79d7272b4059c39ecedb10a62121bfbe56 (patch)
tree6ae87a1fd71b68dd8eff163c2b01dc5903f58ee0 /plugins
parent0f5f57888e2e237549b1bc7002770ec102ff0e6b (diff)
downloaddino-369d0c79d7272b4059c39ecedb10a62121bfbe56.tar.gz
dino-369d0c79d7272b4059c39ecedb10a62121bfbe56.zip
Calls: Fix device selector for multi-party calls, allow picking device before call started
Diffstat (limited to 'plugins')
-rw-r--r--plugins/rtp/src/device.vala15
-rw-r--r--plugins/rtp/src/plugin.vala23
-rw-r--r--plugins/rtp/src/stream.vala16
-rw-r--r--plugins/rtp/src/video_widget.vala4
4 files changed, 30 insertions, 28 deletions
diff --git a/plugins/rtp/src/device.vala b/plugins/rtp/src/device.vala
index aca97578..d4eca09a 100644
--- a/plugins/rtp/src/device.vala
+++ b/plugins/rtp/src/device.vala
@@ -18,12 +18,14 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
public string id { owned get { return device_name; }}
public string display_name { owned get { return device_display_name; }}
- public string detail_name { owned get {
- return device.properties.get_string("alsa.card_name") ?? device.properties.get_string("alsa.name") ?? device.properties.get_string("alsa.id") ?? device.properties.get_string("api.v4l2.cap.card") ?? id;
+ public string? detail_name { owned get {
+ if (device.properties.has_field("alsa.card_name")) return device.properties.get_string("alsa.card_name");
+ if (device.properties.has_field("alsa.name")) return device.properties.get_string("alsa.name");
+ if (device.properties.has_field("alsa.id")) return device.properties.get_string("alsa.id");
+ if (device.properties.has_field("api.v4l2.cap.card")) return device.properties.get_string("api.v4l2.cap.card");
+ return null;
}}
-
- public Gst.Pipeline pipe { get { return plugin.pipe; }}
- public string? media { get {
+ public string? media { owned get {
if (device.has_classes("Audio")) {
return "audio";
} else if (device.has_classes("Video")) {
@@ -32,6 +34,9 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
return null;
}
}}
+ public bool incoming { get { return is_sink; } }
+
+ public Gst.Pipeline pipe { get { return plugin.pipe; }}
public bool is_source { get { return device.has_classes("Source"); }}
public bool is_sink { get { return device.has_classes("Sink"); }}
public bool is_monitor { get { return device.properties.get_string("device.class") == "monitor" || (protocol == DeviceProtocol.PIPEWIRE && device.has_classes("Stream")); } }
diff --git a/plugins/rtp/src/plugin.vala b/plugins/rtp/src/plugin.vala
index 2469a967..3a4f6ce1 100644
--- a/plugins/rtp/src/plugin.vala
+++ b/plugins/rtp/src/plugin.vala
@@ -388,7 +388,7 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
return fps;
}
- public Device? get_preferred_device(string media, bool incoming) {
+ public MediaDevice? get_preferred_device(string media, bool incoming) {
Gee.List<Device> devices = new ArrayList<Device>();
foreach (MediaDevice media_device in get_devices(media, incoming)) {
if (media_device is Device) devices.add((Device)media_device);
@@ -427,14 +427,11 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
}
}
- public MediaDevice? get_device(Xmpp.Xep.JingleRtp.Stream stream, bool incoming) {
- Stream plugin_stream = stream as Stream;
+ public MediaDevice? get_device(Xmpp.Xep.JingleRtp.Stream? stream, bool incoming) {
+ Stream? plugin_stream = stream as Stream?;
if (plugin_stream == null) return null;
- if (incoming) {
- return plugin_stream.output_device ?? get_preferred_device(stream.media, incoming);
- } else {
- return plugin_stream.input_device ?? get_preferred_device(stream.media, incoming);
- }
+ MediaDevice? device = incoming ? plugin_stream.output_device : plugin_stream.input_device;
+ return device ?? get_preferred_device(stream.media, incoming);
}
public void dump_dot() {
@@ -444,8 +441,8 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
print(@"Stored pipe details as $name\n");
}
- public void set_pause(Xmpp.Xep.JingleRtp.Stream stream, bool pause) {
- Stream plugin_stream = stream as Stream;
+ public void set_pause(Xmpp.Xep.JingleRtp.Stream? stream, bool pause) {
+ Stream? plugin_stream = stream as Stream?;
if (plugin_stream == null) return;
if (pause) {
plugin_stream.pause();
@@ -454,9 +451,9 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
}
}
- public void set_device(Xmpp.Xep.JingleRtp.Stream stream, MediaDevice? device) {
- Device real_device = device as Device;
- Stream plugin_stream = stream as Stream;
+ public void set_device(Xmpp.Xep.JingleRtp.Stream? stream, MediaDevice? device) {
+ Device? real_device = device as Device?;
+ Stream? plugin_stream = stream as Stream?;
if (real_device == null || plugin_stream == null) return;
if (real_device.is_source) {
plugin_stream.input_device = real_device;
diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala
index 6bd92e3f..abdda776 100644
--- a/plugins/rtp/src/stream.vala
+++ b/plugins/rtp/src/stream.vala
@@ -27,7 +27,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
private Device _input_device;
public Device input_device { get { return _input_device; } set {
- if (!paused) {
+ if (sending && !paused) {
var input = this.input;
set_input(value != null ? value.link_source(payload_type, our_ssrc, next_seqnum_offset, next_timestamp_offset) : null);
if (this._input_device != null) this._input_device.unlink(input);
@@ -37,7 +37,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
private Device _output_device;
public Device output_device { get { return _output_device; } set {
if (output != null) remove_output(output);
- if (value != null) add_output(value.link_sink());
+ if (value != null && receiving) add_output(value.link_sink());
this._output_device = value;
}}
@@ -74,10 +74,10 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
public void on_senders_changed() {
if (sending && input == null) {
- input_device = plugin.get_preferred_device(media, false);
+ input_device = input_device;
}
if (receiving && output == null) {
- output_device = plugin.get_preferred_device(media, true);
+ output_device = output_device;
}
}
@@ -86,11 +86,11 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
// Create i/o if needed
- if (input == null && input_device == null && sending) {
- input_device = plugin.get_preferred_device(media, false);
+ if (input == null && sending) {
+ input_device = input_device;
}
- if (output == null && output_device == null && receiving && media == "audio") {
- output_device = plugin.get_preferred_device(media, true);
+ if (output == null && receiving && media == "audio") {
+ output_device = output_device;
}
// Create app elements
diff --git a/plugins/rtp/src/video_widget.vala b/plugins/rtp/src/video_widget.vala
index 664d45ee..82693b09 100644
--- a/plugins/rtp/src/video_widget.vala
+++ b/plugins/rtp/src/video_widget.vala
@@ -130,11 +130,11 @@ public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidge
return false;
}
- public void display_stream(Xmpp.Xep.JingleRtp.Stream stream, Xmpp.Jid jid) {
+ public void display_stream(Xmpp.Xep.JingleRtp.Stream? stream, Xmpp.Jid jid) {
if (sink == null) return;
detach();
if (stream.media != "video") return;
- connected_stream = stream as Stream;
+ connected_stream = stream as Stream?;
if (connected_stream == null) return;
plugin.pause();
pipe.add(sink);