diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-18 04:33:49 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-18 05:03:33 -0800 |
commit | 19e9c9d1be1673294420f6965bcdbb1c40b046b6 (patch) | |
tree | 15de9b0be17c1005699cbfdeffb60e36d5f97e8f /audio/out | |
parent | c545c406fa8d5d12391f77d8e758fd7b203c665e (diff) |
ao/wasapi: periodicity in shared mode must be zero
IAudioClient::Initialize hnsPeriodicity argument is nonzero only for exclusive mode
http://msdn.microsoft.com/en-us/library/windows/desktop/dd370805%28v=vs.85%29.aspx
Diffstat (limited to 'audio/out')
-rwxr-xr-x | audio/out/ao_wasapi_utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 93d6fe1874..3c78bb9b98 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -458,12 +458,15 @@ static HRESULT fix_format(struct ao *ao) HRESULT hr; double offset = 0.5; - REFERENCE_TIME devicePeriod, bufferDuration; + REFERENCE_TIME devicePeriod, bufferDuration, bufferPeriod; MP_DBG(state, "IAudioClient::GetDevicePeriod\n"); hr = IAudioClient_GetDevicePeriod(state->pAudioClient,&devicePeriod, NULL); MP_VERBOSE(state, "Device period: %.2g ms\n", (double) devicePeriod / 10000.0 ); + /* integer multiple of device period close to 50ms */ - bufferDuration = ceil( 50.0 * 10000.0 / devicePeriod ) * devicePeriod; + bufferPeriod = bufferDuration = ceil( 50.0 * 10000.0 / devicePeriod ) * devicePeriod; + if (state->share_mode == AUDCLNT_SHAREMODE_SHARED) + bufferPeriod = 0; /* cargo cult code to negotiate buffer block size, affected by hardware/drivers combinations, gradually grow it to 10s, by 0.5s, consider failure if it still doesn't work @@ -474,7 +477,7 @@ reinit: state->share_mode, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, bufferDuration, - bufferDuration, + bufferPeriod, &(state->format.Format), NULL); /* something about buffer sizes on Win7 */ |