[PATCH 4/6] dsound: Use event based threads

Andrew Eikum aeikum at codeweavers.com
Fri Oct 19 08:40:05 CDT 2012


I like it. Before I can give a sign-off, I need to run it through my
usual battery of tests on all the platforms. I'll do that after patch
3 gets figured out.

Some thoughts below...

On Tue, Oct 16, 2012 at 02:06:28PM +0200, Maarten Lankhorst wrote:
> +		/* ALSA is retarded, add a timeout.. */
> +		ret = WaitForSingleObject(dev->sleepev, dev->sleeptime);

No arguments here :) but I'm curious what you mean. Presumably
winealsa isn't sending events when it ought to? I know Jorg has
discovered that failure, I wonder if it's worth testing and fixing
across all the drivers.

> diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
> index 94bdf9c..9d9fa27 100644
> --- a/dlls/dsound/primary.c
> +++ b/dlls/dsound/primary.c
> @@ -170,6 +172,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
>              device->pwfx->wFormatTag = WAVE_FORMAT_PCM;
>          device->pwfx->cbSize = 0;
>      }
> +    IAudioClient_SetEventHandle(device->client, device->sleepev);
>  
>      hres = IAudioClient_GetService(device->client, &IID_IAudioRenderClient,
>              (void**)&device->render);
> @@ -203,6 +206,19 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
>          WARN("GetService failed: %08x\n", hres);
>          return hres;
>      }
> +    /* Now kick off the timer so the event fires periodically */
> +    IAudioClient_Start(device->client);
> +
> +    IAudioClient_GetStreamLatency(device->client, &period);

I'm a big fan of error checking (or at least reporting), so these
unchecked calls make me nervous. They'll probably never fail, but if
they do, I think they should fail loudly.

Andrew



More information about the wine-devel mailing list