winealsa: Pulse knows handle_underrun only since 2010-07-09.

This commit is contained in:
Jörg Höhle 2011-08-09 21:19:51 +02:00 committed by Alexandre Julliard
parent 89367ebec0
commit 8129b1847a
1 changed files with 16 additions and 19 deletions

View File

@ -497,6 +497,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(const char *key, IMMDevice *dev,
int err; int err;
snd_pcm_stream_t stream; snd_pcm_stream_t stream;
snd_config_t *lconf; snd_config_t *lconf;
static int handle_underrun = 1;
TRACE("\"%s\" %p %d %p\n", key, dev, dataflow, out); TRACE("\"%s\" %p %d %p\n", key, dev, dataflow, out);
@ -520,27 +521,23 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(const char *key, IMMDevice *dev,
return E_UNEXPECTED; return E_UNEXPECTED;
} }
lconf = make_handle_underrun_config(key);
This->dataflow = dataflow; This->dataflow = dataflow;
if(lconf){ if(handle_underrun && ((lconf = make_handle_underrun_config(key)))){
if((err = snd_pcm_open_lconf(&This->pcm_handle, key, stream, err = snd_pcm_open_lconf(&This->pcm_handle, key, stream, SND_PCM_NONBLOCK, lconf);
SND_PCM_NONBLOCK, lconf)) < 0){ TRACE("Opening PCM device \"%s\" with handle_underrun: %d\n", key, err);
snd_config_delete(lconf);
HeapFree(GetProcessHeap(), 0, This);
WARN("Unable to open PCM \"%s\": %d (%s)\n", key, err,
snd_strerror(err));
return E_FAIL;
}
snd_config_delete(lconf); snd_config_delete(lconf);
}else{ /* Pulse <= 2010 returns EINVAL, it does not know handle_underrun. */
if((err = snd_pcm_open(&This->pcm_handle, key, stream, if(err == -EINVAL)
SND_PCM_NONBLOCK)) < 0){ handle_underrun = 0;
HeapFree(GetProcessHeap(), 0, This); }else
WARN("Unable to open PCM \"%s\": %d (%s)\n", key, err, err = -EINVAL;
snd_strerror(err)); if(err == -EINVAL){
return E_FAIL; err = snd_pcm_open(&This->pcm_handle, key, stream, SND_PCM_NONBLOCK);
} }
if(err < 0){
HeapFree(GetProcessHeap(), 0, This);
WARN("Unable to open PCM \"%s\": %d (%s)\n", key, err, snd_strerror(err));
return E_FAIL;
} }
This->hw_params = HeapAlloc(GetProcessHeap(), 0, This->hw_params = HeapAlloc(GetProcessHeap(), 0,