mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	jack: drop/acquire RT when enter/exit freewheel
Freewheel can use a lot of CPU and we don't want our realtime threads to take up all resources while freewheeling.
This commit is contained in:
		
							parent
							
								
									e2d6545e77
								
							
						
					
					
						commit
						5088ebacc5
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -1462,6 +1462,7 @@ do_update_driver_activation(struct spa_loop *loop,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int update_driver_activation(struct client *c)
 | 
					static int update_driver_activation(struct client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						jack_client_t *client = (jack_client_t*)c;
 | 
				
			||||||
	struct link *link;
 | 
						struct link *link;
 | 
				
			||||||
	bool freewheeling;
 | 
						bool freewheeling;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1469,8 +1470,19 @@ static int update_driver_activation(struct client *c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	freewheeling = SPA_FLAG_IS_SET(c->position->clock.flags, SPA_IO_CLOCK_FLAG_FREEWHEEL);
 | 
						freewheeling = SPA_FLAG_IS_SET(c->position->clock.flags, SPA_IO_CLOCK_FLAG_FREEWHEEL);
 | 
				
			||||||
	if (c->freewheeling != freewheeling) {
 | 
						if (c->freewheeling != freewheeling) {
 | 
				
			||||||
 | 
							jack_native_thread_t thr = jack_client_thread_id(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		c->freewheeling = freewheeling;
 | 
							c->freewheeling = freewheeling;
 | 
				
			||||||
 | 
							if (freewheeling && thr) {
 | 
				
			||||||
 | 
								jack_drop_real_time_scheduling(thr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		do_callback(c, freewheel_callback, freewheeling, c->freewheel_arg);
 | 
							do_callback(c, freewheel_callback, freewheeling, c->freewheel_arg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!freewheeling && thr) {
 | 
				
			||||||
 | 
								jack_acquire_real_time_scheduling(thr,
 | 
				
			||||||
 | 
										jack_client_real_time_priority(client));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	link = find_activation(&c->links, c->driver_id);
 | 
						link = find_activation(&c->links, c->driver_id);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue