I transcode to a file as well as duplicate the display to the a window in my ui (via dshow). In my ui I have a volume slider. This volume slider sets the volume of the audio session via the wasapi. It is vlc that initializes this audio session when it starts the audio output stream. Everything works fine on windows 7. But when I get to windows 8, various flaky things happen whenever I access anything to do with the audio session (various wasapi calls). I believe the problem might be related to this:
I noticed the following message on Microsoft's online document page ( http://msdn.microsoft.com/en-us/library ... 85%29.aspx ):
---------------------
Note In Windows 8, the first use of IAudioClient to access the audio device should be on the STA thread. Calls from an MTA thread may result in undefined behavior.
I looked at the wasapi vlc code, and sure enough we are initialising the audio client on a mta apartment (D:\vlc_source\modules\audio_output\winstore.c):
static void EnterMTA(void)
{
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (unlikely(FAILED(hr)))
abort();
}
To make this a STA apartment, we need to change the parameter from COINIT_MULTITHREADED to COINIT_APARTMENTTHREADED
I have the source checked out, but I don't have a windows build environment setup, nor am I a contributor.