mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-10-29 05:40:23 -04:00 
			
		
		
		
	daemon.conf: Add boolean rescue_streams parameter
Since merge requests https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/209 and https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/216 the rescuing of streams could no longer be disabled. This patch adds a boolean parameter rescue-streams to daemon.conf which allows to disable rescuing. The parameter defaults to true (rescuing enabled).
This commit is contained in:
		
							parent
							
								
									97d0eda256
								
							
						
					
					
						commit
						b72f295597
					
				
					 11 changed files with 29 additions and 10 deletions
				
			
		|  | @ -255,6 +255,15 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. | ||||||
|       to <opt>no</opt>.</p> |       to <opt>no</opt>.</p> | ||||||
|     </option> |     </option> | ||||||
| 
 | 
 | ||||||
|  |     <option> | ||||||
|  |       <p><opt>rescue-streams=</opt> Enable rescuing of streams if the | ||||||
|  |       used sink or source becomes unavailable. Takes a boolean argument. | ||||||
|  |       If set to <opt>yes</opt>, pulseaudio will try to move the streams | ||||||
|  |       from a sink or source that becomes unavailable to the default sink | ||||||
|  |       or source. If set to <opt>no</opt>, streams will be killed if the | ||||||
|  |       corresponding sink or source disappears. Defaults to <opt>yes</opt>.</p> | ||||||
|  |     </option> | ||||||
|  | 
 | ||||||
|   </section> |   </section> | ||||||
| 
 | 
 | ||||||
|   <section name="Scheduling"> |   <section name="Scheduling"> | ||||||
|  |  | ||||||
|  | @ -69,6 +69,7 @@ static const pa_daemon_conf default_conf = { | ||||||
|     .disallow_module_loading = false, |     .disallow_module_loading = false, | ||||||
|     .disallow_exit = false, |     .disallow_exit = false, | ||||||
|     .flat_volumes = false, |     .flat_volumes = false, | ||||||
|  |     .rescue_streams = true, | ||||||
|     .exit_idle_time = 20, |     .exit_idle_time = 20, | ||||||
|     .scache_idle_time = 20, |     .scache_idle_time = 20, | ||||||
|     .script_commands = NULL, |     .script_commands = NULL, | ||||||
|  | @ -580,6 +581,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { | ||||||
|         { "enable-shm",                 pa_config_parse_not_bool, &c->disable_shm, NULL }, |         { "enable-shm",                 pa_config_parse_not_bool, &c->disable_shm, NULL }, | ||||||
|         { "enable-memfd",               pa_config_parse_not_bool, &c->disable_memfd, NULL }, |         { "enable-memfd",               pa_config_parse_not_bool, &c->disable_memfd, NULL }, | ||||||
|         { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL }, |         { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL }, | ||||||
|  |         { "rescue-streams",             pa_config_parse_bool,     &c->rescue_streams, NULL }, | ||||||
|         { "lock-memory",                pa_config_parse_bool,     &c->lock_memory, NULL }, |         { "lock-memory",                pa_config_parse_bool,     &c->lock_memory, NULL }, | ||||||
|         { "enable-deferred-volume",     pa_config_parse_bool,     &c->deferred_volume, NULL }, |         { "enable-deferred-volume",     pa_config_parse_bool,     &c->deferred_volume, NULL }, | ||||||
|         { "exit-idle-time",             pa_config_parse_int,      &c->exit_idle_time, NULL }, |         { "exit-idle-time",             pa_config_parse_int,      &c->exit_idle_time, NULL }, | ||||||
|  | @ -794,6 +796,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { | ||||||
|     pa_strbuf_printf(s, "cpu-limit = %s\n", pa_yes_no(!c->no_cpu_limit)); |     pa_strbuf_printf(s, "cpu-limit = %s\n", pa_yes_no(!c->no_cpu_limit)); | ||||||
|     pa_strbuf_printf(s, "enable-shm = %s\n", pa_yes_no(!c->disable_shm)); |     pa_strbuf_printf(s, "enable-shm = %s\n", pa_yes_no(!c->disable_shm)); | ||||||
|     pa_strbuf_printf(s, "flat-volumes = %s\n", pa_yes_no(c->flat_volumes)); |     pa_strbuf_printf(s, "flat-volumes = %s\n", pa_yes_no(c->flat_volumes)); | ||||||
|  |     pa_strbuf_printf(s, "rescue-streams = %s\n", pa_yes_no(c->rescue_streams)); | ||||||
|     pa_strbuf_printf(s, "lock-memory = %s\n", pa_yes_no(c->lock_memory)); |     pa_strbuf_printf(s, "lock-memory = %s\n", pa_yes_no(c->lock_memory)); | ||||||
|     pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time); |     pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time); | ||||||
|     pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time); |     pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time); | ||||||
|  |  | ||||||
|  | @ -77,6 +77,7 @@ typedef struct pa_daemon_conf { | ||||||
|         log_meta, |         log_meta, | ||||||
|         log_time, |         log_time, | ||||||
|         flat_volumes, |         flat_volumes, | ||||||
|  |         rescue_streams, | ||||||
|         lock_memory, |         lock_memory, | ||||||
|         deferred_volume; |         deferred_volume; | ||||||
|     pa_server_type_t local_server_type; |     pa_server_type_t local_server_type; | ||||||
|  |  | ||||||
|  | @ -63,6 +63,8 @@ ifelse(@HAVE_DBUS@, 1, [dnl | ||||||
| 
 | 
 | ||||||
| ; flat-volumes = no | ; flat-volumes = no | ||||||
| 
 | 
 | ||||||
|  | ; rescue-streams = yes | ||||||
|  | 
 | ||||||
| ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl | ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl | ||||||
| ; rlimit-fsize = -1 | ; rlimit-fsize = -1 | ||||||
| ; rlimit-data = -1 | ; rlimit-data = -1 | ||||||
|  |  | ||||||
|  | @ -1062,6 +1062,7 @@ int main(int argc, char *argv[]) { | ||||||
|     c->running_as_daemon = conf->daemonize; |     c->running_as_daemon = conf->daemonize; | ||||||
|     c->disallow_exit = conf->disallow_exit; |     c->disallow_exit = conf->disallow_exit; | ||||||
|     c->flat_volumes = conf->flat_volumes; |     c->flat_volumes = conf->flat_volumes; | ||||||
|  |     c->rescue_streams = conf->rescue_streams; | ||||||
| #ifdef HAVE_DBUS | #ifdef HAVE_DBUS | ||||||
|     c->server_type = conf->local_server_type; |     c->server_type = conf->local_server_type; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -213,6 +213,7 @@ struct pa_core { | ||||||
|     int exit_idle_time, scache_idle_time; |     int exit_idle_time, scache_idle_time; | ||||||
| 
 | 
 | ||||||
|     bool flat_volumes:1; |     bool flat_volumes:1; | ||||||
|  |     bool rescue_streams:1; | ||||||
|     bool disallow_module_loading:1; |     bool disallow_module_loading:1; | ||||||
|     bool disallow_exit:1; |     bool disallow_exit:1; | ||||||
|     bool running_as_daemon:1; |     bool running_as_daemon:1; | ||||||
|  |  | ||||||
|  | @ -105,9 +105,10 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) { | ||||||
| 
 | 
 | ||||||
|             sink = pa_device_port_get_sink(p); |             sink = pa_device_port_get_sink(p); | ||||||
|             if (sink && p == sink->active_port) { |             if (sink && p == sink->active_port) { | ||||||
|                 if (sink->active_port->available == PA_AVAILABLE_NO) |                 if (sink->active_port->available == PA_AVAILABLE_NO) { | ||||||
|                     pa_sink_move_streams_to_default_sink(p->core, sink, false); |                     if (p->core->rescue_streams) | ||||||
|                 else |                         pa_sink_move_streams_to_default_sink(p->core, sink, false); | ||||||
|  |                 } else | ||||||
|                     pa_core_move_streams_to_newly_available_preferred_sink(p->core, sink); |                     pa_core_move_streams_to_newly_available_preferred_sink(p->core, sink); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|  | @ -115,9 +116,10 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) { | ||||||
| 
 | 
 | ||||||
|             source = pa_device_port_get_source(p); |             source = pa_device_port_get_source(p); | ||||||
|             if (source && p == source->active_port) { |             if (source && p == source->active_port) { | ||||||
|                 if (source->active_port->available == PA_AVAILABLE_NO) |                 if (source->active_port->available == PA_AVAILABLE_NO) { | ||||||
|                     pa_source_move_streams_to_default_source(p->core, source, false); |                     if (p->core->rescue_streams) | ||||||
|                 else |                         pa_source_move_streams_to_default_source(p->core, source, false); | ||||||
|  |                 } else | ||||||
|                     pa_core_move_streams_to_newly_available_preferred_source(p->core, source); |                     pa_core_move_streams_to_newly_available_preferred_source(p->core, source); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -1980,7 +1980,7 @@ void pa_sink_input_fail_move(pa_sink_input *i) { | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     /* Can we move the sink input to the default sink? */ |     /* Can we move the sink input to the default sink? */ | ||||||
|     if (pa_sink_input_may_move_to(i, i->core->default_sink)) { |     if (i->core->rescue_streams && pa_sink_input_may_move_to(i, i->core->default_sink)) { | ||||||
|         if (pa_sink_input_finish_move(i, i->core->default_sink, false) >= 0) |         if (pa_sink_input_finish_move(i, i->core->default_sink, false) >= 0) | ||||||
|             return; |             return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -762,7 +762,7 @@ void pa_sink_unlink(pa_sink* s) { | ||||||
| 
 | 
 | ||||||
|     pa_core_update_default_sink(s->core); |     pa_core_update_default_sink(s->core); | ||||||
| 
 | 
 | ||||||
|     if (linked) |     if (linked && s->core->rescue_streams) | ||||||
| 	pa_sink_move_streams_to_default_sink(s->core, s, false); | 	pa_sink_move_streams_to_default_sink(s->core, s, false); | ||||||
| 
 | 
 | ||||||
|     if (s->card) |     if (s->card) | ||||||
|  |  | ||||||
|  | @ -1607,7 +1607,7 @@ void pa_source_output_fail_move(pa_source_output *o) { | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     /* Can we move the source output to the default source? */ |     /* Can we move the source output to the default source? */ | ||||||
|     if (pa_source_output_may_move_to(o, o->core->default_source)) { |     if (o->core->rescue_streams && pa_source_output_may_move_to(o, o->core->default_source)) { | ||||||
|         if (pa_source_output_finish_move(o, o->core->default_source, false) >= 0) |         if (pa_source_output_finish_move(o, o->core->default_source, false) >= 0) | ||||||
|             return; |             return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -702,7 +702,7 @@ void pa_source_unlink(pa_source *s) { | ||||||
| 
 | 
 | ||||||
|     pa_core_update_default_source(s->core); |     pa_core_update_default_source(s->core); | ||||||
| 
 | 
 | ||||||
|     if (linked) |     if (linked && s->core->rescue_streams) | ||||||
| 	pa_source_move_streams_to_default_source(s->core, s, false); | 	pa_source_move_streams_to_default_source(s->core, s, false); | ||||||
| 
 | 
 | ||||||
|     if (s->card) |     if (s->card) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Chini
						Georg Chini