diff options
author | elupus <elupus@svn> | 2010-09-06 22:04:40 +0000 |
---|---|---|
committer | elupus <elupus@svn> | 2010-09-06 22:04:40 +0000 |
commit | f8e1b270099f3d376af6f7e91d76621ea4752597 (patch) | |
tree | bed865bb452354a0ce70c9ca1995ef854d4ddee5 | |
parent | 830a7a573f9b085be4ba70a1d0e863f074fe8742 (diff) |
fixed: #10080 - if audio renderer fills up completely, we wrongly assume it's empty
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33577 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/cores/AudioRenderers/Win32DirectSound.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp index 4b6ca7725a..bf4bbf8b62 100644 --- a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp +++ b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp @@ -440,8 +440,15 @@ unsigned int CWin32DirectSound::GetSpace() { CSingleLock lock (m_critSection); UpdateCacheStatus(); + unsigned int space = ((m_dwBufferLen - m_CacheLen) / m_uiChannels) * m_uiDataChannels; - return ((m_dwBufferLen - m_CacheLen) / m_uiChannels) * m_uiDataChannels; + // We can never allow the internal buffers to fill up complete + // as we get confused between if the buffer is full or empty + // so never allow the last chunk to be added + if(space > m_dwDataChunkSize) + return space - m_dwDataChunkSize; + else + return 0; } //*********************************************************************************************** @@ -469,7 +476,7 @@ float CWin32DirectSound::GetCacheTime() float CWin32DirectSound::GetCacheTotal() { CSingleLock lock (m_critSection); - return (float)m_dwBufferLen / (float)m_AvgBytesPerSec; + return (float)(m_dwBufferLen - m_dwDataChunkSize) / (float)m_AvgBytesPerSec; } //*********************************************************************************************** |