mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	context: restart graph recalculation when something changed
When we were busy with the graph recalculation and something changed, restart the graph state change to get the new change applied. For example, when we start a node and it has a max-quantum set, we need to restart our calculation with the new quantum limits.
This commit is contained in:
		
							parent
							
								
									63a34f4f84
								
							
						
					
					
						commit
						0881d5b881
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
					@ -65,7 +65,8 @@
 | 
				
			||||||
struct impl {
 | 
					struct impl {
 | 
				
			||||||
	struct pw_context this;
 | 
						struct pw_context this;
 | 
				
			||||||
	struct spa_handle *dbus_handle;
 | 
						struct spa_handle *dbus_handle;
 | 
				
			||||||
	unsigned int recalc;
 | 
						unsigned int recalc:1;
 | 
				
			||||||
 | 
						unsigned int recalc_pending:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -918,9 +919,12 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info(NAME" %p: busy:%d reason:%s", context, impl->recalc, reason);
 | 
						pw_log_info(NAME" %p: busy:%d reason:%s", context, impl->recalc, reason);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (impl->recalc)
 | 
						if (impl->recalc) {
 | 
				
			||||||
 | 
							impl->recalc_pending = true;
 | 
				
			||||||
		return -EBUSY;
 | 
							return -EBUSY;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					again:
 | 
				
			||||||
	impl->recalc = true;
 | 
						impl->recalc = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* start from all drivers and group all nodes that are linked
 | 
						/* start from all drivers and group all nodes that are linked
 | 
				
			||||||
| 
						 | 
					@ -1041,6 +1045,11 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
 | 
				
			||||||
		ensure_state(n, running);
 | 
							ensure_state(n, running);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	impl->recalc = false;
 | 
						impl->recalc = false;
 | 
				
			||||||
 | 
						if (impl->recalc_pending) {
 | 
				
			||||||
 | 
							impl->recalc_pending = false;
 | 
				
			||||||
 | 
							goto again;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue