Chris Robinson : quartz: Don't fill the dsound buffer with small amounts.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 2 06:22:53 CDT 2007


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

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Fri Mar 30 03:13:54 2007 -0700

quartz: Don't fill the dsound buffer with small amounts.

---

 dlls/quartz/dsoundrender.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 259a25b..23c522d 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -203,13 +203,13 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, LPBYTE data,
             ERR("Error GetCurrentPosition: %x\n", hr);
             break;
         }
-        if (This->write_pos < play_pos)
+        if (This->write_pos <= play_pos)
              buf_free = play_pos-This->write_pos;
         else
              buf_free = DSBUFFERSIZE - This->write_pos + play_pos;
 
-        /* This situation is ambiguous; Assume full when playing */
-        if(buf_free == DSBUFFERSIZE)
+        /* Wait for enough of the buffer to empty before filling it */
+        if(buf_free < DSBUFFERSIZE/4)
         {
             Sleep(10);
             continue;
@@ -234,11 +234,7 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, LPBYTE data,
         size -= dwsize1 + dwsize2;
         data += dwsize1 + dwsize2;
         This->write_pos = (This->write_pos + dwsize1 + dwsize2) % DSBUFFERSIZE;
-
-        if (!size)
-            break;
-        Sleep(10);
-    } while (This->state == State_Running);
+    } while (size && This->state == State_Running);
 
     return hr;
 }




More information about the wine-cvs mailing list