mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	impl-link: only make passive links with suspendable peers
Only make a passive link when one of the peers is passive and the other one can be suspended or when both are explicitly passive. This avoid making passive links between a sink/source pair. It also avoid making passive links between two streams if they are not explicitly marked as passive. It does allow making passive links between a passive stream and a sink/source or between two passive streams.
This commit is contained in:
		
							parent
							
								
									c84ef9e29a
								
							
						
					
					
						commit
						f28c30d526
					
				
					 3 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
					@ -1203,7 +1203,10 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* passive means that this link does not make the nodes active */
 | 
						/* passive means that this link does not make the nodes active */
 | 
				
			||||||
	str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE);
 | 
						str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE);
 | 
				
			||||||
	this->passive = str ? spa_atob(str) : output->passive | input->passive;
 | 
						this->passive = str ? spa_atob(str) :
 | 
				
			||||||
 | 
							(output->passive && input_node->can_suspend) ||
 | 
				
			||||||
 | 
							(input->passive && output_node->can_suspend) ||
 | 
				
			||||||
 | 
							(input->passive && output->passive);
 | 
				
			||||||
	if (this->passive && str == NULL)
 | 
						if (this->passive && str == NULL)
 | 
				
			||||||
		 pw_properties_set(properties, PW_KEY_LINK_PASSIVE, "true");
 | 
							 pw_properties_set(properties, PW_KEY_LINK_PASSIVE, "true");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -956,6 +956,12 @@ static void check_properties(struct pw_impl_node *node)
 | 
				
			||||||
		recalc_reason = "link group changed";
 | 
							recalc_reason = "link group changed";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((str = pw_properties_get(node->properties, PW_KEY_MEDIA_CLASS)) != NULL &&
 | 
				
			||||||
 | 
						    (strstr(str, "/Sink") != NULL || strstr(str, "/Source") != NULL)) {
 | 
				
			||||||
 | 
							node->can_suspend = true;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							node->can_suspend = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_PASSIVE)) == NULL)
 | 
						if ((str = pw_properties_get(node->properties, PW_KEY_NODE_PASSIVE)) == NULL)
 | 
				
			||||||
		str = "false";
 | 
							str = "false";
 | 
				
			||||||
	if (spa_streq(str, "out"))
 | 
						if (spa_streq(str, "out"))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -705,6 +705,7 @@ struct pw_impl_node {
 | 
				
			||||||
	unsigned int forced_rate:1;
 | 
						unsigned int forced_rate:1;
 | 
				
			||||||
	unsigned int trigger:1;		/**< has the TRIGGER property and needs an extra
 | 
						unsigned int trigger:1;		/**< has the TRIGGER property and needs an extra
 | 
				
			||||||
					  *  trigger to start processing. */
 | 
										  *  trigger to start processing. */
 | 
				
			||||||
 | 
						unsigned int can_suspend:1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t port_user_data_size;	/**< extra size for port user data */
 | 
						uint32_t port_user_data_size;	/**< extra size for port user data */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue