viewers: Fix spice audio

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 <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-09-21 11:35:51 -04:00
parent e58cc956b5
commit 79ebcbcb71
1 changed files with 10 additions and 0 deletions

View File

@ -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