From 89ace71d1da837f35284cdadce2a87d204cc5c54 Mon Sep 17 00:00:00 2001 From: wsoltys Date: Thu, 15 Aug 2013 20:00:22 +0200 Subject: [PATCH] [WASAPI] fixed: use the more accurate GetDelay() for Drain(). --- xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 7 ++----- xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp index e4022e3..dbfc071 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp @@ -193,8 +193,7 @@ CAESinkWASAPI::CAESinkWASAPI() : m_avgTimeWaiting(50), m_sinkLatency(0.0), m_pBuffer(NULL), - m_bufferPtr(0), - m_hnsRequestedDuration(0) + m_bufferPtr(0) { m_channelLayout.Reset(); } @@ -1196,8 +1195,6 @@ initialize: hr = m_pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, audioSinkBufferDurationMsec, audioSinkBufferDurationMsec, &wfxex.Format, NULL); - m_hnsRequestedDuration = audioSinkBufferDurationMsec; - if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED) { /* WASAPI requires aligned buffer */ @@ -1333,7 +1330,7 @@ void CAESinkWASAPI::Drain() if(!m_pAudioClient) return; - Sleep( (DWORD)(m_hnsRequestedDuration / 10000)); + Sleep( (DWORD)(GetDelay()*50) ); if (m_running) { diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h index 8b29f50..144bad3 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h +++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h @@ -83,5 +83,4 @@ private: uint8_t *m_pBuffer; int m_bufferPtr; - REFERENCE_TIME m_hnsRequestedDuration; }; -- 2.7.4