Refresh integrated playtest packages and handle disappearing test audio streams
This commit is contained in:
+17
-1
@@ -196,7 +196,23 @@ def quiet_streams(application_id, sink, compat):
|
||||
pass
|
||||
if owned:
|
||||
for args in [['move-sink-input', str(stream['index']), sink], ['set-sink-input-mute', str(stream['index']), '1']]:
|
||||
subprocess.run(['pactl', *args], check=True, timeout=5, stdout=subprocess.DEVNULL)
|
||||
try:
|
||||
subprocess.run(['pactl', *args], check=True, timeout=5, stdout=subprocess.DEVNULL)
|
||||
except subprocess.CalledProcessError as operation_error:
|
||||
# Short-lived startup streams can close between listing and
|
||||
# routing/muting. Only a fresh, well-formed absence proves
|
||||
# this race harmless; a present stream or failed read fails.
|
||||
try:
|
||||
current = json.loads(subprocess.check_output(['pactl', '-f', 'json', 'list', 'sink-inputs'], text=True, timeout=5))
|
||||
except (OSError, subprocess.SubprocessError, ValueError) as verification_error:
|
||||
raise operation_error from verification_error
|
||||
if (not isinstance(current, list)
|
||||
or any(not isinstance(item, dict) or type(item.get('index')) is not int or item['index'] < 0 for item in current)
|
||||
or any(str(item['index']) == str(stream['index']) for item in current)):
|
||||
raise
|
||||
# Do not issue the remaining operation against a vanished
|
||||
# index, or touch any newly listed/unrelated stream.
|
||||
break
|
||||
|
||||
|
||||
def run_project(steam, compat, session, project, timeout, authored, silent_workbench=False, exit_after_init=False):
|
||||
|
||||
Reference in New Issue
Block a user