mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa-util: Perform format and rate detection before setting HW params
Perform detection of supported sample format and rates just after device is opened, before `snd_pcm_hw_params()` is called for the first time. This fixes a problem where device restricts available sample rates after HW params are set preventing sample rate detection (seen with UAC2 devices and kernel 6.1.9)
This commit is contained in:
		
							parent
							
								
									43770c533c
								
							
						
					
					
						commit
						96ed03e1fc
					
				
					 6 changed files with 69 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -350,6 +350,37 @@ static inline void pa_xstrfreev(char **a) {
 | 
			
		|||
    pa_xfreev((void**)a);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	size_t size;
 | 
			
		||||
	char *ptr;
 | 
			
		||||
	FILE *f;
 | 
			
		||||
} pa_strbuf;
 | 
			
		||||
 | 
			
		||||
static inline pa_strbuf *pa_strbuf_new(void)
 | 
			
		||||
{
 | 
			
		||||
	pa_strbuf *s = pa_xnew0(pa_strbuf,1);
 | 
			
		||||
	s->f = open_memstream(&s->ptr, &s->size);
 | 
			
		||||
	return s;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static PA_PRINTF_FUNC(2,3) inline size_t pa_strbuf_printf(pa_strbuf *sb, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	va_list args;
 | 
			
		||||
	va_start(args, format);
 | 
			
		||||
	ret = fprintf(sb->f, format, args);
 | 
			
		||||
	va_end(args);
 | 
			
		||||
	return ret > 0 ? ret : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline char *pa_strbuf_to_string_free(pa_strbuf *sb)
 | 
			
		||||
{
 | 
			
		||||
	char *ptr;
 | 
			
		||||
	fclose(sb->f);
 | 
			
		||||
	ptr = sb->ptr;
 | 
			
		||||
	free(sb);
 | 
			
		||||
	return ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define pa_cstrerror	strerror
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue