Guest audio loss on host display suspend

Discussions related to using VirtualBox on Windows hosts.
Post Reply
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Guest audio loss on host display suspend

Post by JamesBanana »

Hi!

Whenever host display gets suspended (enter into power saving mode), there is ~75% chance of guest audio becoming "disabled" with no way to restore it except restarting the guest. While audio is in this "disabled" state, playing any video on guest is slowed to crawl (youtube for example). Furthermore, this can also happen at random while using the host. This is quite rare. In such cases i have found closing web browser on the guest some times helps (i use the VM for browsing the web). But not always.

Host: Win10 1909 (but also same issue on prior w10 versions)
Guest: Win7
VB: 6.1 (same problem was also present already in 6.0 but not in 5.2.x)

Guest additions are matching VB version.

Is this a known problem?
I searched the forum but found nothing relevant.
What can i do to help get this issue solved?
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

Updated to 6.1.2. Problem still present.
Thought maybe it was fixed as my host has 5.1 speakers and changelog mentioned an audio fix regarding multi-speaker configurations.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Guest audio loss on host display suspend

Post by scottgus1 »

I wouldn't be sure what to search for myself, though I have learned that the forum search is fairly worthless, and forum gurus use "site:forums.virtualbox.org" attached to their search terms on a regular web search (Google, Bing, etc.) to get stronger search results.

That said, the guest 'hardware' exists virtually, in the 'aether' so to speak, on the host. When the host goes power-saving, something has to happen to the guest. Also the host CPU exists in the guest directly, without being virtualized. So if the guest is humming along than all of a sudden part of its hardware goes sluggish, or if it thinks it can continue to process certain levels of data then all of a sudden can't & hasn't been told why, the guest OS could get squiffy.

My work-around would be, don't let the host go on power-save when the guest is running. If Virtualbox has anything programmed to tell the guest to respond better to host-power-save, maybe something could be seen in the guest vbox.log (zipped & posted via the forum's Upload Attachment tab). Try to pull a complete log from guest cold boot (not save-state), to full log-in & good running, to host power-save, to guest showing bad performance, to guest full shutdown.
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

Hi Scott!

Thank you for replying.
I did search using search engine as you suggest. Due to many choppy audio problems with VB in the past, it is next to impossible to find something relevant (I also experienced choppy audio in the past but this seems to fixed in VB 6+).

The host does not go to power saving mode. Only the display gets suspended. This is intentional configuration. And i do want to have the display in power save mode (for example, over night).

Also, when i lock the host after finishing work, i usually also pause the guest VM beforehand. This does not appear to affect how often the problem manifests.

I have found that in roughly 1 out of 3 times, i am able to get the audio back if i exit Firefox in the guest. This seems strange at first but i'm guessing FF is keeping some handles open which in turn keeps the guest audio driver engaged.

I test if audio is working by adjusting guest volume level. This causes a 'ding' sound when things are working.

I will work on generating a log file next.
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

I was now able to produce the log file as requested.

It took three attempts. Each time doing nearly same things:
- play some audio (first time just volume control ding, second time watched a video with Firefox until end, third time watched video for few minutes, then paused)
- paused the guest VM
- locked the host and waited until display gets suspended (when locked then delay is just 1 minute)
- woke display by moving mouse, unlocked, resumed guest
- tested audio with guest volume control slider

After first attempt, audio was still present. Started browser to play some video.
After second attempt, sound output was lost. Closed Firefox. Sound output was restored. Started firefox again to play some video file with sound.
After third attempt, sound output was lost. Closed Firefox. Sound output was not restored. From this point only restart of guest helps.

After third attempt i shut down the guest and zipped up the log file attached to this post.

Somewhere near logging these two lines seems to be the place where things go wrong (judging by timing, first is from when display is suspended and second when woken up):
00:02:18.290237 Audio: Device configuration of driver 'DSoundAudio' has changed
00:02:45.139687 Audio: Device configuration of driver 'DSoundAudio' has changed

Thoughts?
Attachments
VBox.zip
(33.6 KiB) Downloaded 14 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Guest audio loss on host display suspend

Post by scottgus1 »

I don't see anything particularly unusual that I could put a finger on. I do see the three pauses. Interestingly, there's "DSound" errors over the "sound capture device" after the first two pauses, where you were able to get the audio back, but no such errors after the third, where your audio was gone for good.

Windows 7 has a sound level indicator in the volume control, the bouncing light bar that gets taller the louder the audio is. When you lose audio in the Windows 7 guest, does the light bar still bounce? If you have or can put some free audio recording software in the guest (Audacity?) can you record the audio coming from the audio producer while the audio is gone?

Additionally, I may have read wrong, but it seems that you are always using Firefox when this happens. What about other browsers? Other audio-producing programs (Windows Media Player? Winamp?)

In the status bar of the guest window there is a speaker/microphone icon. You can turn on/off line in/out. Try toggling these settings when audio goes south on you.
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

Thank you for looking into it!

In this particular guest the green bouncing bar is not drawn at all for some reason. I know it should be. It does not matter if audio is working or not.

In another W7 guest WM, the sound indication is working. It is working even when audio is currently lost (this problem happens in this other VM also and i'm not using Firefox there at all).

I have tried toggling the audio output on and off. For this problem it does not help. It is useful when there is choppy audio. I've had it happen only 2-3 times with VB version 6.x.

I'll try to record with Audacity while the issue is manifesting.
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

scottgus1 wrote:If you have or can put some free audio recording software in the guest (Audacity?) can you record the audio coming from the audio producer while the audio is gone?
I was able to record audio in the guest while none was heard in host. I used Audacity. Selected Windows WASAPI and Speakers as recording source.
What can be deduced from that?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Guest audio loss on host display suspend

Post by scottgus1 »

I deduce that it is not a failure in the guest OS that causes the audio failure.

However, I have no idea how to proceed further. Unless anyone else has a thought, maybe a post on the Bugtracker might not be amiss.
fth0
Volunteer
Posts: 5630
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Guest audio loss on host display suspend

Post by fth0 »

scottgus1 wrote:I do see the three pauses. Interestingly, there's "DSound" errors over the "sound capture device" after the first two pauses, where you were able to get the audio back, but no such errors after the third, where your audio was gone for good.
Those DSound errors are different (in number and type) nearly each time they occur. I'd guess they have to do with giving no audio input to the VM. Does the problem also occur when audio input is enabled in the VM configuration?
VBox.log file wrote:
00:00:02.692165 Audio: Found 3 devices for driver 'DSoundAudio'
00:00:02.692170 Audio: Device 'Primary Sound Driver':
00:00:02.692185 Audio: Device 'Realtek Digital Output (Realtek High Definition Audio)':
00:00:02.692205 Audio: Device 'BenQ PD3200Q (Intel(R) Display Audio)':
[...]
00:33:14.691371 Changing the VM state from 'SUSPENDING' to 'SUSPENDED'
00:33:14.691381 Console: Machine state changed to 'Paused'
00:34:14.597421 Audio: Device configuration of driver 'DSoundAudio' has changed
00:34:29.382356 Audio: Device configuration of driver 'DSoundAudio' has changed
00:34:35.100605 Changing the VM state from 'SUSPENDED' to 'RESUMING'
The display is one of the three possible audio output destinations on the host, so there is a possible connection between the display (un-)suspending and the audio output path. The two DSoundAudio has changed messages both occur during each VM suspension, and the timestamps suggest they are caused by the display (un-)suspending. @JamesBanana: You could experiment with different audio output settings in the host OS, and/or take a look at log messages inside the Windows Event Viewer.

Another idea to try: Investigating audio problems

Edit:
Yet another idea: Can you try and reproduce the problem on your host alone (without using VirtualBox at all)? Background rationale: There have been people with issues regarding the combination of an HDMI display connection and power management functionalities in the past.
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

Hi fth0!

Thank you for taking an interest!
fth0 wrote:Those DSound errors are different (in number and type) nearly each time they occur. I'd guess they have to do with giving no audio input to the VM. Does the problem also occur when audio input is enabled in the VM configuration?
You might be on to something here. I enabled audio input and after 10 successive attempts, the audio is still working. I'll report back once that changes.
fth0 wrote:The display is one of the three possible audio output destinations on the host, so there is a possible connection between the display (un-)suspending and the audio output path. The two DSoundAudio has changed messages both occur during each VM suspension, and the timestamps suggest they are caused by the display (un-)suspending. @JamesBanana: You could experiment with different audio output settings in the host OS, and/or take a look at log messages inside the Windows Event Viewer.
I have disabled Intel Display Audio device which caused the BenQ PD3200Q output to disappear from host. It had no effect on this issue. But that silenced an annoying power brick background hum :)
fth0 wrote:Another idea to try: Investigating audio problems
Ignoring that for the time being.
fth0 wrote:Yet another idea: Can you try and reproduce the problem on your host alone (without using VirtualBox at all)? Background rationale: There have been people with issues regarding the combination of an HDMI display connection and power management functionalities in the past.
No, i can not. Host sound always works just fine.
I also have had HDMI+Power management issues. I found out that W10 uses a dummy display driver while HDMI output is asleep. Initially this driver had other dimensions which caused desktop and all opened app windows to get resized each time after display suspend (i had to manually correct the suspend-time dimensions using regedit). Additionally, the USB hub on the display also gets powered down and removed when display suspends which causes all downstream USB devices to disconnect with USB unplugged sound. Which in turn caused W10 to wake the display again. An endless cycle resulted. I'm not sure if this is fixed in W10-1909 (i no longer use the display hub for that reason).
So yes.. lot's of problems with HDMI display connection.

