=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: winealsa: Log the periodic renderer callback.

Alexandre Julliard julliard at winehq.org
Thu Jan 26 14:49:25 CST 2012


Module: wine
Branch: master
Commit: 52c88ea725b4f5e8103bf9b47b2b3b1fe6e22ba1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=52c88ea725b4f5e8103bf9b47b2b3b1fe6e22ba1

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Sun Jan  1 23:59:39 2012 +0100

winealsa: Log the periodic renderer callback.

---

 dlls/winealsa.drv/mmdevdrv.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 5da8ec9..fedd040 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -1173,14 +1173,13 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient *iface,
         return AUDCLNT_E_NOT_INITIALIZED;
     }
 
+    /* padding is solely updated at callback time in shared mode */
     *out = This->held_frames;
 
-    /* call required to get accurate snd_pcm_state() */
-    snd_pcm_avail_update(This->pcm_handle);
-    TRACE("pad: %u, state: %u\n", *out, snd_pcm_state(This->pcm_handle));
-
     LeaveCriticalSection(&This->lock);
 
+    TRACE("pad: %u\n", *out);
+
     return S_OK;
 }
 
@@ -1522,7 +1521,7 @@ static void alsa_write_data(ACImpl *This)
 
     if(snd_pcm_state(This->pcm_handle) == SND_PCM_STATE_XRUN ||
             avail > This->alsa_bufsize_frames){
-        TRACE("XRun state, recovering\n");
+        TRACE("XRun state avail %ld, recovering\n", avail);
 
         avail = This->alsa_bufsize_frames;
 
@@ -1534,7 +1533,8 @@ static void alsa_write_data(ACImpl *This)
 
         if((err = snd_pcm_prepare(This->pcm_handle)) < 0)
             WARN("snd_pcm_prepare failed: %d (%s)\n", err, snd_strerror(err));
-    }
+    }else
+        TRACE("pad: %ld\n", This->alsa_bufsize_frames - avail);
 
     if(This->held_frames == 0)
         return;
@@ -1953,8 +1953,6 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
 {
     ACImpl *This = impl_from_IAudioRenderClient(iface);
     UINT32 write_pos;
-    UINT32 pad;
-    HRESULT hr;
 
     TRACE("(%p)->(%u, %p)\n", This, frames, data);
 
@@ -1974,13 +1972,8 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
         return S_OK;
     }
 
-    hr = IAudioClient_GetCurrentPadding(&This->IAudioClient_iface, &pad);
-    if(FAILED(hr)){
-        LeaveCriticalSection(&This->lock);
-        return hr;
-    }
-
-    if(pad + frames > This->bufsize_frames){
+    /* held_frames == GetCurrentPadding_nolock(); */
+    if(This->held_frames + frames > This->bufsize_frames){
         LeaveCriticalSection(&This->lock);
         return AUDCLNT_E_BUFFER_TOO_LARGE;
     }




More information about the wine-cvs mailing list