VM Sound Sync Issues HTML5 Youtube videos


Recommended Posts

I've noticed that my VM Windows 10 UEFI machine suffers from Audio Sync issues when playing videos from youtube flash videos. I thought it was the browser but I tried to reproduce this on another VM running, but played the youtube video through remote desktop. The RDP video never lost sync but running it on my physical machine just losses sync after 7 minutes. Changing primary sound device fixes it. When switching between the two TVs with HDMI audio output. It even happens to the onboard audio (Sounds scratchy and buggy)

 

This happens on Opera browser

 

Motherboard: Sabertooth X79

GPU: Radeon RX 480

Audio: HDMI GPU Pass through

 

Has anyone else encountered this issue? Also is the sound quality better using a PCI-e sound card? I just wonder if this audio sync is buggy with certain apps when using the GPU audio.

 

Thanks

Link to comment

I looked at the notes you suggested and found that the MSI Interrupt is already enabled for my video card RX 480. Its very disappointing and annoying. It affects any application that streams audio. Video Files play fine without the issue.

 

I got to keep the Playback devices up and handy to constantly switch. When I switch playback devices, syncs with video but eventually will need to constantly do this.

Link to comment

Just an update, when assigning paired cores to my VM, the lag in streaming video significantly reduced. It stutters just a bit but its an improvement. Audio syncs went from D- to now a B-

 

Also the Dashboard helped in picking cores. In my case, 0+6, 1+7, 2+8, 3+9

 

It does still stutter but now it be start to happen at 10+ minutes of playing time. I assigned 8 cores to my VM, might reduce it to 4 maybe? I'll play around with that and RAM. I'm running 12GB of RAM to my main VM with GPU passthrough.

 

I didn't unassign cores to Unraid. You know, make certain cores exclusive to the VM. I might experiment with that but thanks alot for your suggestion. Helped alot and now the annoyance isn't as obvious.

 

 

Link to comment

You may want to try adding this to your VM templet <emulatorpin cpuset='X,X'/>

 

X is the CPU given to UNRAID

 

I am sitting on two AMD R9 380X cards because they just don't work well. If you can, jump to the Nvidia cards, you should have a much better user experience.

 

Also try disabling the MSI interrupt to see what happens and I found passing through the enter hard disk to the VM has improved my audio issues with or without using the MSI interrupt for a gaming VM. I currently run two of them without sound issues.

 

I totally know your pain, it took me many months to get everything working smooth with sound being a big issue. Just had a successful LAN party over BlizzCon and now all my buddies want an UNRAID system.

 

My setup still has some issues with USB controller being passed through to a VM but other than that, I am really happy with the overall system.

 

I can post my setup information if I get time but only if you think it can help, just let me know.

Link to comment

As I added more services and dockers, the assigned cores just didn't cut it anymore. I did some testing and discovered that audio through bluetooth is very reliable. I ended up taking a Sound Bar that I never used and made that the new speakers for my main physical VM. It does still glitch but it's night and day compared to the GPU Audio passthrough. It was driving me crazy especially with Plex streaming. I was considering getting a bluetooth speaker but Soundbar was just a better idea.

 

 

Sabertooth X79

3930k

RX 480 Sapphire

64GB RAM

1 TB SSD Samsung Evo 850

 

I'll keep investigating to try and get to the bottom of this. Its really the only issue I have with my setup, that and trying to find some other Network Card to bridge with on virtualbox and VMWare.

 

I run the VM on SSD and passthrough two hard drives, one for gaming and another for just data storage. Again, staying on topic, the audio just is a bummer.

 

<domain type='kvm' id='4'>
  <name>Windows 10 Sabertooth</name>
  <uuid>2112d1e7-bdac-d300-25f4-06f1e748828e</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>12582912</memory>
  <currentMemory unit='KiB'>12582912</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
    <vcpupin vcpu='2' cpuset='2'/>
    <vcpupin vcpu='3' cpuset='3'/>
    <vcpupin vcpu='4' cpuset='6'/>
    <vcpupin vcpu='5' cpuset='7'/>
    <vcpupin vcpu='6' cpuset='8'/>
    <vcpupin vcpu='7' cpuset='9'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/2112d1e7-bdac-d300-25f4-06f1e748828e_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor id='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 10 Sabertooth/vdisk1-WIND.img'/>
      <backingStore/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD40EZRX-00SPEB0_WD-WCC4ECJVZKZ2'/>
      <backingStore/>
      <target dev='hdd' bus='virtio'/>
      <alias name='virtio-disk3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD40EZRX-00SPEB0_WD-WCC4E4VL5SE6'/>
      <backingStore/>
      <target dev='hde' bus='virtio'/>
      <alias name='virtio-disk4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/win-pe/WinPE-Win8.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.118-2.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:44:09:84'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-Windows 10 Sabertooth/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <rom file='/mnt/user/isos/gpu/Sapphire.RX480.8192.160802.rom'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
      </source>
      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Link to comment

