mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	alsa: Don't disable timer-based scheduling on USB devices
This isn't a great fix, but we need ALSA API to do this right. In the mean time, USB devices work fine with timer-based scheduling, so there's no reason to force a large minimum latency by disabling tsched on them.
This commit is contained in:
		
							parent
							
								
									5e8161448e
								
							
						
					
					
						commit
						810aa36189
					
				
					 1 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -261,9 +261,26 @@ int pa_alsa_set_hw_params(
 | 
			
		|||
 | 
			
		||||
    /* The PCM pointer is only updated with period granularity */
 | 
			
		||||
    if (snd_pcm_hw_params_is_batch(hwparams)) {
 | 
			
		||||
        bool is_usb = false;
 | 
			
		||||
        const char *id;
 | 
			
		||||
        snd_pcm_info_t* pcm_info;
 | 
			
		||||
        snd_pcm_info_alloca(&pcm_info);
 | 
			
		||||
 | 
			
		||||
        if (snd_pcm_info(pcm_handle, pcm_info) == 0 &&
 | 
			
		||||
            (id = snd_pcm_info_get_id(pcm_info))) {
 | 
			
		||||
            /* This horrible hack makes sure we don't disable tsched on USB
 | 
			
		||||
             * devices, which have a low enough transfer size for timer-based
 | 
			
		||||
             * scheduling to work. This can go away when the ALSA API supprots
 | 
			
		||||
             * querying the block transfer size. */
 | 
			
		||||
            if (pa_streq(id, "USB Audio"))
 | 
			
		||||
                is_usb = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!is_usb) {
 | 
			
		||||
            pa_log_info("Disabling tsched mode since BATCH flag is set");
 | 
			
		||||
            _use_tsched = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if (SND_LIB_VERSION >= ((1<<16)|(0<<8)|24)) /* API additions in 1.0.24 */
 | 
			
		||||
    if (_use_tsched) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue