mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-chain: remove mutex
We only ever load the IR from the main thread so we don't need a lock.
This commit is contained in:
		
							parent
							
								
									42a40e07d7
								
							
						
					
					
						commit
						6539535176
					
				
					 1 changed files with 2 additions and 15 deletions
				
			
		| 
						 | 
					@ -15,11 +15,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_SAMPLES	8192u
 | 
					#define MAX_SAMPLES	8192u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// > If your program is using several threads, you must use
 | 
					 | 
				
			||||||
// > appropriate synchronisation mechanisms so only
 | 
					 | 
				
			||||||
// > a single thread can access the mysofa_open_cached
 | 
					 | 
				
			||||||
// > and mysofa_close_cached functions at a given time.
 | 
					 | 
				
			||||||
static pthread_mutex_t libmysofa_mutex = PTHREAD_MUTEX_INITIALIZER;
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct dsp_ops *dsp_ops;
 | 
					static struct dsp_ops *dsp_ops;
 | 
				
			||||||
| 
						 | 
					@ -97,9 +92,7 @@ static void * spatializer_instantiate(const struct fc_descriptor * Descriptor,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int ret = MYSOFA_OK;
 | 
						int ret = MYSOFA_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pthread_mutex_lock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
	impl->sofa = mysofa_open_cached(filename, SampleRate, &impl->n_samples, &ret);
 | 
						impl->sofa = mysofa_open_cached(filename, SampleRate, &impl->n_samples, &ret);
 | 
				
			||||||
	pthread_mutex_unlock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ret != MYSOFA_OK) {
 | 
						if (ret != MYSOFA_OK) {
 | 
				
			||||||
		pw_log_error("Unable to load HRTF from %s: %d %m", filename, ret);
 | 
							pw_log_error("Unable to load HRTF from %s: %d %m", filename, ret);
 | 
				
			||||||
| 
						 | 
					@ -120,11 +113,8 @@ static void * spatializer_instantiate(const struct fc_descriptor * Descriptor,
 | 
				
			||||||
	impl->rate = SampleRate;
 | 
						impl->rate = SampleRate;
 | 
				
			||||||
	return impl;
 | 
						return impl;
 | 
				
			||||||
error:
 | 
					error:
 | 
				
			||||||
	if (impl->sofa) {
 | 
						if (impl->sofa)
 | 
				
			||||||
		pthread_mutex_lock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
		mysofa_close_cached(impl->sofa);
 | 
							mysofa_close_cached(impl->sofa);
 | 
				
			||||||
		pthread_mutex_unlock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	free(impl);
 | 
						free(impl);
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
| 
						 | 
					@ -274,11 +264,8 @@ static void spatializer_cleanup(void * Instance)
 | 
				
			||||||
			convolver_free(impl->r_conv[i]);
 | 
								convolver_free(impl->r_conv[i]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#ifdef HAVE_LIBMYSOFA
 | 
					#ifdef HAVE_LIBMYSOFA
 | 
				
			||||||
	if (impl->sofa) {
 | 
						if (impl->sofa)
 | 
				
			||||||
		pthread_mutex_lock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
		mysofa_close_cached(impl->sofa);
 | 
							mysofa_close_cached(impl->sofa);
 | 
				
			||||||
		pthread_mutex_unlock(&libmysofa_mutex);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	free(impl->tmp[0]);
 | 
						free(impl->tmp[0]);
 | 
				
			||||||
	free(impl->tmp[1]);
 | 
						free(impl->tmp[1]);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue