mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa: calculate elapsed time only when running
This commit is contained in:
		
							parent
							
								
									ca228003c4
								
							
						
					
					
						commit
						0d08f41c28
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -251,7 +251,8 @@ static int snd_pcm_pipewire_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delay
 | 
				
			||||||
		seq2 = SEQ_READ(pw->seq);
 | 
							seq2 = SEQ_READ(pw->seq);
 | 
				
			||||||
	} while (!SEQ_READ_SUCCESS(seq1, seq2));
 | 
						} while (!SEQ_READ_SUCCESS(seq1, seq2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (now != 0) {
 | 
						if (now != 0 && (io->state == SND_PCM_STATE_RUNNING ||
 | 
				
			||||||
 | 
						    io->state == SND_PCM_STATE_DRAINING)) {
 | 
				
			||||||
		clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
							clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
				
			||||||
		diff = SPA_TIMESPEC_TO_NSEC(&ts) - now;
 | 
							diff = SPA_TIMESPEC_TO_NSEC(&ts) - now;
 | 
				
			||||||
		elapsed = (io->rate * diff) / SPA_NSEC_PER_SEC;
 | 
							elapsed = (io->rate * diff) / SPA_NSEC_PER_SEC;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue