Skip to content

Commit

Permalink
Completely disable audio devices in case of --no-audio (#904)
Browse files Browse the repository at this point in the history
This way VM won't have empty audio device at all.

This should fix with an issue like that actions/runner-images#9330
  • Loading branch information
fkorotkov authored Sep 17, 2024
1 parent 3da91e6 commit ce23f9c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/tart/VM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,19 @@ class VM: NSObject, VZVirtualMachineDelegate, ObservableObject {
// Audio
let soundDeviceConfiguration = VZVirtioSoundDeviceConfiguration()

let inputAudioStreamConfiguration = VZVirtioSoundDeviceInputStreamConfiguration()
let outputAudioStreamConfiguration = VZVirtioSoundDeviceOutputStreamConfiguration()

if audio && !suspendable {
let inputAudioStreamConfiguration = VZVirtioSoundDeviceInputStreamConfiguration()
let outputAudioStreamConfiguration = VZVirtioSoundDeviceOutputStreamConfiguration()

inputAudioStreamConfiguration.source = VZHostAudioInputStreamSource()
outputAudioStreamConfiguration.sink = VZHostAudioOutputStreamSink()

soundDeviceConfiguration.streams = [inputAudioStreamConfiguration, outputAudioStreamConfiguration]
} else {
// just a null speaker
soundDeviceConfiguration.streams = [VZVirtioSoundDeviceOutputStreamConfiguration()]
}

soundDeviceConfiguration.streams = [inputAudioStreamConfiguration, outputAudioStreamConfiguration]
configuration.audioDevices = [soundDeviceConfiguration]

// Keyboard and mouse
Expand Down

0 comments on commit ce23f9c

Please sign in to comment.