mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: Wrap hw_ptr to boundary in pcm_ioplug
The function snd_pcm_ioplug_hw_ptr_update() always increased the hw_ptr by delta, without wrapping it to the boundary. This would lead to problems when after many hours, the hw_ptr would overflow. Signed-off-by: Luciano Montanaro <luciano.montanaro@magnetimarelli.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									48f1b308cc
								
							
						
					
					
						commit
						688004a6ac
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -60,7 +60,7 @@ static void snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm)
 | 
				
			||||||
			delta = hw - io->last_hw;
 | 
								delta = hw - io->last_hw;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			delta = pcm->buffer_size + hw - io->last_hw;
 | 
								delta = pcm->buffer_size + hw - io->last_hw;
 | 
				
			||||||
		io->data->hw_ptr += delta;
 | 
							snd_pcm_mmap_hw_forward(io->data->pcm, delta);
 | 
				
			||||||
		io->last_hw = hw;
 | 
							io->last_hw = hw;
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		io->data->state = SNDRV_PCM_STATE_XRUN;
 | 
							io->data->state = SNDRV_PCM_STATE_XRUN;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue