mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	policy-node: avoid rescan when moving a node
When we are moving a node, the node becomes unlinked temporarily. Make sure the rescan code doesn't try to link it to a node meanwhile. Fixes #344
This commit is contained in:
		
							parent
							
								
									71c760de14
								
							
						
					
					
						commit
						bfac6f04db
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -97,6 +97,7 @@ struct node {
 | 
				
			||||||
	unsigned int configured:1;
 | 
						unsigned int configured:1;
 | 
				
			||||||
	unsigned int dont_remix:1;
 | 
						unsigned int dont_remix:1;
 | 
				
			||||||
	unsigned int monitor:1;
 | 
						unsigned int monitor:1;
 | 
				
			||||||
 | 
						unsigned int moving:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool find_format(struct node *node)
 | 
					static bool find_format(struct node *node)
 | 
				
			||||||
| 
						 | 
					@ -557,6 +558,10 @@ static int rescan_node(struct impl *impl, struct node *n)
 | 
				
			||||||
		pw_log_debug(NAME " %p: node %d is not active", impl, n->id);
 | 
							pw_log_debug(NAME " %p: node %d is not active", impl, n->id);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (n->moving) {
 | 
				
			||||||
 | 
							pw_log_debug(NAME " %p: node %d is moving", impl, n->id);
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (n->type == NODE_TYPE_DEVICE) {
 | 
						if (n->type == NODE_TYPE_DEVICE) {
 | 
				
			||||||
		configure_node(n, NULL, false);
 | 
							configure_node(n, NULL, false);
 | 
				
			||||||
| 
						 | 
					@ -753,8 +758,10 @@ static int move_node(struct impl *impl, uint32_t source, uint32_t target)
 | 
				
			||||||
		    pw_properties_parse_bool(str))
 | 
							    pw_properties_parse_bool(str))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							n->moving = true;
 | 
				
			||||||
		unlink_nodes(n, src_node);
 | 
							unlink_nodes(n, src_node);
 | 
				
			||||||
		link_nodes(n, dst_node);
 | 
							link_nodes(n, dst_node);
 | 
				
			||||||
 | 
							n->moving = false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue