mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-18 05:33:44 -04:00
pcm: multi: return correct hwptr and avail from snd_pcm_multi_status()
Ensure the logic of snd_pcm_multi_status() is consistent with snd_pcm_multi_avail_update(). Fixes: https://github.com/alsa-project/alsa-lib/pull/224 Fixes: https://github.com/alsa-project/alsa-lib/issues/217 Signed-off-by: Yutao Yuan <infmagic2047reg@outlook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
3f108fc5b8
commit
9c0c757b85
1 changed files with 11 additions and 1 deletions
|
|
@ -388,11 +388,21 @@ static int snd_pcm_multi_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static snd_pcm_sframes_t snd_pcm_multi_avail_update(snd_pcm_t *pcm);
|
||||||
static int snd_pcm_multi_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
static int snd_pcm_multi_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
||||||
{
|
{
|
||||||
snd_pcm_multi_t *multi = pcm->private_data;
|
snd_pcm_multi_t *multi = pcm->private_data;
|
||||||
snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
|
snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
|
||||||
return snd_pcm_status(slave, status);
|
|
||||||
|
int err = snd_pcm_status(slave, status);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
snd_pcm_sframes_t avail = snd_pcm_multi_avail_update(pcm);
|
||||||
|
if (avail < 0)
|
||||||
|
return avail;
|
||||||
|
status->hw_ptr = *pcm->hw.ptr;
|
||||||
|
status->avail = avail;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static snd_pcm_state_t snd_pcm_multi_state(snd_pcm_t *pcm)
|
static snd_pcm_state_t snd_pcm_multi_state(snd_pcm_t *pcm)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue