wineoss: GetStreamLatency is constant, SNDCTL_DSP_GETODELAY is dynamic.

This commit is contained in:
Jörg Höhle 2012-01-05 22:19:35 +01:00 committed by Alexandre Julliard
parent 92d8e93acb
commit 6d23816300
1 changed files with 2 additions and 19 deletions

View File

@ -1046,26 +1046,9 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface,
return AUDCLNT_E_NOT_INITIALIZED;
}
if(This->dataflow == eRender){
int delay_bytes;
double delay_s;
if(ioctl(This->fd, SNDCTL_DSP_GETODELAY, &delay_bytes) < 0){
LeaveCriticalSection(&This->lock);
WARN("GETODELAY failed: %d (%s)\n", errno, strerror(errno));
return E_FAIL;
}
delay_s = delay_bytes / (double)(This->fmt->nSamplesPerSec *
This->fmt->nBlockAlign);
*latency = delay_s * 10000000;
}else
*latency = 10000; /* OSS doesn't provide input latency */
/* pretend we process audio in Period chunks, so max latency includes
* the period time */
*latency += DefaultPeriod;
* the period time. Some native machines add .6666ms in shared mode. */
*latency = This->period_us * 10 + 6666;
LeaveCriticalSection(&This->lock);