mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	alsa-pcm: start playback immediately if there is start delay set
Without this change, playback_ready or capture_ready was called immediately after spa_alsa_start even tho start-delay was set. Ready function was called with not precise "nsec" value, as "nsec" plus latency should return time when the next buffer should be played which wasn't true as start-delay was not included. Now the playback is started immediately when the start_delay is set. The alsa_do_wakeup_work is still called immediately but two things can happened. Either start-delay is smaller then max_error and *_ready function is called immediately, or start-delay is bigger then max_error and state->next_time will be updated to correct value. Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
This commit is contained in:
		
							parent
							
								
									1e6dad14d3
								
							
						
					
					
						commit
						4c11a2aa9a
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -3603,16 +3603,17 @@ int spa_alsa_start(struct state *state) | |||
| 			return err; | ||||
| 	} | ||||
| 
 | ||||
| 	state->started = true; | ||||
| 	spa_loop_invoke(state->data_loop, do_state_sync, 0, NULL, 0, true, state); | ||||
| 
 | ||||
| 	/* playback will start after first write. Without tsched, we start
 | ||||
| 	 * right away so that the fds become active in poll right away. */ | ||||
| 	if (state->stream == SND_PCM_STREAM_PLAYBACK) { | ||||
| 		if (state->disable_tsched) | ||||
| 		if (state->disable_tsched || state->start_delay > 0) | ||||
| 			if ((err = do_start(state)) < 0) | ||||
| 				return err; | ||||
| 	} | ||||
| 
 | ||||
| 	state->started = true; | ||||
| 	spa_loop_invoke(state->data_loop, do_state_sync, 0, NULL, 0, true, state); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin Geier
						Martin Geier