mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert: handle NULL params
This commit is contained in:
		
							parent
							
								
									38e8e76f76
								
							
						
					
					
						commit
						10f1d545a7
					
				
					 1 changed files with 12 additions and 6 deletions
				
			
		| 
						 | 
					@ -90,8 +90,8 @@ struct props {
 | 
				
			||||||
	struct volumes monitor;
 | 
						struct volumes monitor;
 | 
				
			||||||
	unsigned int have_soft_volume:1;
 | 
						unsigned int have_soft_volume:1;
 | 
				
			||||||
	unsigned int mix_disabled:1;
 | 
						unsigned int mix_disabled:1;
 | 
				
			||||||
	unsigned int resample_quality;
 | 
					 | 
				
			||||||
	unsigned int resample_disabled:1;
 | 
						unsigned int resample_disabled:1;
 | 
				
			||||||
 | 
						unsigned int resample_quality;
 | 
				
			||||||
	double rate;
 | 
						double rate;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,10 +105,11 @@ static void props_reset(struct props *props)
 | 
				
			||||||
	init_volumes(&props->channel);
 | 
						init_volumes(&props->channel);
 | 
				
			||||||
	init_volumes(&props->soft);
 | 
						init_volumes(&props->soft);
 | 
				
			||||||
	init_volumes(&props->monitor);
 | 
						init_volumes(&props->monitor);
 | 
				
			||||||
 | 
						props->have_soft_volume = false;
 | 
				
			||||||
	props->mix_disabled = false;
 | 
						props->mix_disabled = false;
 | 
				
			||||||
	props->rate = 1.0;
 | 
					 | 
				
			||||||
	props->resample_quality = RESAMPLE_DEFAULT_QUALITY;
 | 
					 | 
				
			||||||
	props->resample_disabled = false;
 | 
						props->resample_disabled = false;
 | 
				
			||||||
 | 
						props->resample_quality = RESAMPLE_DEFAULT_QUALITY;
 | 
				
			||||||
 | 
						props->rate = 1.0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct buffer {
 | 
					struct buffer {
 | 
				
			||||||
| 
						 | 
					@ -835,6 +836,8 @@ static int parse_prop_params(struct impl *this, struct spa_pod *params)
 | 
				
			||||||
			snprintf(value, sizeof(value), "%s",
 | 
								snprintf(value, sizeof(value), "%s",
 | 
				
			||||||
					SPA_POD_VALUE(struct spa_pod_bool, pod) ?
 | 
										SPA_POD_VALUE(struct spa_pod_bool, pod) ?
 | 
				
			||||||
					"true" : "false");
 | 
										"true" : "false");
 | 
				
			||||||
 | 
							} else if (spa_pod_is_none(pod)) {
 | 
				
			||||||
 | 
								spa_zero(value);
 | 
				
			||||||
		} else
 | 
							} else
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2854,15 +2857,18 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
		else if (spa_streq(k, "resample.peaks"))
 | 
							else if (spa_streq(k, "resample.peaks"))
 | 
				
			||||||
			this->resample_peaks = spa_atob(s);
 | 
								this->resample_peaks = spa_atob(s);
 | 
				
			||||||
		else if (spa_streq(k, "resample.prefill"))
 | 
							else if (spa_streq(k, "resample.prefill"))
 | 
				
			||||||
			this->resample.options |= RESAMPLE_OPTION_PREFILL;
 | 
								SPA_FLAG_UPDATE(this->resample.options,
 | 
				
			||||||
 | 
									RESAMPLE_OPTION_PREFILL, spa_atob(s));
 | 
				
			||||||
		else if (spa_streq(k, "factory.mode")) {
 | 
							else if (spa_streq(k, "factory.mode")) {
 | 
				
			||||||
			if (spa_streq(s, "merge"))
 | 
								if (spa_streq(s, "merge"))
 | 
				
			||||||
				this->direction = SPA_DIRECTION_OUTPUT;
 | 
									this->direction = SPA_DIRECTION_OUTPUT;
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				this->direction = SPA_DIRECTION_INPUT;
 | 
									this->direction = SPA_DIRECTION_INPUT;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (spa_streq(k, SPA_KEY_AUDIO_POSITION))
 | 
							else if (spa_streq(k, SPA_KEY_AUDIO_POSITION)) {
 | 
				
			||||||
                        this->props.n_channels = parse_position(this->props.channel_map, s, strlen(s));
 | 
								if (s != NULL)
 | 
				
			||||||
 | 
						                        this->props.n_channels = parse_position(this->props.channel_map, s, strlen(s));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			audioconvert_set_param(this, k, s);
 | 
								audioconvert_set_param(this, k, s);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue