mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Fix timestamp in status in PCM direct plugins
PCM direct plugins didn't update the timestamp properly. Now it always starts the slave PCM with MMAP tstamp_mode so that the timestamp will be being updated. When a client is set up as MMAP tstamp_mode as well, simply copy this slave timestamp. Otherwise status callback calculates the current timestamp as usual.
This commit is contained in:
parent
b0b7d0280f
commit
7379b061eb
4 changed files with 35 additions and 3 deletions
|
|
@ -420,7 +420,14 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
memset(status, 0, sizeof(*status));
|
||||
status->state = snd_pcm_dmix_state(pcm);
|
||||
status->trigger_tstamp = dmix->trigger_tstamp;
|
||||
status->tstamp = snd_pcm_hw_fast_tstamp(dmix->spcm);
|
||||
if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
||||
status->tstamp = snd_pcm_hw_fast_tstamp(dmix->spcm);
|
||||
else {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
status->tstamp.tv_sec = tv.tv_sec;
|
||||
status->tstamp.tv_nsec = tv.tv_usec * 1000L;
|
||||
}
|
||||
status->avail = snd_pcm_mmap_playback_avail(pcm);
|
||||
status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
|
||||
dmix->avail_max = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue