mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
pcm: dmix/dshare - delay calculation fixes and cleanups
Unfortunately, we cannot use status->avail from slave, because this value does not wrap to the buffer size and it may even overflow slave boundary (endless run). We can use only hw_ptr from slave. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
644514e85d
commit
0de72e63d7
2 changed files with 4 additions and 6 deletions
|
|
@ -488,8 +488,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
case SNDRV_PCM_STATE_DRAINING:
|
case SNDRV_PCM_STATE_DRAINING:
|
||||||
case SNDRV_PCM_STATE_RUNNING:
|
case SNDRV_PCM_STATE_RUNNING:
|
||||||
snd_pcm_dmix_sync_ptr0(pcm, status->hw_ptr);
|
snd_pcm_dmix_sync_ptr0(pcm, status->hw_ptr);
|
||||||
status->delay += snd_pcm_mmap_playback_delay(pcm)
|
status->delay = snd_pcm_mmap_playback_delay(pcm);
|
||||||
+ status->avail - dmix->spcm->buffer_size;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -518,7 +517,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||||
case SNDRV_PCM_STATE_PREPARED:
|
case SNDRV_PCM_STATE_PREPARED:
|
||||||
case SNDRV_PCM_STATE_SUSPENDED:
|
case SNDRV_PCM_STATE_SUSPENDED:
|
||||||
case STATE_RUN_PENDING:
|
case STATE_RUN_PENDING:
|
||||||
*delayp = snd_pcm_mmap_playback_hw_avail(pcm);
|
*delayp = snd_pcm_mmap_playback_delay(pcm);
|
||||||
return 0;
|
return 0;
|
||||||
case SNDRV_PCM_STATE_XRUN:
|
case SNDRV_PCM_STATE_XRUN:
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
|
|
|
||||||
|
|
@ -237,8 +237,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
case SNDRV_PCM_STATE_DRAINING:
|
case SNDRV_PCM_STATE_DRAINING:
|
||||||
case SNDRV_PCM_STATE_RUNNING:
|
case SNDRV_PCM_STATE_RUNNING:
|
||||||
snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr);
|
snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr);
|
||||||
status->delay += snd_pcm_mmap_playback_delay(pcm)
|
status->delay += snd_pcm_mmap_playback_delay(pcm);
|
||||||
+ status->avail - dshare->spcm->buffer_size;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -290,7 +289,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||||
case SNDRV_PCM_STATE_PREPARED:
|
case SNDRV_PCM_STATE_PREPARED:
|
||||||
case SNDRV_PCM_STATE_SUSPENDED:
|
case SNDRV_PCM_STATE_SUSPENDED:
|
||||||
case STATE_RUN_PENDING:
|
case STATE_RUN_PENDING:
|
||||||
*delayp = snd_pcm_mmap_playback_hw_avail(pcm);
|
*delayp = snd_pcm_mmap_playback_delay(pcm);
|
||||||
return 0;
|
return 0;
|
||||||
case SNDRV_PCM_STATE_XRUN:
|
case SNDRV_PCM_STATE_XRUN:
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue