mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
Do hwsync of slave PCM on dmix
Call hwsync of slave PCM on snd_pcm_hwsync() over dmix. This reduces ocasional output noises, typically seen in xmms and bmp with multi-threading on SMP/HT systems. Disabled slowptr of default dmix definition again.
This commit is contained in:
parent
5e325ea18b
commit
6a6a70ffe7
2 changed files with 10 additions and 4 deletions
|
|
@ -27,7 +27,6 @@ pcm.!dmix {
|
|||
type dmix
|
||||
ipc_key 5678293
|
||||
ipc_key_add_uid yes
|
||||
slowptr yes
|
||||
slave {
|
||||
pcm {
|
||||
type hw
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
|||
/*
|
||||
* synchronize hardware pointer (hw_ptr) with ours
|
||||
*/
|
||||
static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
|
||||
static int _snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm, int do_slave_sync)
|
||||
{
|
||||
snd_pcm_direct_t *dmix = pcm->private_data;
|
||||
snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
|
||||
|
|
@ -256,7 +256,7 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (dmix->slowptr)
|
||||
if (do_slave_sync)
|
||||
snd_pcm_hwsync(dmix->spcm);
|
||||
old_slave_hw_ptr = dmix->slave_hw_ptr;
|
||||
slave_hw_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
|
||||
|
|
@ -285,6 +285,12 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_direct_t *dmix = pcm->private_data;
|
||||
return _snd_pcm_dmix_sync_ptr(pcm, dmix->slowptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin implementation
|
||||
*/
|
||||
|
|
@ -369,7 +375,8 @@ static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm)
|
|||
switch(dmix->state) {
|
||||
case SNDRV_PCM_STATE_DRAINING:
|
||||
case SNDRV_PCM_STATE_RUNNING:
|
||||
return snd_pcm_dmix_sync_ptr(pcm);
|
||||
/* sync slave PCM */
|
||||
return _snd_pcm_dmix_sync_ptr(pcm, 1);
|
||||
case SNDRV_PCM_STATE_PREPARED:
|
||||
case SNDRV_PCM_STATE_SUSPENDED:
|
||||
case STATE_RUN_PENDING:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue