mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module: disable resample when following graph rate
When we don't set a rate, assume both input and output streams are following the graph rate and so disable the resampler. This mostly works around an issue where the input and output could negotiate to different rates in some cases. With the resampler disabled this would still result in the same amount of samples going in as comming out instead of a stuttering mismatch. See #2969
This commit is contained in:
		
							parent
							
								
									3db3e6dacf
								
							
						
					
					
						commit
						ad5ac964af
					
				
					 3 changed files with 25 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -706,6 +706,23 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
			
		|||
	parse_audio_info(impl->capture_props, &impl->capture_info);
 | 
			
		||||
	parse_audio_info(impl->playback_props, &impl->playback_info);
 | 
			
		||||
 | 
			
		||||
	if (!impl->capture_info.rate && !impl->playback_info.rate) {
 | 
			
		||||
		if (pw_properties_get(impl->playback_props, "resample.disable") == NULL)
 | 
			
		||||
			pw_properties_set(impl->playback_props, "resample.disable", "true");
 | 
			
		||||
		if (pw_properties_get(impl->capture_props, "resample.disable") == NULL)
 | 
			
		||||
			pw_properties_set(impl->capture_props, "resample.disable", "true");
 | 
			
		||||
	} else if (impl->capture_info.rate && !impl->playback_info.rate)
 | 
			
		||||
		impl->playback_info.rate = impl->capture_info.rate;
 | 
			
		||||
	else if (impl->playback_info.rate && !impl->capture_info.rate)
 | 
			
		||||
		impl->capture_info.rate = !impl->playback_info.rate;
 | 
			
		||||
	else if (impl->capture_info.rate != impl->playback_info.rate) {
 | 
			
		||||
		pw_log_warn("Both capture and playback rate are set, but"
 | 
			
		||||
			" they are different. Using the highest of two. This behaviour"
 | 
			
		||||
			" is deprecated, please use equal rates in the module config");
 | 
			
		||||
		impl->playback_info.rate = impl->capture_info.rate =
 | 
			
		||||
			SPA_MAX(impl->playback_info.rate, impl->capture_info.rate);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (pw_properties_get(impl->capture_props, PW_KEY_MEDIA_NAME) == NULL)
 | 
			
		||||
		pw_properties_setf(impl->capture_props, PW_KEY_MEDIA_NAME, "%s input",
 | 
			
		||||
				pw_properties_get(impl->capture_props, PW_KEY_NODE_DESCRIPTION));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue