VLC crashes on Win32 if no audio devices found
The VLC 2.1 and 2.0 nightlies (git) crash on Windows if no audio device is present. This is breaking VLC usage as a streaming server since it can't open anything without a mutex crash.
Steps to reproduce
- Close VLC if open
- Open "Device Manager".
- Disable, remove or unplug any audio devices.
- Open VLC
- Play any media
Expected result: VLC plays the video portion with silence Result: Big crash
$ gdb ./vlc
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from z:\vlc-2.1.0-git\vlc.exe...done.
(gdb) run -I qt4 -vvv
Starting program: z:\vlc-2.1.0-git\vlc.exe -I qt4 -vvv
[New Thread 316.0x5d8]
[New Thread 316.0x414]
warning: VLC media player - 2.1.0-git Rincewind
warning: Copyright ┬® 1996-2012 the VideoLAN team
warning: revision f7a9338
warning: configured with ../extras/package/win32/../../../configure '--disable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-portaudio' '--disable-sdl' '--enable-qt4' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-sqlite' '--disable-dirac' '--host=i586-mingw32msvc' '--enable-debug' 'host_alias=i586-mingw32msvc'
warning: searching plug-in modules
warning: loading plugins cache file z:\vlc-2.1.0-git\plugins\plugins.dat
warning: recursively browsing `z:\vlc-2.1.0-git\plugins'
warning: saving plugins cache z:\vlc-2.1.0-git\plugins\plugins.dat
warning: plug-ins loaded: 388 modules
warning: opening config file (z:\vlc\vlcrc)
warning: translation test: code is "C"
warning: CPU has capabilities MMX 3DNow! MMXEXT SSE SSE2 SSE3 FPU
warning: looking for memcpy module: 4 candidates
warning: using memcpy module "memcpymmxext"
warning: Creating an input for 'Media Library'
warning: Input is a meta file: disabling unneeded options
warning: using timeshift granularity of 50 MiB, in path 'C:\WINDOWS\Temp'
warning: `file/xspf-open:///Z:/vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Z:/vlc/ml.xspf'
warning: creating demux: access='file' demux='xspf-open' location='/Z:/vlc/ml.xspf' file='z:\vlc\ml.xspf'
warning: looking for access_demux module: 3 candidates
warning: no access_demux module matching "file" could be loaded
warning: creating access 'file' location='/Z:/vlc/ml.xspf', path='z:\vlc\ml.xspf'
warning: looking for access module: 3 candidates
warning: opening file `z:\vlc\ml.xspf'
warning: using access module "filesystem"
warning: Using stream method for AStream*
warning: starting pre-buffering
warning: received first data after 0 ms
warning: pre-buffering done 304 bytes in 0s - 475 KiB/s
warning: looking for stream_filter module: 4 candidates
warning: no stream_filter module matching "any" could be loaded
warning: looking for stream_filter module: 1 candidate
warning: using stream_filter module "stream_filter_record"
warning: creating demux: access='file' demux='xspf-open' location='/Z:/vlc/ml.xspf' file='z:\vlc\ml.xspf'
warning: looking for demux module: 1 candidate
warning: using XSPF playlist reader
warning: using demux module "playlist"
warning: looking for meta reader module: 2 candidates
warning: Trying Lua scripts in z:\vlc\lua\meta\reader
warning: Trying Lua scripts in z:\vlc-2.1.0-git\lua\meta\reader
warning: Trying Lua playlist script z:\vlc-2.1.0-git\lua\meta\reader\filename.luac
warning: no meta reader module matching "any" could be loaded
warning: `file/xspf-open:///Z:/vlc/ml.xspf' successfully opened
warning: looking for xml reader module: 1 candidate
warning: using xml reader module "xml"
warning: parsed 0 tracks successfully
warning: EOF reached
warning: removing module "playlist"
warning: removing module "stream_filter_record"
warning: removing module "filesystem"
warning: Destroying the input for 'Media Library'
warning: one instance mode ENABLED
[New Thread 316.0x1c8]
warning: looking for interface module: 1 candidate
warning: using interface module "hotkeys"
warning: looking for interface module: 1 candidate
[New Thread 316.0x510]
warning: using interface module "globalhotkeys"
warning: looking for interface module: 1 candidate
[New Thread 316.0x110]
warning: playlist threads correctly activated
warning: looking for extension module: 1 candidate
warning: Opening Lua Extension module
warning: Trying Lua scripts in z:\vlc\lua\extensions
warning: Trying Lua scripts in z:\vlc-2.1.0-git\lua\extensions
warning: Trying Lua playlist script z:\vlc-2.1.0-git\lua\extensions\allocine-fr.luac
warning: Scanning Lua script z:\vlc-2.1.0-git\lua\extensions\allocine-fr.luac
warning: Script z:\vlc-2.1.0-git\lua\extensions\allocine-fr.luac has the following capability flags: 0xc
warning: using extension module "lua"
[New Thread 316.0x3ec]
warning: rebuilding array of current - root Playlist
warning: rebuild done - 0 items, index -1
[New Thread 316.0x604]
[New Thread 316.0x590]
warning: using interface module "qt4"
[New Thread 316.0x4f4]
warning: adding item `10 - Stardust Road.flac' ( file:///Z:/tempdir/10%20-%20Stardust%20Road.flac )
warning: Adding a new MRL to recent ones: file:///Z:/tempdir/10%20-%20Stardust%20Road.flac
warning: rebuilding array of current - root Playlist
warning: rebuild done - 1 items, index -1
warning: processing request item: 10 - Stardust Road.flac, node: null, skip: 0
warning: resyncing on 10 - Stardust Road.flac
warning: 10 - Stardust Road.flac is at 0
warning: starting playback of the new playlist item
warning: creating new input thread
warning: Creating an input for '10 - Stardust Road.flac'
[New Thread 316.0x74c]
warning: Creating an input for '10 - Stardust Road.flac'
[New Thread 316.0x6a0]
warning: using timeshift granularity of 50 MiB, in path 'C:\WINDOWS\Temp'
warning: `file:///Z:/tempdir/10%20-%20Stardust%20Road.flac' gives access `file'
demux `' path `/Z:/tempdir/10%20-%20Stardust%20Road.flac'
warning: creating demux: access='file' demux='' location='/Z:/tempdir/10%20-%20Stardust%20Road.flac' file='Z:\tempdir\10 - Stardust Road.flac'
warning: looking for access_demux module: 3 candidates
warning: no access_demux module matching "file" could be loaded
warning: creating access 'file' location='/Z:/tempdir/10%20-%20Stardust%20Road.flac', path='Z:\tempdir\10 - Stardust Road.flac'
warning: looking for access module: 3 candidates
warning: opening file `Z:\tempdir\10 - Stardust Road.flac'
warning: using access module "filesystem"
warning: Using stream method for AStream*
warning: starting pre-buffering
warning: received first data after 0 ms
warning: pre-buffering done 1024 bytes in 0s - 3322 KiB/s
warning: looking for stream_filter module: 4 candidates
warning: no stream_filter module matching "any" could be loaded
warning: looking for stream_filter module: 1 candidate
warning: using stream_filter module "stream_filter_record"
warning: creating demux: access='file' demux='' location='/Z:/tempdir/10%20-%20Stardust%20Road.flac' file='Z:\tempdir\10 - Stardust Road.flac'
warning: looking for demux module: 55 candidates
warning: looking for packetizer module: 21 candidates
warning: using packetizer module "packetizer_flac"
warning: using demux module "flacsys"
warning: IM: Setting an input
warning: looking for a subtitle file in Z:\tempdir
warning: looking for meta reader module: 2 candidates
warning: no fetch required for [#10](https://code.videolan.org/videolan/vlc/-/issues/10) - Stardust Road (art currently (null))
warning: using meta reader module "taglib"
warning: removing module "taglib"
warning: `file:///Z:/tempdir/10%20-%20Stardust%20Road.flac' successfully opened
warning: selecting program id=0
warning: looking for decoder module: 31 candidates
warning: using decoder module "flac"
[New Thread 316.0x4ec]
warning: Buffering 0%
warning: decode STREAMINFO
warning: channels:2 samplerate:44100 bitspersamples:16
warning: STREAMINFO decoded
warning: creating audio output
warning: looking for audio output module: 2 candidates
warning: Opening DirectSound Audio Output
warning: Buffering 9%
warning: Buffering 18%
warning: Buffering 27%
warning: Buffering 37%
warning: Buffering 46%
warning: Buffering 55%
warning: Buffering 65%
warning: Buffering 74%
warning: Buffering 83%
warning: Buffering 92%
warning: Stream buffering done (1021 ms in 134 ms)
warning: found device: Primary Sound Driver
warning: cannot create a direct sound device
warning: cannot initialize DirectSound
warning: closing audio device
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 316.0x4ec]
0x77c35b62 in msvcrt!_assert () from C:\WINDOWS\system32\msvcrt.dll
(gdb) bt
[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x77c35b62 in msvcrt!_assert () from C:\WINDOWS\system32\msvcrt.dll
[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x6a5d336a in vlc_mutex_destroy (p_mutex=0x4)
at ../../extras/package/win32/../../../src/win32/thread.c:175
[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x6b24175b in CloseAudioCommon (p_this=<optimized out>)
at ../../../extras/package/win32/../../../modules/audio_output/directx.c:622
[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x6b242a77 in OpenAudio (p_this=0x3acd448)
at ../../../extras/package/win32/../../../modules/audio_output/directx.c:326
[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x6a5b8d1c in vlc_module_load (p_this=0x3acd448,
psz_capability=0x6a626df2 "audio output", psz_name=0x3a8bf58 "",
b_strict=false, probe=0x6a5b8340 <generic_start>)
at ../../extras/package/win32/../../../src/modules/modules.c:342
[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0x6a5b9044 in module_need (obj=0x3acd448, cap=0x6a626df2 "audio output",
name=0x6a626dec "$aout", strict=<optimized out>)
at ../../extras/package/win32/../../../src/modules/modules.c:428
[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x6a5a5a7e in aout_OutputNew (p_aout=0x3acd448, p_format=0x4e6fbe4)
at ../../extras/package/win32/../../../src/audio_output/output.c:59
[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0x6a5a2c33 in aout_DecNew (p_aout=0x3acd448, p_format=0x4e6fbe4,
p_replay_gain=0x3aabd34, p_request_vout=0x4e6fc10)
at ../../extras/package/win32/../../../src/audio_output/dec.c:112
[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x6a5691b0 in aout_new_buffer (p_dec=0x3aabb90, i_samples=4096)
at ../../extras/package/win32/../../../src/input/decoder.c:2250
[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x62782587 in DecoderWriteCallback (decoder=0x3aad770, frame=0x3aaa110,
buffer=0x3aa9cdc, client_data=0x3aabb90)
at ../../../extras/package/win32/../../../modules/codec/flac.c:212
[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x6279124e in read_frame_ ()
from z:\vlc-2.1.0-git\plugins\codec\libflac_plugin.dll
[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0x6279167e in FLAC__stream_decoder_process_single ()
from z:\vlc-2.1.0-git\plugins\codec\libflac_plugin.dll
[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0x62781f5b in DecodeBlock (p_dec=0x3aabb90, pp_block=0x4e6fe74)
at ../../../extras/package/win32/../../../modules/codec/flac.c:551
[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0x6a56a039 in DecoderDecodeAudio (p_dec=0x3aabb90, p_block=0x0)
at ../../extras/package/win32/../../../src/input/decoder.c:1270
[#14](https://code.videolan.org/videolan/vlc/-/issues/14) 0x6a56af29 in DecoderProcessAudio (b_flush=<optimized out>,
p_block=0x3ac6d38, p_dec=<optimized out>)
at ../../extras/package/win32/../../../src/input/decoder.c:1902
[#15](https://code.videolan.org/videolan/vlc/-/issues/15) DecoderProcess (p_dec=0x3aabb90, p_block=0x250608)
at ../../extras/package/win32/../../../src/input/decoder.c:2023
[#16](https://code.videolan.org/videolan/vlc/-/issues/16) 0x6a56b049 in DecoderThread (p_data=0x3aabb90)
at ../../extras/package/win32/../../../src/input/decoder.c:938
[#17](https://code.videolan.org/videolan/vlc/-/issues/17) 0x6a5d2de9 in vlc_entry (p=0x3a90258)
at ../../extras/package/win32/../../../src/win32/thread.c:567
[#18](https://code.videolan.org/videolan/vlc/-/issues/18) 0x77c3a3b0 in msvcrt!_endthreadex () from C:\WINDOWS\system32\msvcrt.dll
[#19](https://code.videolan.org/videolan/vlc/-/issues/19) 0x7c80b713 in KERNEL32!GetModuleFileNameA ()
from C:\WINDOWS\system32\kernel32.dll
[#20](https://code.videolan.org/videolan/vlc/-/issues/20) 0x00000000 in ?? ()
(gdb)