notes on running Zoom in a VM
There's no way I'm letting that stuff on my main OS installs, so I am running it in virtualized Debian Buster in QEMU. Bit tricky getting everything sorted, what with needing passthrough for host OpenGL, USB soundcard, USB webcam, and JACK running in the VM with PulseAudio bridge. I have custom software processing the webcam and sound from the USB soundcard (via JACK), and screensharing the window and system sound (not USB webcam mic, hopefully!) seems to work now.
notes on running Zoom in a VM
Startup script:
```
#!/bin/bash
QEMU_AUDIO_DRV=pa \
QEMU_PA_SAMPLES=8192 \
QEMU_AUDIO_TIMER_PERIOD=99 \
QEMU_PA_SERVER=/run/user/1000/pulse/native \
qemu-system-x86_64 \
-soundhw hda -device qemu-xhci \
-m 8G -hda zoom.img -cpu host -accel kvm -smp 8 \
-vga virtio -display gtk,gl=on -show-cursor -usb -device usb-tablet \
-usb -device usb-host,vendorid=0x041e,productid=0x4095 \
-usb -device usb-host,vendorid=0x0582,productid=0x0074
```
I don't think that PA stuff is really needed any more now that I added usb-host passthrough for my external soundcard.
Don't forget to `chown` the relevant `/dev/bus/usb/foo/bar` device nodes to the user running QEMU, otherwise the passthrough won't work. Use `lsusb` to see bus address and ids. This resets on host reboot, and USB devices can change bus address too (maybe some udev magic could fix it but I don't need to run Zoom often).
notes on running Zoom in a VM
in the VM, configure JACK to use the USB Audio soundcard. Start jackd.
Set up pulseaudio jack bridge:
/etc/pulse/default.pa:
```
load-module module-jack-source
load-module module-jack-sink
set-default-source jack_in
set-default-sink jack_out
```
restart pulse:
```
pulseaudio - -kill
pulseaudio --start
```
if it doesn't work (no `PulseAudio` in qjackctl patch bay in addition to `system`) try
```
pactl load-module module-jack-source
pactl load-module module-jack-sink
```
notes on running Zoom in a VM
Finally start Zoom, and set the settings to share screen with full manual options always. Sound to "same as system", "low" microphone background noise processing ("optimize for music"), don't adjust levels automatically.
Check that Zoom can make noise to the speakers, and hope for the best w.r.t. sharing computer sound when screen sharing (I haven't found a level meter for that...)
Maybe that needs fiddling in Pulse Audio volume controls to get the right sound from the soundcard (disable USB webcam mic) into Zoom (pulse audio jack source seems to do the trick with system X pulseaudio in qjackctl audio connections).
notes on running Zoom in a VM
update: needed to add a second webcam into the setup (first webcam is for custom software processing, screenshared in Zoom; second webcam is for regular chatting in Zoom). tricky to get working. first errors about different speed USB devices (3 devices total, could get only 1 or 2 working at the same time). then once those were solved errors about "v4l no left space on device" which really means insufficient USB bandwidth. managed to solve them by adding more virtual USB controllers in qemu and assigning the devices to those buses explicitly:
```
#!/bin/bash
QEMU_AUDIO_DRV=pa \
QEMU_PA_SAMPLES=8192 \
QEMU_AUDIO_TIMER_PERIOD=99 \
QEMU_PA_SERVER=/run/user/1000/pulse/native \
qemu-system-x86_64 \
-soundhw hda \
-device qemu-xhci,id=xhci -device usb-ehci,id=ehci1 -device usb-ehci,id=ehci2 \
-m 8G -hda zoom.img -cpu host -accel kvm -smp 8 \
-vga virtio -display gtk,gl=on -show-cursor -usb -device usb-tablet \
-usb -device usb-host,vendorid=0x041e,productid=0x4095,bus=ehci1.0 \
-usb -device usb-host,vendorid=0x0582,productid=0x0074,bus=xhci.0 \
-usb -device usb-host,vendorid=0x1908,productid=0x2311,bus=ehci2.0
```
will write a proper blog post about this all soon.
notes on running Zoom in a VM
notes on running Zoom in a VM
finally start or join a meeting, and hope screensharing the visuals window and computer audio does the Right Thing and works at acceptable quality.... fingers crossed... then enjoy the performance!