From 50eeb2f16dfa4342d50086404da068f5426cbe3c Mon Sep 17 00:00:00 2001 From: Marvin W Date: Wed, 9 Apr 2025 20:02:55 +0200 Subject: RTP: Tear down most of GStreamer while not in a call. This includes #1679 and works around an upstream bug in pipewire causing #1685 --- main/src/ui/call_window/call_window.vala | 4 +-- .../src/ui/call_window/call_window_controller.vala | 39 ++++++++++++++-------- main/src/ui/call_window/participant_widget.vala | 6 ++++ 3 files changed, 34 insertions(+), 15 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala index 08ea4b21..54e290a7 100644 --- a/main/src/ui/call_window/call_window.vala +++ b/main/src/ui/call_window/call_window.vala @@ -18,7 +18,6 @@ namespace Dino.Ui { public HeaderBar header_bar = new HeaderBar() { valign=Align.START, halign=Align.END, show_title_buttons=true, opacity=0.0 }; public Revealer header_bar_revealer = new Revealer() { halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.SLIDE_LEFT, transition_duration=200, reveal_child=false }; public Box own_video_box = new Box(Orientation.HORIZONTAL, 0) { halign=Align.END, valign=Align.END }; - private Widget? own_video = null; private HashMap participant_widgets = new HashMap(); private ArrayList participants = new ArrayList(); @@ -98,6 +97,7 @@ namespace Dino.Ui { } public void remove_participant(string participant) { + participant_widgets[participant].set_video(new Adw.Bin()); participants.remove(participant); grid.remove(participant_widgets[participant]); participant_widgets.unset(participant); @@ -167,7 +167,7 @@ namespace Dino.Ui { public void set_own_video(Widget? widget_) { unset_own_video(); - own_video = widget_; + Widget? own_video = widget_; if (own_video == null) { own_video = new Box(Orientation.HORIZONTAL, 0); } diff --git a/main/src/ui/call_window/call_window_controller.vala b/main/src/ui/call_window/call_window_controller.vala index 6e3eac6d..2543569d 100644 --- a/main/src/ui/call_window/call_window_controller.vala +++ b/main/src/ui/call_window/call_window_controller.vala @@ -210,18 +210,25 @@ public class Dino.Ui.CallWindowController : Object { bool show_keys = true; Plugins.Registry registry = Dino.Application.get_default().plugin_registry; if (((has_audio && audio_encryption != null) || (has_video && video_encryption != null)) && (!has_audio || !has_video || (audio_encryption != null && video_encryption != null && audio_encryption.encryption_ns == video_encryption.encryption_ns))) { - Plugins.CallEncryptionEntry? encryption_entry = audio_encryption != null ? registry.call_encryption_entries[audio_encryption.encryption_ns] : null; - if (encryption_entry != null) { - Plugins.CallEncryptionWidget? audio_encryption_widgets = encryption_entry.get_widget(call.account, audio_encryption); - Plugins.CallEncryptionWidget? video_encryption_widgets = encryption_entry.get_widget(call.account, video_encryption); - if (audio_encryption_widgets != null && video_encryption_widgets != null) { - if (audio_encryption_widgets.get_title() == video_encryption_widgets.get_title()) - title = audio_encryption_widgets.get_title(); - if (audio_encryption_widgets.get_icon_name() == video_encryption_widgets.get_icon_name()) - icon_name = audio_encryption_widgets.get_icon_name(); - if (audio_encryption_widgets.show_keys() == video_encryption_widgets.show_keys()) - show_keys = audio_encryption_widgets.show_keys(); - } + Plugins.CallEncryptionEntry? audio_encryption_entry = audio_encryption != null ? registry.call_encryption_entries[audio_encryption.encryption_ns] : null; + Plugins.CallEncryptionEntry? video_encryption_entry = video_encryption != null ? registry.call_encryption_entries[video_encryption.encryption_ns] : null; + Plugins.CallEncryptionWidget? audio_encryption_widgets = audio_encryption_entry != null ? audio_encryption_entry.get_widget(call.account, audio_encryption) : null; + Plugins.CallEncryptionWidget? video_encryption_widgets = video_encryption_entry != null ? video_encryption_entry.get_widget(call.account, video_encryption) : null; + if (audio_encryption_widgets != null && !has_video) { + title = audio_encryption_widgets.get_title(); + icon_name = audio_encryption_widgets.get_icon_name(); + show_keys = audio_encryption_widgets.show_keys(); + } else if (video_encryption_widgets != null && !has_audio) { + title = video_encryption_widgets.get_title(); + icon_name = video_encryption_widgets.get_icon_name(); + show_keys = video_encryption_widgets.show_keys(); + } else if (audio_encryption_widgets != null && video_encryption_widgets != null) { + if (audio_encryption_widgets.get_title() == video_encryption_widgets.get_title()) + title = audio_encryption_widgets.get_title(); + if (audio_encryption_widgets.get_icon_name() == video_encryption_widgets.get_icon_name()) + icon_name = audio_encryption_widgets.get_icon_name(); + if (audio_encryption_widgets.show_keys() == video_encryption_widgets.show_keys()) + show_keys = audio_encryption_widgets.show_keys(); } } @@ -376,7 +383,13 @@ public class Dino.Ui.CallWindowController : Object { } call_window_handler_ids = bottom_bar_handler_ids = new ulong[0]; - own_video.detach(); + if (own_video != null) { + if (this.call_window.bottom_bar.video_enabled) { + own_video.detach(); + call_window.unset_own_video(); + } + own_video = null; + } base.dispose(); } } diff --git a/main/src/ui/call_window/participant_widget.vala b/main/src/ui/call_window/participant_widget.vala index 0940bc9e..ba06f27a 100644 --- a/main/src/ui/call_window/participant_widget.vala +++ b/main/src/ui/call_window/participant_widget.vala @@ -139,5 +139,11 @@ namespace Dino.Ui { header_bar.opacity = controls_active ? 1.0 : 0.0; invite_button.visible = may_show_invite_button && is_highest_row && is_start_row; } + + public override void dispose() { + main_widget = null; + overlay = null; + base.dispose(); + } } } -- cgit v1.3