mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	alsa: don't fail if 3 periods_min fails
Some drivers (emu10k1) appear to not necessarily support more than 2 periods. Don't fail start if snd_pcm_hw_params_set_periods_min() fails, then we just set nearest possible periods and buffer sizes.
This commit is contained in:
		
							parent
							
								
									f0a5f09420
								
							
						
					
					
						commit
						2e2f7c9f79
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -2360,10 +2360,14 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ | ||||||
| 		snd_pcm_uframes_t period_size_max; | 		snd_pcm_uframes_t period_size_max; | ||||||
| 		unsigned int periods_min = (periods == UINT_MAX) ? 3 : periods; | 		unsigned int periods_min = (periods == UINT_MAX) ? 3 : periods; | ||||||
| 
 | 
 | ||||||
| 		CHECK(snd_pcm_hw_params_set_periods_min(hndl, params, &periods_min, &dir), "set_periods_min"); | 		err = snd_pcm_hw_params_set_periods_min(hndl, params, &periods_min, &dir); | ||||||
| 		CHECK(snd_pcm_hw_params_get_period_size_max(params, &period_size_max, &dir), "get_period_size_max"); | 		if (!err) { | ||||||
| 		if (period_size > period_size_max) | 			CHECK(snd_pcm_hw_params_get_period_size_max(params, &period_size_max, &dir), "get_period_size_max"); | ||||||
| 			period_size = SPA_MIN(period_size, flp2(period_size_max)); | 			if (period_size > period_size_max) | ||||||
|  | 				period_size = SPA_MIN(period_size, flp2(period_size_max)); | ||||||
|  | 		} else { | ||||||
|  | 			spa_log_debug(state->log, "set_periods_min: %s", snd_strerror(err)); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near"); | 	CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pauli Virtanen
						Pauli Virtanen