mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
pcm: fix the snd_pcm_plugin_status() avail and delay fields
The avail and delay fields in the returned status structure does not reflect the actual hw_ptr/appl_ptr. This change correct this. TODO: Unfortunately, the delay might contain also information about extra hardware / buffering delay which is hidden with this change. Link: https://lore.kernel.org/alsa-devel/d9c1f37e-5c8d-f289-270e-c6cda7a56ce3@axis.com/ Reported-by: Jonas Holmberg <jonashg@axis.com> Tested-by: Jonas Holmberg <jonashg@axis.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
2b217b7010
commit
4f90392f07
1 changed files with 6 additions and 2 deletions
|
|
@ -541,16 +541,20 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
|||
static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_sframes_t err;
|
||||
snd_pcm_sframes_t err, avail;
|
||||
|
||||
/* sync with the latest hw and appl ptrs */
|
||||
snd_pcm_plugin_avail_update(pcm);
|
||||
avail = snd_pcm_plugin_avail_update(pcm);
|
||||
if (avail < 0)
|
||||
return avail;
|
||||
|
||||
err = snd_pcm_status(plugin->gen.slave, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
status->appl_ptr = *pcm->appl.ptr;
|
||||
status->hw_ptr = *pcm->hw.ptr;
|
||||
status->avail = avail;
|
||||
status->delay = snd_pcm_mmap_delay(pcm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue