mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink, source: Add a latency offset which is inherited from the port
A latency offset variable was added to the sink/source struct. Also a function was introduced to update the latency offset of the sink/source and a new message type was introduced so we can send the latency offset to the IO thread. The latency offset is automatically populated with the latency from the currently active port.
This commit is contained in:
		
							parent
							
								
									bc03487896
								
							
						
					
					
						commit
						eebdda456b
					
				
					 5 changed files with 92 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -113,6 +113,9 @@ struct pa_sink {
 | 
			
		|||
    pa_device_port *active_port;
 | 
			
		||||
    pa_atomic_t mixer_dirty;
 | 
			
		||||
 | 
			
		||||
    /* The latency offset is inherited from the currently active port */
 | 
			
		||||
    pa_usec_t latency_offset;
 | 
			
		||||
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
 | 
			
		||||
    /* Called when the main loop requests a state change. Called from
 | 
			
		||||
| 
						 | 
				
			
			@ -268,6 +271,9 @@ struct pa_sink {
 | 
			
		|||
         * in changing it */
 | 
			
		||||
        pa_usec_t fixed_latency; /* for sinks with PA_SINK_DYNAMIC_LATENCY this is 0 */
 | 
			
		||||
 | 
			
		||||
        /* This latency offset is a direct copy from s->latency_offset */
 | 
			
		||||
        pa_usec_t latency_offset;
 | 
			
		||||
 | 
			
		||||
        /* Delayed volume change events are queued here. The events
 | 
			
		||||
         * are stored in expiration order. The one expiring next is in
 | 
			
		||||
         * the head of the list. */
 | 
			
		||||
| 
						 | 
				
			
			@ -317,6 +323,7 @@ typedef enum pa_sink_message {
 | 
			
		|||
    PA_SINK_MESSAGE_SET_MAX_REQUEST,
 | 
			
		||||
    PA_SINK_MESSAGE_SET_PORT,
 | 
			
		||||
    PA_SINK_MESSAGE_UPDATE_VOLUME_AND_MUTE,
 | 
			
		||||
    PA_SINK_MESSAGE_SET_LATENCY_OFFSET,
 | 
			
		||||
    PA_SINK_MESSAGE_MAX
 | 
			
		||||
} pa_sink_message_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -403,6 +410,7 @@ unsigned pa_device_init_priority(pa_proplist *p);
 | 
			
		|||
/**** May be called by everyone, from main context */
 | 
			
		||||
 | 
			
		||||
pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough);
 | 
			
		||||
void pa_sink_set_latency_offset(pa_sink *s, pa_usec_t offset);
 | 
			
		||||
 | 
			
		||||
/* The returned value is supposed to be in the time domain of the sound card! */
 | 
			
		||||
pa_usec_t pa_sink_get_latency(pa_sink *s);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue