mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: initialize pcm_dmix monotonic field
not doing so, leaves the pcm object in an inconsistent state since 'info' field is copied from the slave which is then used when snd_pcm_hw_params_is_monotonic() is called. For instance, when using dmix with aplay and an underrun is occuring, the following info is returned: underrun!!! (at least 1248687948.256 ms long) Status: state : XRUN trigger_time: 1390347762.628483000 tstamp : 1390347766.184350000 delay : -635 avail : 15687 avail_max : 15675 now is computed from CLOCK_MONOTONIC while pcm status tstamps are from gettimeofday(). After the fix, underruns are still occuring on my setup but at least the displayed info is correct: underrun!!! (at least 7630.409 ms long) Status: state : XRUN trigger_time: 7652.739201431 tstamp : 7660.369600636 delay : -624 avail : 15676 avail_max : 15664 Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									336dc58beb
								
							
						
					
					
						commit
						e51cd44897
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -857,6 +857,7 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
 | 
			
		|||
	COPY_SLAVE(buffer_time);
 | 
			
		||||
	COPY_SLAVE(sample_bits);
 | 
			
		||||
	COPY_SLAVE(frame_bits);
 | 
			
		||||
	COPY_SLAVE(monotonic);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#undef COPY_SLAVE
 | 
			
		||||
| 
						 | 
				
			
			@ -1220,6 +1221,7 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
 | 
			
		|||
	COPY_SLAVE(buffer_time);
 | 
			
		||||
	COPY_SLAVE(sample_bits);
 | 
			
		||||
	COPY_SLAVE(frame_bits);
 | 
			
		||||
	COPY_SLAVE(monotonic);
 | 
			
		||||
 | 
			
		||||
	spcm->info &= ~SND_PCM_INFO_PAUSE;
 | 
			
		||||
	spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1104,7 +1104,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
 | 
			
		|||
		
 | 
			
		||||
	pcm->poll_fd = dmix->poll_fd;
 | 
			
		||||
	pcm->poll_events = POLLIN;	/* it's different than other plugins */
 | 
			
		||||
		
 | 
			
		||||
	pcm->monotonic = spcm->monotonic;
 | 
			
		||||
	pcm->mmap_rw = 1;
 | 
			
		||||
	snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
 | 
			
		||||
	snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue