mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	client-node: keep port buffers in special location
Keep the output port buffers in a special mix info. They should stay there even when the mix is removed and should only be cleared explicitly with a NULL Format or 0 use_buffers.
This commit is contained in:
		
							parent
							
								
									96ba0fbdeb
								
							
						
					
					
						commit
						0af87d2685
					
				
					 2 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -169,6 +169,7 @@ static int spa_v4l2_clear_buffers(struct impl *this)
 | 
				
			||||||
					d[0].maxsize - d[0].mapoffset);
 | 
										d[0].maxsize - d[0].mapoffset);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_ALLOCATED)) {
 | 
							if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_ALLOCATED)) {
 | 
				
			||||||
 | 
								spa_log_debug(this->log, "v4l2: close %d", (int) d[0].fd);
 | 
				
			||||||
			close(d[0].fd);
 | 
								close(d[0].fd);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		d[0].type = SPA_ID_INVALID;
 | 
							d[0].type = SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -618,7 +618,7 @@ impl_node_port_set_param(void *object,
 | 
				
			||||||
	spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
				
			||||||
	spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
						spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: port %d.%d add param %s %d", this,
 | 
						pw_log_debug(NAME" %p: port %d.%d set param %s %d", this,
 | 
				
			||||||
			direction, port_id,
 | 
								direction, port_id,
 | 
				
			||||||
			spa_debug_type_find_name(spa_type_param, id), id);
 | 
								spa_debug_type_find_name(spa_type_param, id), id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -627,7 +627,6 @@ impl_node_port_set_param(void *object,
 | 
				
			||||||
	if (id == SPA_PARAM_Format) {
 | 
						if (id == SPA_PARAM_Format) {
 | 
				
			||||||
		for (i = 0; i < MAX_MIX+1; i++) {
 | 
							for (i = 0; i < MAX_MIX+1; i++) {
 | 
				
			||||||
			struct mix *mix = &port->mix[i];
 | 
								struct mix *mix = &port->mix[i];
 | 
				
			||||||
			if (mix->valid)
 | 
					 | 
				
			||||||
			clear_buffers(this, mix);
 | 
								clear_buffers(this, mix);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -732,6 +731,9 @@ do_port_use_buffers(struct impl *impl,
 | 
				
			||||||
	if (!p->have_format)
 | 
						if (!p->have_format)
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (direction == SPA_DIRECTION_OUTPUT)
 | 
				
			||||||
 | 
							mix_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
 | 
						if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1015,10 +1017,12 @@ static int client_node_port_buffers(void *data,
 | 
				
			||||||
	if (!p->have_format)
 | 
						if (!p->have_format)
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (direction == SPA_DIRECTION_OUTPUT)
 | 
				
			||||||
 | 
							mix_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
 | 
						if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i < n_buffers; i++) {
 | 
						for (i = 0; i < n_buffers; i++) {
 | 
				
			||||||
		struct spa_buffer *oldbuf, *newbuf;
 | 
							struct spa_buffer *oldbuf, *newbuf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue