mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	jack: make cycle_wait() loop until a valid cycle
pw_data_loop_wait() can return due to activity on another socket, so keep looping until cycle_run() gets a valid command. Fixes #1386
This commit is contained in:
		
							parent
							
								
									df8bd85277
								
							
						
					
					
						commit
						1c6326439f
					
				
					 1 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
					@ -1182,7 +1182,6 @@ static inline uint32_t cycle_run(struct client *c)
 | 
				
			||||||
	struct pw_node_activation *activation = c->activation;
 | 
						struct pw_node_activation *activation = c->activation;
 | 
				
			||||||
	struct pw_node_activation *driver = c->rt.driver_activation;
 | 
						struct pw_node_activation *driver = c->rt.driver_activation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* this is blocking if nothing ready */
 | 
					 | 
				
			||||||
	while (true) {
 | 
						while (true) {
 | 
				
			||||||
		if (SPA_UNLIKELY(read(fd, &cmd, sizeof(cmd)) != sizeof(cmd))) {
 | 
							if (SPA_UNLIKELY(read(fd, &cmd, sizeof(cmd)) != sizeof(cmd))) {
 | 
				
			||||||
			if (errno == EINTR)
 | 
								if (errno == EINTR)
 | 
				
			||||||
| 
						 | 
					@ -1237,13 +1236,18 @@ static inline uint32_t cycle_run(struct client *c)
 | 
				
			||||||
static inline uint32_t cycle_wait(struct client *c)
 | 
					static inline uint32_t cycle_wait(struct client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
						uint32_t nframes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res = pw_data_loop_wait(c->loop, -1);
 | 
						do {
 | 
				
			||||||
	if (SPA_UNLIKELY(res <= 0)) {
 | 
							res = pw_data_loop_wait(c->loop, -1);
 | 
				
			||||||
		pw_log_warn(NAME" %p: wait error %m", c);
 | 
							if (SPA_UNLIKELY(res <= 0)) {
 | 
				
			||||||
		return 0;
 | 
								pw_log_warn(NAME" %p: wait error %m", c);
 | 
				
			||||||
	}
 | 
								return 0;
 | 
				
			||||||
	return cycle_run(c);
 | 
							}
 | 
				
			||||||
 | 
							nframes = cycle_run(c);
 | 
				
			||||||
 | 
						} while (!nframes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nframes;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void signal_sync(struct client *c)
 | 
					static inline void signal_sync(struct client *c)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue