Opened 10 years ago
Closed 10 years ago
#13418 closed defect (fixed)
No sound output in guest due to bug in dsoundaudio.c
Reported by: | bogdan | Owned by: | |
---|---|---|---|
Component: | audio | Version: | VirtualBox 4.3.16 |
Keywords: | sound | Cc: | |
Guest type: | Windows | Host type: | Windows |
Description
Windows XP SP3 guest, Windows 7 Ultimate 64-bit host
Depending on the particular combination of windows open on the host when the guest is started, there may be no sound output from the guest. This seems to happen because the DirectSound host audio driver fails to initialize.
VBox.log contains the following lines:
Audio: Trying driver 'dsound'. DSound: Could not set cooperative level for window 0000000000000000 Audio: Initialization of driver 'dsound' failed, trying 'dsound'. DSound: Could not set cooperative level for window 0000000000000000 Audio: Initialization of driver 'dsound' failed, trying 'null'.
The problem seems to be caused by the following initialization code in dsoundaudio.c
:
static int dsound_open (dsound *s) { int err; HRESULT hr; WAVEFORMATEX wfx; DSBUFFERDESC dsbd; HWND hwnd; hwnd = GetForegroundWindow (); hr = IDirectSound_SetCooperativeLevel ( s->dsound, hwnd, DSSCL_PRIORITY );
The GetForegroundWindow()
call doesn't look like a good idea, as it will return whatever window happens to be in the foreground at the time. The subsequent call to IDirectSound_SetCooperativeLevel()
may succeed or not, but even when it does, it may modify a window created by another process.
This issue has been brought to light by another problem related to the VM window not being started in the foreground - see Ticket #13417.
Change History (3)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Windows 7 x64 host, Arch linux guest
I'm having this issue with 4.3.18, also. I do use a shortcut/link to launch my client. It's random whether or not I will get audio after startup. In the instances where I don't get audio, I just shutdown and restart (using the same shortcut) until I do. Now I know to always launch from VBox main window until this is fixed (thanks, bogdan!) I had not made that connection before.
The 'bad' case:
00:00:04.614269 Audio: Trying driver 'dsound'. 00:00:04.751894 DSound: Could not set cooperative level for window 0000000000000000 00:00:04.752473 Audio: Initialization of driver 'dsound' failed, trying 'dsound'. 00:00:04.759900 DSound: Could not set cooperative level for window 0000000000000000 00:00:04.760241 Audio: Initialization of driver 'dsound' failed, trying 'null'. 00:00:04.760262 Audio: set_record_source ars=0 als=0 (not implemented)
The 'good' case:
00:00:02.832631 Audio: Trying driver 'dsound'. 00:00:02.934284 Audio: set_record_source ars=0 als=0 (not implemented)
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for the hint! Fixed in VBox 4.3.20 (we are now using the desktop window).
Verified that the problem is still present in 4.3.18.