diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2016-02-26 06:58:09 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2016-02-26 15:43:51 -0800 |
commit | 84a3c21beb2f3360e4fda13179846406b4a24f7c (patch) | |
tree | 8c5e705a7d2adce3d521c88a51b6c104caee87c6 /audio/out/ao_wasapi.h | |
parent | 31539884c829a0d2aec63d85647110282234a27a (diff) | |
download | mpv-84a3c21beb2f3360e4fda13179846406b4a24f7c.tar.bz2 mpv-84a3c21beb2f3360e4fda13179846406b4a24f7c.tar.xz |
ao_wasapi: replace laggy COM messaging with mp_dispatch_queue
A COM message loop is apparently totally inappropriate for a low latency
thread. It leads to audio glitches because the thread doesn't wake up fast
enough when it should. It also causes mysterious correlations between the vo
and ao thread (i.e., toggling fullscreen delays audio feed events). Instead use
an mp_dispatch_queue to set/get volume/mute/session display name from the audio
thread. This has the added benefit of obviating the need to marshal the
associated interfaces from the audio thread.
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rw-r--r-- | audio/out/ao_wasapi.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index c1181450a3..3ae50159b3 100644 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -66,6 +66,7 @@ typedef struct wasapi_state { HANDLE hAudioThread; // the audio thread itself HANDLE hWake; // thread wakeup event atomic_int thread_state; // enum wasapi_thread_state (what to do on wakeup) + struct mp_dispatch_queue *dispatch; // for volume/mute/session display // for setting the audio thread priority HANDLE hTask; @@ -83,25 +84,12 @@ typedef struct wasapi_state { UINT64 clock_frequency; // scale for position returned by GetPosition LARGE_INTEGER qpc_frequency; // frequency of Windows' high resolution timer - // WASAPI control (handles owned by audio thread but used by main thread) + // WASAPI control IAudioSessionControl *pSessionControl; // setting the stream title IAudioEndpointVolume *pEndpointVolume; // exclusive mode volume/mute ISimpleAudioVolume *pAudioVolume; // shared mode volume/mute DWORD vol_hw_support; // is hardware volume supported for exclusive-mode? - // Streams used to marshal the proxy objects. The thread owning the actual - // objects needs to marshal proxy objects into these streams, and the thread - // that wants the proxies unmarshals them from here. - IStream *sSessionControl; - IStream *sEndpointVolume; - IStream *sAudioVolume; - - // WASAPI proxy handles, for Single-Threaded Apartment communication. One is - // needed for each audio thread object that's accessed from the main thread. - IAudioSessionControl *pSessionControlProxy; - IAudioEndpointVolume *pEndpointVolumeProxy; - ISimpleAudioVolume *pAudioVolumeProxy; - // ao options int opt_exclusive; int opt_list; |