[PATCH 4/4] dsound: Store the size of the AudioClient buffer in ac_frames, not the size of the primary buffer.

Huw Davies huw at codeweavers.com
Wed Mar 1 04:19:45 CST 2017


This is used in DSOUND_PerformMix() to calculate the amount of free
space in the AudioClient buffer, so we need the full value here.

Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/dsound/primary.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 6eb5a98..e36e81b 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -286,7 +286,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
 {
     HRESULT hres;
     REFERENCE_TIME period;
-    UINT32 acbuf_frames, aclen_frames;
+    UINT32 ac_frames, buf_frames;
     DWORD period_ms;
     IAudioClient *client = NULL;
     IAudioRenderClient *render = NULL;
@@ -340,7 +340,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
         WARN("GetStreamLatency failed with %08x\n", hres);
         goto err;
     }
-    hres = IAudioClient_GetBufferSize(client, &acbuf_frames);
+    hres = IAudioClient_GetBufferSize(client, &ac_frames);
     if (FAILED(hres)) {
         WARN("GetBufferSize failed with %08x\n", hres);
         goto err;
@@ -349,11 +349,11 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
     period_ms = (period + 9999) / 10000;
     frag_frames = MulDiv(wfx->nSamplesPerSec, period, 10000000);
 
-    aclen_frames = min(acbuf_frames, 3 * frag_frames);
+    buf_frames = min(ac_frames, 3 * frag_frames);
 
-    TRACE("period %u ms frag_frames %u buf_frames %u\n", period_ms, frag_frames, aclen_frames);
+    TRACE("period %u ms frag_frames %u buf_frames %u\n", period_ms, frag_frames, buf_frames);
 
-    hres = DSOUND_PrimaryOpen(device, wfx, aclen_frames, forcewave);
+    hres = DSOUND_PrimaryOpen(device, wfx, buf_frames, forcewave);
     if(FAILED(hres))
         goto err;
 
@@ -362,7 +362,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
     device->render = render;
     device->volume = volume;
     device->frag_frames = frag_frames;
-    device->ac_frames = aclen_frames;
+    device->ac_frames = ac_frames;
 
     if (period_ms < 3)
         device->sleeptime = 5;
-- 
2.10.2




More information about the wine-patches mailing list