For me, pinning and isolating cpus is what solved this issue. See :  https://lime-technology.com/forum/index.php?topic=49051.0

 

Your post was solid.

 

In the end, the lag and sound latency is caused by using the Cache drive for running the VM. If instead you pass the full HD to the VM, the sound delay latency is gone. This is the issue. Not even all the extra VM and plugins and extra services, and Windows Updating all while doing this!!!!!!!!

 

To Admins, if you are reading this, the lag delay in sound when streaming videos wasn't caused by AMD Video card, but more with running the OS inside Unraid cache drive. Even with an Evo 850 Pro, the sound suffers in virtualization.

 

I'm posting my experiences to your main thread.

Link to comment

I am glad it is working for you and sorry if my one post was some what misleading. What I was trying to get at was my audio was fixed by keeping a solid state drive outside of the UNRAID system and then pass the solid state drive right to the VM.

 

Another benefit I found was that when I went to install Windows 10, it saw the solid state drive so I did not have to give it the virtIO drivers.

 

On the AMD card, I believe most users have issues with them in general. Are you able to shut down the VM that is using the AMD card and then power it back on? I get a black screen when I do this and have to reboot the host to get the VM with the R9 380X assigned to it so I switched to a Nvidia card and the issue went away.

Link to comment

After more thorough testing, it turns out the sound lag is still there even pass through my physical machine's HD to the KVM.

 

Its still bugs me but the sound bar with Bluetooth output is way better so I'm using that. Still I will have to test and see if this issue is related to AMD's GPU. I gave away my Nvidia 750ti before so I have no means of testing this.

 

Thanks for all your help and input.

Link to comment
  • 4 months later...

I have actually witnessed what I think is this issue as well, but it's not consistent and depends on the content you're watching.  Not sure if this is a VM-specific issue or not yet, but will keep looking into it.  It's odd that it only seems to affect HTML5-based video applications.

Link to comment
29 minutes ago, saarg said:

 

What have you tried so far to solve it? 

nothing specific, but msi patch is applied and 4 cores are pinned to the VM (not isolated). 

Running(!) VM XML (WTH is this dac stuff at the end? - its not in there when the VM is stopped):

<domain type='kvm' id='3'>
  <name>Windowskiste</name>
  <uuid>c1dcde0b-fdcc-55dc-6f95-dfb65f22e7ee</uuid>
  <description>Windowskiste</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='3'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='7'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.7'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/c1dcde0b-fdcc-55dc-6f95-dfb65f22e7ee_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windowskiste/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/de_windows_10_multiple_editions_version_1607_updated_jul_2016_x64_dvd_9053906.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.126-2.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='nec-xhci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:49:6f:6a'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-3-Windowskiste/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc52b'/>
        <address bus='1' device='2'/>
      </source>
      <alias name='hostdev3'/>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0e8d'/>
        <product id='0x1887'/>
        <address bus='1' device='6'/>
      </source>
      <alias name='hostdev4'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1d19'/>
        <product id='0x0100'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev5'/>
      <address type='usb' bus='0' port='3'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x28de'/>
        <product id='0x1142'/>
        <address bus='1' device='4'/>
      </source>
      <alias name='hostdev6'/>
      <address type='usb' bus='0' port='4'/>
    </hostdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

 

Edited by me.so.bad
Link to comment

 

3 minutes ago, 1812 said:

isolate the cores for your vm from unraid. retest. when confirmed fixed, send beer.

 

if still not fixed, send beer for the real answer!

Isnt Core Isolation more of an workaround? But I'll check if it fixes is.
 

42 minutes ago, saarg said:

Did you confirm that the MSI fix was applied? 

How is your core pairs arranged? Graphics drivers updated? 

Yes, Cores 2&6,3&7 (so Core 2 & 3 + HT), Yes

Link to comment
On 3/28/2017 at 8:43 PM, jonp said:

I have actually witnessed what I think is this issue as well, but it's not consistent and depends on the content you're watching.  Not sure if this is a VM-specific issue or not yet, but will keep looking into it.  It's odd that it only seems to affect HTML5-based video applications.

 

I have the same issue on my server setup right now Jon.

 

All the suggested fixes have been tested inside out. I'm using HDMI Pass Thru for the sound card on the same GPU that is passed through to the VM.

With this sound card enabled the VM is actually quite laggy but especially noticeable on HTML5 youtube videos where the buffering is very slow and audio very delayed.

Removing the sound card and restarting the VM instantly fixes it.

 

Happy to help debug this remotely if you need anything from me in terms of logs as I can re-create this again and again consistently.

 

I've also tested different browsers, same issue ;)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.