I made a further discovery when recording guest audio with Audacity. When i change WASAPI recording source from speakers to microphone and back to speakers, the non-functioning audio gets restored. Even without closing Firefox. I'm not sure if i can say yet that this is so 100% of times. Will update as soon as this turns out to be untrue. Seems to me this allows to conclude that host is sending some sort of signal to guest when display is suspended and guest is failing to handle that correctly (problem is in the guest?). Furthermore, this being an intermittently manifesting problem, i would further speculate this is some sort of invalid memory access (a device handle getting invalidated unexpectedly?).

Regards,
SN
JamesBanana
Posts: 9
Joined: 15. Jan 2020, 04:20

Re: Guest audio loss on host display suspend

Post by JamesBanana »

Hi again!
JamesBanana wrote:
fth0 wrote:Those DSound errors are different (in number and type) nearly each time they occur. I'd guess they have to do with giving no audio input to the VM. Does the problem also occur when audio input is enabled in the VM configuration?
You might be on to something here. I enabled audio input and after 10 successive attempts, the audio is still working. I'll report back once that changes.
I've now restarted the host and guests and gone thru numerous display suspend-resume cycles. When audio input is enabled then the problem does not manifest.

While the issue is now solved for me, i still think this is a bug and should get fixed.
I assume i can use my forum login to make a report in bugtracker too?
Is it ok to give minimal description in tracker and refer to this forum topic for details or should the report be complete?
If anyone else wants to make a report from this then that would be great too :)

Thank you both for helping me!
Last edited by JamesBanana on 23. Jan 2020, 01:32, edited 1 time in total.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Guest audio loss on host display suspend

Post by scottgus1 »

A bug tracker report might be helpful. I find that my forum login works, but you might need to actually register once first to post a ticket. You should post a log there, with sufficient description of the problem and workarounds developed. A link back to this thread would be good too.
Air Force One
Posts: 105
Joined: 6. Oct 2017, 16:54
Primary OS: MS Windows other
VBox Version: PUEL
Guest OSses: Windows
Location: Germany

Re: Guest audio loss on host display suspend

Post by Air Force One »

Take a look at the #18594 and the version 6.1.17 build 141128. This one looks like to be solved.
Post Reply