mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	core: explicitly calculate min and max quantum
Just clamp to default for now until we can implement power save mode.
This commit is contained in:
		
							parent
							
								
									b74080ea55
								
							
						
					
					
						commit
						12fb58add1
					
				
					 4 changed files with 18 additions and 9 deletions
				
			
		| 
						 | 
					@ -49,9 +49,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_IDLE_SECONDS	3
 | 
					#define DEFAULT_IDLE_SECONDS	3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MIN_QUANTUM_SIZE	64
 | 
					 | 
				
			||||||
#define MAX_QUANTUM_SIZE	1024
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct impl;
 | 
					struct impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct monitor {
 | 
					struct monitor {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,8 +94,6 @@ static int alloc_buffers(struct pw_mempool *pool,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i < n_datas; i++) {
 | 
						for (i = 0; i < n_datas; i++) {
 | 
				
			||||||
		struct spa_data *d = &datas[i];
 | 
							struct spa_data *d = &datas[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1080,7 +1080,9 @@ static int collect_nodes(struct pw_node *driver)
 | 
				
			||||||
	struct pw_node *n, *t;
 | 
						struct pw_node *n, *t;
 | 
				
			||||||
	struct pw_port *p;
 | 
						struct pw_port *p;
 | 
				
			||||||
	struct pw_link *l;
 | 
						struct pw_link *l;
 | 
				
			||||||
	uint32_t quantum = DEFAULT_QUANTUM;
 | 
						uint32_t max_quantum = 0;
 | 
				
			||||||
 | 
						uint32_t min_quantum = 0;
 | 
				
			||||||
 | 
						uint32_t quantum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_consume(t, &driver->slave_list, slave_link) {
 | 
						spa_list_consume(t, &driver->slave_list, slave_link) {
 | 
				
			||||||
		spa_list_remove(&t->slave_link);
 | 
							spa_list_remove(&t->slave_link);
 | 
				
			||||||
| 
						 | 
					@ -1097,8 +1099,12 @@ static int collect_nodes(struct pw_node *driver)
 | 
				
			||||||
		spa_list_remove(&n->sort_link);
 | 
							spa_list_remove(&n->sort_link);
 | 
				
			||||||
		pw_node_set_driver(n, driver);
 | 
							pw_node_set_driver(n, driver);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (n->quantum_size > 0 && n->quantum_size < quantum)
 | 
							if (n->quantum_size > 0) {
 | 
				
			||||||
			quantum = n->quantum_size;
 | 
								if (min_quantum == 0 || n->quantum_size < min_quantum)
 | 
				
			||||||
 | 
									min_quantum = n->quantum_size;
 | 
				
			||||||
 | 
								if (n->quantum_size > max_quantum)
 | 
				
			||||||
 | 
									max_quantum = n->quantum_size;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_list_for_each(p, &n->input_ports, link) {
 | 
							spa_list_for_each(p, &n->input_ports, link) {
 | 
				
			||||||
			spa_list_for_each(l, &p->links, input_link) {
 | 
								spa_list_for_each(l, &p->links, input_link) {
 | 
				
			||||||
| 
						 | 
					@ -1119,7 +1125,14 @@ static int collect_nodes(struct pw_node *driver)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	driver->quantum_current = SPA_MAX(quantum, MIN_QUANTUM);
 | 
					
 | 
				
			||||||
 | 
						quantum = min_quantum;
 | 
				
			||||||
 | 
						if (quantum == 0)
 | 
				
			||||||
 | 
							quantum = DEFAULT_QUANTUM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* for now, we try to limit the latency between min and default, We can
 | 
				
			||||||
 | 
						 * go higher but we should really only do this when in power save mode */
 | 
				
			||||||
 | 
						driver->quantum_current = SPA_CLAMP(quantum, MIN_QUANTUM, DEFAULT_QUANTUM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,6 +50,7 @@ extern "C" {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_QUANTUM		1024u
 | 
					#define DEFAULT_QUANTUM		1024u
 | 
				
			||||||
#define MIN_QUANTUM		32u
 | 
					#define MIN_QUANTUM		32u
 | 
				
			||||||
 | 
					#define MAX_QUANTUM		8192u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_PARAMS	32
 | 
					#define MAX_PARAMS	32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue