mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm, rate: hw_avail must not be negative before starting the stream
If it is, then it means most likely the driver problem, so we should return error immediately instead. Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									650b8c975c
								
							
						
					
					
						commit
						048568bbea
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1069,7 +1069,10 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm)
 | 
			
		|||
	gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type);
 | 
			
		||||
 | 
			
		||||
	avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave);
 | 
			
		||||
	if (avail <= 0) {
 | 
			
		||||
	if (avail < 0) /* can't happen on healthy drivers */
 | 
			
		||||
		return -EBADFD;
 | 
			
		||||
 | 
			
		||||
	if (avail == 0) {
 | 
			
		||||
		/* postpone the trigger since we have no data committed yet */
 | 
			
		||||
		rate->start_pending = 1;
 | 
			
		||||
		return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue