mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	check the current pcm status in snd_pcm_read/write_areas() if
snd_pcm_wait() returns an error. this will fix the bogus return code of snd_pcm_readi/writei().
This commit is contained in:
		
							parent
							
								
									7714346bc2
								
							
						
					
					
						commit
						2978d18323
					
				
					 1 changed files with 16 additions and 4 deletions
				
			
		|  | @ -6110,9 +6110,15 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_ | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			err = snd_pcm_wait(pcm, -1); | 			err = snd_pcm_wait(pcm, -1); | ||||||
| 			if (err < 0) |  | ||||||
| 				break; |  | ||||||
| 			state = snd_pcm_state(pcm); | 			state = snd_pcm_state(pcm); | ||||||
|  | 			if (err < 0) { | ||||||
|  | 				/* check more precisely */ | ||||||
|  | 				if (state == SND_PCM_STATE_XRUN) | ||||||
|  | 					err = -EPIPE; | ||||||
|  | 				else if (state == SND_PCM_STATE_SUSPENDED) | ||||||
|  | 					err = -ESTRPIPE; | ||||||
|  | 				break; | ||||||
|  | 			} | ||||||
| 			goto _again; | 			goto _again; | ||||||
| 			 | 			 | ||||||
| 		} | 		} | ||||||
|  | @ -6183,9 +6189,15 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			err = snd_pcm_wait(pcm, -1); | 			err = snd_pcm_wait(pcm, -1); | ||||||
| 			if (err < 0) |  | ||||||
| 				break; |  | ||||||
| 			state = snd_pcm_state(pcm); | 			state = snd_pcm_state(pcm); | ||||||
|  | 			if (err < 0) { | ||||||
|  | 				/* check more precisely */ | ||||||
|  | 				if (state == SND_PCM_STATE_XRUN) | ||||||
|  | 					err = -EPIPE; | ||||||
|  | 				else if (state == SND_PCM_STATE_SUSPENDED) | ||||||
|  | 					err = -ESTRPIPE; | ||||||
|  | 				break; | ||||||
|  | 			} | ||||||
| 			goto _again; | 			goto _again; | ||||||
| 			 | 			 | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Takashi Iwai
						Takashi Iwai