mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw-cat: keep our own time
Don't try to use the time from the io_position, it is updated in the RT thread and might be slightly wrong for our purposes.
This commit is contained in:
		
							parent
							
								
									ea911f2e3f
								
							
						
					
					
						commit
						7df66cd6ad
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
					@ -144,7 +144,7 @@ struct data {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct spa_io_position *position;
 | 
						struct spa_io_position *position;
 | 
				
			||||||
	bool drained;
 | 
						bool drained;
 | 
				
			||||||
	uint64_t clock_start;
 | 
						uint64_t clock_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		int fd;
 | 
							int fd;
 | 
				
			||||||
| 
						 | 
					@ -968,11 +968,9 @@ static int midi_play(struct data *d, void *src, unsigned int n_frames)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        spa_pod_builder_push_sequence(&b, &f, 0);
 | 
					        spa_pod_builder_push_sequence(&b, &f, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (d->clock_start == 0)
 | 
						first_frame = d->clock_time;
 | 
				
			||||||
		d->clock_start = d->position->clock.position;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	first_frame = d->position->clock.position - d->clock_start;
 | 
					 | 
				
			||||||
	last_frame = first_frame + d->position->clock.duration;
 | 
						last_frame = first_frame + d->position->clock.duration;
 | 
				
			||||||
 | 
						d->clock_time = last_frame;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
		uint32_t frame, offset;
 | 
							uint32_t frame, offset;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue