mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
pcm: ioplug - fix the delay calculation in the status callback
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
21549e6583
commit
6ca01c07ee
1 changed files with 18 additions and 14 deletions
|
|
@ -107,9 +107,24 @@ static int snd_pcm_ioplug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *i
|
||||||
return snd_pcm_channel_info_shm(pcm, info, -1);
|
return snd_pcm_channel_info_shm(pcm, info, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||||
|
{
|
||||||
|
ioplug_priv_t *io = pcm->private_data;
|
||||||
|
|
||||||
|
if (io->data->version >= 0x010001 &&
|
||||||
|
io->data->callback->delay)
|
||||||
|
return io->data->callback->delay(io->data, delayp);
|
||||||
|
else {
|
||||||
|
snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||||
|
*delayp = snd_pcm_mmap_hw_avail(pcm);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
{
|
{
|
||||||
ioplug_priv_t *io = pcm->private_data;
|
ioplug_priv_t *io = pcm->private_data;
|
||||||
|
snd_pcm_sframes_t sd;
|
||||||
|
|
||||||
memset(status, 0, sizeof(*status));
|
memset(status, 0, sizeof(*status));
|
||||||
snd_pcm_ioplug_hw_ptr_update(pcm);
|
snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||||
|
|
@ -118,6 +133,9 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
gettimestamp(&status->tstamp, pcm->tstamp_type);
|
gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||||
status->avail = snd_pcm_mmap_avail(pcm);
|
status->avail = snd_pcm_mmap_avail(pcm);
|
||||||
status->avail_max = io->avail_max;
|
status->avail_max = io->avail_max;
|
||||||
|
if (snd_pcm_ioplug_delay(pcm, &sd) < 0)
|
||||||
|
sd = snd_pcm_mmap_delay(pcm);
|
||||||
|
status->delay = sd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,20 +151,6 @@ static int snd_pcm_ioplug_hwsync(snd_pcm_t *pcm)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|
||||||
{
|
|
||||||
ioplug_priv_t *io = pcm->private_data;
|
|
||||||
|
|
||||||
if (io->data->version >= 0x010001 &&
|
|
||||||
io->data->callback->delay)
|
|
||||||
return io->data->callback->delay(io->data, delayp);
|
|
||||||
else {
|
|
||||||
snd_pcm_ioplug_hw_ptr_update(pcm);
|
|
||||||
*delayp = snd_pcm_mmap_hw_avail(pcm);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_pcm_ioplug_reset(snd_pcm_t *pcm)
|
static int snd_pcm_ioplug_reset(snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
ioplug_priv_t *io = pcm->private_data;
|
ioplug_priv_t *io = pcm->private_data;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue