Subject: viewers: Fix spice audio From: Cole Robinson crobinso@redhat.com Mon Sep 21 11:35:51 2020 -0400 Date: Mon Sep 21 11:35:51 2020 -0400: Git: 79ebcbcb71d77548443b7943d65bacb216c93769 Commit 1689ebb25 removed what I thought was an unused audio handle in the spice viewer code, but apparently it does something. Strangely some VMs work fine (linux, windows 7), but my windows 10 VMs need this to actually get audio. No clue what that's all about https://bugzilla.redhat.com/show_bug.cgi?id=1881080 Signed-off-by: Cole Robinson diff --git a/virtManager/details/viewers.py b/virtManager/details/viewers.py index 46ff1431..da9f906d 100644 --- a/virtManager/details/viewers.py +++ b/virtManager/details/viewers.py @@ -476,6 +476,7 @@ class SpiceViewer(Viewer): Viewer.__init__(self, *args, **kwargs) self._spice_session = None self._display = None + self._audio = None self._main_channel = None self._display_channel = None self._usbdev_manager = None @@ -618,6 +619,14 @@ class SpiceViewer(Viewer): self._init_widget() self.emit("connected") + elif (type(channel) in [SpiceClientGLib.PlaybackChannel, + SpiceClientGLib.RecordChannel] and + not self._audio): + # It's unclear why we need this audio handle, but it + # does matter: + # https://bugzilla.redhat.com/show_bug.cgi?id=1881080 + self._audio = SpiceClientGLib.Audio.get(self._spice_session, None) + def _agent_connected_cb(self, src, val): self.emit("agent-connected") # pragma: no cover @@ -631,6 +640,7 @@ class SpiceViewer(Viewer): _SIGS.disconnect_obj_signals(self._spice_session) self._spice_session.disconnect() self._spice_session = None + self._audio = None if self._display: self._display.destroy() self._display = None