mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm_plugin: fix delay
PulseAudio ALSA modules report errors after calling snd_pcm_avail_delay(), with a delay lower than the number of samples available. Correct delay using Jaroslav's recommendation: "the result should be 'delay(slave) + mmap_capture_avail(pcm)" Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									a4f71b1940
								
							
						
					
					
						commit
						aba87e5098
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -144,6 +144,12 @@ static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
 | 
			
		|||
	int err = snd_pcm_delay(plugin->gen.slave, &sd);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
        if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
 | 
			
		||||
	    pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
 | 
			
		||||
	    pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
 | 
			
		||||
                sd += snd_pcm_mmap_capture_avail(pcm);
 | 
			
		||||
        }        
 | 
			
		||||
 | 
			
		||||
	*delayp = sd;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue