Merge remote-tracking branch 'origin/pr/140'

* origin/pr/140:
  use function to determine pacat domid
  connect to PA in stubdom if audio-model enabled run pacat in low latency mode by default
This commit is contained in:
Marek Marczykowski-Górecki 2020-06-20 05:01:59 +02:00
commit ae39c75867
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -275,6 +275,15 @@ class DAEMONLauncher:
"""Helper function to construct an AUDIO pidfile path""" """Helper function to construct an AUDIO pidfile path"""
return '/var/run/qubes/pacat.{}'.format(xid) return '/var/run/qubes/pacat.{}'.format(xid)
@staticmethod
def pacat_domid(vm):
"""Determine target domid for an AUDIO daemon"""
xid = vm.stubdom_xid \
if vm.features.check_with_template('audio-model', False) \
and vm.virt_mode == 'hvm' \
else vm.xid
return xid
@asyncio.coroutine @asyncio.coroutine
def start_gui_for_vm(self, vm, monitor_layout=None): def start_gui_for_vm(self, vm, monitor_layout=None):
"""Start GUI daemon (qubes-guid) connected directly to a VM """Start GUI daemon (qubes-guid) connected directly to a VM
@ -341,7 +350,7 @@ class DAEMONLauncher:
:param vm: VM for which start AUDIO daemon :param vm: VM for which start AUDIO daemon
""" """
# pylint: disable=no-self-use # pylint: disable=no-self-use
pacat_cmd = [PACAT_DAEMON_PATH, vm.xid, vm.name] pacat_cmd = [PACAT_DAEMON_PATH, '-l', self.pacat_domid(vm), vm.name]
vm.log.info('Starting AUDIO') vm.log.info('Starting AUDIO')
yield from asyncio.create_subprocess_exec(*pacat_cmd) yield from asyncio.create_subprocess_exec(*pacat_cmd)
@ -387,7 +396,8 @@ class DAEMONLauncher:
if not vm.features.check_with_template('audio', True): if not vm.features.check_with_template('audio', True):
return return
if not os.path.exists(self.pacat_pidfile(vm.xid)): xid = self.pacat_domid(vm)
if not os.path.exists(self.pacat_pidfile(xid)):
yield from self.start_audio_for_vm(vm) yield from self.start_audio_for_vm(vm)
def on_domain_spawn(self, vm, _event, **kwargs): def on_domain_spawn(self, vm, _event, **kwargs):