mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v4l2: probe number of buffers as well
Instead of just probing with 2 buffers, probe with the MAX_BUFFERS and remember how many buffers we received. Some drivers (v4l2loopback) work with less than MAX_BUFFERS (8) and we need to set the max number of buffers in the Buffers param.
This commit is contained in:
		
							parent
							
								
									71f6d269db
								
							
						
					
					
						commit
						877c262e78
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -75,6 +75,7 @@ struct port {
 | 
			
		|||
	bool alloc_buffers;
 | 
			
		||||
	bool probed_expbuf;
 | 
			
		||||
	bool have_expbuf;
 | 
			
		||||
	uint32_t max_buffers;
 | 
			
		||||
 | 
			
		||||
	bool next_fmtdesc;
 | 
			
		||||
	struct v4l2_fmtdesc fmtdesc;
 | 
			
		||||
| 
						 | 
				
			
			@ -578,10 +579,13 @@ static int impl_node_port_enum_params(void *object, int seq,
 | 
			
		|||
			return -EIO;
 | 
			
		||||
		if (result.index > 0)
 | 
			
		||||
			return 0;
 | 
			
		||||
		if (port->max_buffers == 0)
 | 
			
		||||
			return -EIO;
 | 
			
		||||
 | 
			
		||||
		param = spa_pod_builder_add_object(&b.b,
 | 
			
		||||
			SPA_TYPE_OBJECT_ParamBuffers, id,
 | 
			
		||||
			SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(4, 1, MAX_BUFFERS),
 | 
			
		||||
			SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(SPA_MIN(4u, port->max_buffers),
 | 
			
		||||
				1, port->max_buffers),
 | 
			
		||||
			SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
			
		||||
			SPA_PARAM_BUFFERS_size,    SPA_POD_Int(port->fmt.fmt.pix.sizeimage),
 | 
			
		||||
			SPA_PARAM_BUFFERS_stride,  SPA_POD_Int(port->fmt.fmt.pix.bytesperline));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue