Skip to contentSkip to conversation

alsa-lib: pcm:dshare enable silence

PATCH Applied [email protected] 2 participants 2 messages Dec 30, 2016 – Jan 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 alsa-lib: pcm:dshare enable silence

From: Alexander Jahn <[email protected]>

This issue depends on system load - if the process using dshare is scheduled fast enough, then there is no noise. A delay of e.g >~2ms produces hearable noise.

Reproduction with instrumented aplay(sleep every 100th period for a given time):
During the sleep time of 2000000us (2s) the hardware plays old samples in a loop before xrun is detected and recovered after the sleep.
This is resolved by placing it in silence, in case of dshare plugin.

src/pcm/pcm_direct.c +1 -1
index 4234d66..779845c 100644
@@ -1240,7 +1240,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
 		return ret;
 	}
 
-	if (dmix->type != SND_PCM_TYPE_DMIX)
+	if ((dmix->type != SND_PCM_TYPE_DMIX)&&(dmix->type != SND_PCM_TYPE_DSHARE))
 		goto __skip_silencing;
 
 	ret = snd_pcm_sw_params_set_silence_threshold(spcm, &sw_params, 0);
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 6 lines · On Fri, 30 Dec 2016 07:29:11 +0100, [email protected] wrote:

From: Alexander Jahn <[email protected]>

This issue depends on system load - if the process using dshare is scheduled fast enough, then there is no noise. A delay of e.g >~2ms produces hearable noise.

Quoted 7 lines

Reproduction with instrumented aplay(sleep every 100th period for a given time):
During the sleep time of 2000000us (2s) the hardware plays old samples in a loop before xrun is detected and recovered after the sleep.
This is resolved by placing it in silence, in case of dshare plugin.

Applied this one with a slight coding style fix. Thanks.

Takashi

Quoted 17 lines
src/pcm/pcm_direct.c +1 -1
index 4234d66..779845c 100644
@@ -1240,7 +1240,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
 		return ret;
 	}
 
-	if (dmix->type != SND_PCM_TYPE_DMIX)
+	if ((dmix->type != SND_PCM_TYPE_DMIX)&&(dmix->type != SND_PCM_TYPE_DSHARE))
 		goto __skip_silencing;
 
 	ret = snd_pcm_sw_params_set_silence_threshold(spcm, &sw_params, 0);
Signature · 1 line
1.7.9.5