mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v4l2: handle empty properties gracefully
When a property is not found or is empty, go on to the next format instead of failing. See #3959
This commit is contained in:
		
							parent
							
								
									28ab18ddd4
								
							
						
					
					
						commit
						b5284791fc
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -386,9 +386,8 @@ enum_filter_format(uint32_t media_type, int32_t media_subtype,
 | 
				
			||||||
				return -ENOENT;
 | 
									return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
								val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
				
			||||||
 | 
								if (val->type != SPA_TYPE_Id || n_values == 0)
 | 
				
			||||||
			if (val->type != SPA_TYPE_Id)
 | 
									return SPA_VIDEO_FORMAT_UNKNOWN;
 | 
				
			||||||
				return -EINVAL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			values = SPA_POD_BODY(val);
 | 
								values = SPA_POD_BODY(val);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -614,7 +613,7 @@ do_enum_fmt:
 | 
				
			||||||
				goto do_frmsize;
 | 
									goto do_frmsize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			val = spa_pod_get_values(&p->value, &n_vals, &choice);
 | 
								val = spa_pod_get_values(&p->value, &n_vals, &choice);
 | 
				
			||||||
			if (val->type != SPA_TYPE_Rectangle)
 | 
								if (val->type != SPA_TYPE_Rectangle || n_vals == 0)
 | 
				
			||||||
				goto enum_end;
 | 
									goto enum_end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (choice == SPA_CHOICE_None) {
 | 
								if (choice == SPA_CHOICE_None) {
 | 
				
			||||||
| 
						 | 
					@ -652,7 +651,7 @@ do_enum_fmt:
 | 
				
			||||||
				goto have_size;
 | 
									goto have_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
								val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
				
			||||||
			if (val->type != SPA_TYPE_Rectangle)
 | 
								if (val->type != SPA_TYPE_Rectangle || n_values == 0)
 | 
				
			||||||
				goto have_size;
 | 
									goto have_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			values = SPA_POD_BODY_CONST(val);
 | 
								values = SPA_POD_BODY_CONST(val);
 | 
				
			||||||
| 
						 | 
					@ -772,8 +771,7 @@ do_enum_fmt:
 | 
				
			||||||
				goto have_framerate;
 | 
									goto have_framerate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
								val = spa_pod_get_values(&p->value, &n_values, &choice);
 | 
				
			||||||
 | 
								if (val->type != SPA_TYPE_Fraction || n_values == 0)
 | 
				
			||||||
			if (val->type != SPA_TYPE_Fraction)
 | 
					 | 
				
			||||||
				goto enum_end;
 | 
									goto enum_end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			values = SPA_POD_BODY(val);
 | 
								values = SPA_POD_BODY(val);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue