mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink, source, device-port: renames to distinguish latency offsets
Renamed all variables pertaining to latency offsets of sinks and sources, calling them "port_latency_offset" or similar instead. All of these variables refer to latency offsets inherited from ports, rather than being unique to the sinks or sources themselves. This change is to pave the way for additional functionality for setting latency offsets on sources and sinks independenly from the value they inherit from their port. In order to implement them we first need this rename so that the two latency offsets can be stored individually and summed when reporting the total latency of the source or sink. The renames made are: pa_sink_set_latency_offset() -> pa_sink_set_port_latency_offset() pa_source_set_latency_offset() -> pa_source_set_port_latency_offset() sink->latency_offset -> sink->port_latency_offset sink->thread_info.latency_offset -> sink->thread_info.port_latency_offset source->latency_offset -> source->port_latency_offset source->thread_info.latency_offset -> source->thread_info.port_latency_offset PA_SINK_MESSAGE_SET_LATENCY_OFFSET -> PA_SINK_MESSAGE_SET_PORT_LATENCY_OFFSET PA_SOURCE_MESSAGE_SET_LATENCY_OFFSET -> PA_SOURCE_MESSAGE_SET_PORT_LATENCY_OFFSET
This commit is contained in:
		
							parent
							
								
									99c3bc69d5
								
							
						
					
					
						commit
						694662d936
					
				
					 5 changed files with 40 additions and 40 deletions
				
			
		| 
						 | 
				
			
			@ -310,9 +310,9 @@ pa_sink* pa_sink_new(
 | 
			
		|||
        s->active_port = pa_device_port_find_best(s->ports);
 | 
			
		||||
 | 
			
		||||
    if (s->active_port)
 | 
			
		||||
        s->latency_offset = s->active_port->latency_offset;
 | 
			
		||||
        s->port_latency_offset = s->active_port->latency_offset;
 | 
			
		||||
    else
 | 
			
		||||
        s->latency_offset = 0;
 | 
			
		||||
        s->port_latency_offset = 0;
 | 
			
		||||
 | 
			
		||||
    s->save_volume = data->save_volume;
 | 
			
		||||
    s->save_muted = data->save_muted;
 | 
			
		||||
| 
						 | 
				
			
			@ -345,7 +345,7 @@ pa_sink* pa_sink_new(
 | 
			
		|||
    pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume);
 | 
			
		||||
    s->thread_info.volume_change_safety_margin = core->deferred_volume_safety_margin_usec;
 | 
			
		||||
    s->thread_info.volume_change_extra_delay = core->deferred_volume_extra_delay_usec;
 | 
			
		||||
    s->thread_info.latency_offset = s->latency_offset;
 | 
			
		||||
    s->thread_info.port_latency_offset = s->port_latency_offset;
 | 
			
		||||
 | 
			
		||||
    /* FIXME: This should probably be moved to pa_sink_put() */
 | 
			
		||||
    pa_assert_se(pa_idxset_put(core->sinks, s, &s->index) >= 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1506,8 +1506,8 @@ pa_usec_t pa_sink_get_latency(pa_sink *s) {
 | 
			
		|||
 | 
			
		||||
    /* usec is unsigned, so check that the offset can be added to usec without
 | 
			
		||||
     * underflowing. */
 | 
			
		||||
    if (-s->latency_offset <= (int64_t) usec)
 | 
			
		||||
        usec += s->latency_offset;
 | 
			
		||||
    if (-s->port_latency_offset <= (int64_t) usec)
 | 
			
		||||
        usec += s->port_latency_offset;
 | 
			
		||||
    else
 | 
			
		||||
        usec = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1540,8 +1540,8 @@ pa_usec_t pa_sink_get_latency_within_thread(pa_sink *s) {
 | 
			
		|||
 | 
			
		||||
    /* usec is unsigned, so check that the offset can be added to usec without
 | 
			
		||||
     * underflowing. */
 | 
			
		||||
    if (-s->thread_info.latency_offset <= (int64_t) usec)
 | 
			
		||||
        usec += s->thread_info.latency_offset;
 | 
			
		||||
    if (-s->thread_info.port_latency_offset <= (int64_t) usec)
 | 
			
		||||
        usec += s->thread_info.port_latency_offset;
 | 
			
		||||
    else
 | 
			
		||||
        usec = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2887,8 +2887,8 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
 | 
			
		|||
            pa_sink_get_mute(s, true);
 | 
			
		||||
            return 0;
 | 
			
		||||
 | 
			
		||||
        case PA_SINK_MESSAGE_SET_LATENCY_OFFSET:
 | 
			
		||||
            s->thread_info.latency_offset = offset;
 | 
			
		||||
        case PA_SINK_MESSAGE_SET_PORT_LATENCY_OFFSET:
 | 
			
		||||
            s->thread_info.port_latency_offset = offset;
 | 
			
		||||
            return 0;
 | 
			
		||||
 | 
			
		||||
        case PA_SINK_MESSAGE_GET_LATENCY:
 | 
			
		||||
| 
						 | 
				
			
			@ -3287,15 +3287,15 @@ void pa_sink_set_fixed_latency_within_thread(pa_sink *s, pa_usec_t latency) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main context */
 | 
			
		||||
void pa_sink_set_latency_offset(pa_sink *s, int64_t offset) {
 | 
			
		||||
void pa_sink_set_port_latency_offset(pa_sink *s, int64_t offset) {
 | 
			
		||||
    pa_sink_assert_ref(s);
 | 
			
		||||
 | 
			
		||||
    s->latency_offset = offset;
 | 
			
		||||
    s->port_latency_offset = offset;
 | 
			
		||||
 | 
			
		||||
    if (PA_SINK_IS_LINKED(s->state))
 | 
			
		||||
        pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_LATENCY_OFFSET, NULL, offset, NULL) == 0);
 | 
			
		||||
        pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_PORT_LATENCY_OFFSET, NULL, offset, NULL) == 0);
 | 
			
		||||
    else
 | 
			
		||||
        s->thread_info.latency_offset = offset;
 | 
			
		||||
        s->thread_info.port_latency_offset = offset;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main context */
 | 
			
		||||
| 
						 | 
				
			
			@ -3368,7 +3368,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, bool save) {
 | 
			
		|||
    s->active_port = port;
 | 
			
		||||
    s->save_port = save;
 | 
			
		||||
 | 
			
		||||
    pa_sink_set_latency_offset(s, s->active_port->latency_offset);
 | 
			
		||||
    pa_sink_set_port_latency_offset(s, s->active_port->latency_offset);
 | 
			
		||||
 | 
			
		||||
    pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_PORT_CHANGED], s);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue