winealsa: Always commit at least 3 periods in dsoutput.

This commit is contained in:
Maarten Lankhorst 2007-07-29 12:39:49 +02:00 committed by Alexandre Julliard
parent 408abf9a76
commit ecfafa37c7
1 changed files with 5 additions and 22 deletions

View File

@ -296,8 +296,6 @@ static HRESULT WINAPI IDsDriverBufferImpl_Unlock(PIDSDRIVERBUFFER iface,
return DSERR_UNSUPPORTED; return DSERR_UNSUPPORTED;
} }
static int warnonce;
static HRESULT SetFormat(IDsDriverBufferImpl *This, LPWAVEFORMATEX pwfx, BOOL forced) static HRESULT SetFormat(IDsDriverBufferImpl *This, LPWAVEFORMATEX pwfx, BOOL forced)
{ {
snd_pcm_t *pcm = NULL; snd_pcm_t *pcm = NULL;
@ -382,26 +380,11 @@ static HRESULT SetFormat(IDsDriverBufferImpl *This, LPWAVEFORMATEX pwfx, BOOL fo
err = snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL); err = snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL);
TRACE("Period size is: %lu\n", psize); TRACE("Period size is: %lu\n", psize);
/* If period size is 'high', try to commit less /* ALSA needs at least 3 buffers to work succesfully */
* dmix needs at least 2 buffers to work successfully but prefers 3 This->mmap_commitahead = 3 * psize;
* however it seems to work ok if I just commit 2 1/2 buffers while (This->mmap_commitahead <= 512)
*/ This->mmap_commitahead += psize;
if (psize >= 512) This->mmap_writeahead = This->mmap_commitahead;
{
if (psize == 1024 && ++warnonce == 1)
FIXME("Your alsa dmix period size is 1024, try decreasing it to 512 if possible\n");
else if (psize > 512)
WARN("Your alsa period size is excessively high (%lu)\n", psize);
This->mmap_commitahead = 2 * psize + psize/2;
This->mmap_writeahead = 2 * psize;
}
else
{
This->mmap_commitahead = 3 * psize;
while (This->mmap_commitahead <= 512)
This->mmap_commitahead += psize;
This->mmap_writeahead = This->mmap_commitahead;
}
if (This->pcm) if (This->pcm)
{ {