From d666f44fa44755fd73d884dd3ce5a90a7e3ebd8e Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 27 Jan 2022 21:57:48 -0500 Subject: [PATCH] sink, source: Drop return value from reconfigure function This wasn't actually used anywhere. --- src/pulsecore/sink.c | 21 +++++++++------------ src/pulsecore/sink.h | 2 +- src/pulsecore/source.c | 22 ++++++++++------------ src/pulsecore/source.h | 2 +- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 45c61d5b2..f58a50131 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1494,8 +1494,7 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) { } /* Called from main thread */ -int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough) { - int ret = -1; +void pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough) { pa_sample_spec desired_spec; pa_sample_format_t default_format = s->default_sample_spec.format; uint32_t default_rate = s->default_sample_spec.rate; @@ -1516,34 +1515,34 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, b pa_assert(map == NULL || pa_channel_map_valid(map)); if (!restore && pa_sample_spec_equal(spec, &s->sample_spec)) - return 0; + return; if (restore && !pa_sample_spec_valid(&s->saved_spec)) { /* If we were asked to restore and nothing was saved, this is not an * error -- it means that no reconfiguration was required in the * "entry" phase, so none is required in the "exit" phase either. */ - return 0; + return; } if (!s->reconfigure) - return -1; + return; if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !restore && !avoid_resampling && !avoid_processing)) { pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching."); - return -1; + return; } if (PA_SINK_IS_RUNNING(s->state)) { pa_log_info("Cannot update sample spec, SINK_IS_RUNNING, will keep using %s, %u ch and %u Hz", pa_sample_format_to_string(s->sample_spec.format), s->sample_spec.channels, s->sample_spec.rate); - return -1; + return; } if (s->monitor_source) { if (PA_SOURCE_IS_RUNNING(s->monitor_source->state) == true) { pa_log_info("Cannot update sample spec, monitor source is RUNNING"); - return -1; + return; } } @@ -1608,10 +1607,10 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, b /* We don't expect to change only the channel map, so we don't check that */ if (pa_sample_spec_equal(&desired_spec, &s->sample_spec) && passthrough == pa_sink_is_passthrough(s)) - return 0; + return; if (!passthrough && pa_sink_used_by(s) > 0) - return -1; + return; pa_log_debug("Suspending sink %s due to changing format, desired format = %s rate = %u, channels = %u", s->name, pa_sample_format_to_string(desired_spec.format), desired_spec.rate, desired_spec.channels); @@ -1685,8 +1684,6 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, b } pa_sink_suspend(s, false, PA_SUSPEND_INTERNAL); - - return ret; } /* Called from main thread */ diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h index 04d882aff..15bfafd08 100644 --- a/src/pulsecore/sink.h +++ b/src/pulsecore/sink.h @@ -456,7 +456,7 @@ unsigned pa_device_init_priority(pa_proplist *p); /**** May be called by everyone, from main context */ -int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough); +void pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough); void pa_sink_set_port_latency_offset(pa_sink *s, int64_t offset); /* The returned value is supposed to be in the time domain of the sound card! */ diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 31c936284..0c58ed505 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -1059,7 +1059,7 @@ void pa_source_post_direct(pa_source*s, pa_source_output *o, const pa_memchunk * } /* Called from main thread */ -int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough) { +void pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough) { int ret; pa_sample_spec desired_spec; pa_sample_format_t default_format = s->default_sample_spec.format; @@ -1080,28 +1080,28 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *ma if (!restore && pa_sample_spec_equal(spec, &s->sample_spec)) - return 0; + return; if (restore && !pa_sample_spec_valid(&s->saved_spec)) { /* If we were asked to restore and nothing was saved, this is not an * error -- it means that no reconfiguration was required in the * "entry" phase, so none is required in the "exit" phase either. */ - return 0; + return; } if (!s->reconfigure && !s->monitor_of) - return -1; + return; if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !restore && !avoid_resampling && !avoid_processing)) { pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching."); - return -1; + return; } if (PA_SOURCE_IS_RUNNING(s->state)) { pa_log_info("Cannot update sample spec, SOURCE_IS_RUNNING, will keep using %s, %u ch and %u Hz", pa_sample_format_to_string(s->sample_spec.format), s->sample_spec.channels, s->sample_spec.rate); - return -1; + return; } if (s->monitor_of) { @@ -1109,11 +1109,11 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *ma if (!pa_sample_spec_equal(spec, &s->monitor_of->sample_spec) || !pa_channel_map_equal(map, &s->monitor_of->channel_map)) { pa_log_info("Skipping monitor source reconfigruation to different spec from sink."); - return -1; + return; } if (PA_SINK_IS_RUNNING(s->monitor_of->state)) { pa_log_info("Cannot update sample spec, this is a monitor source and the sink is running."); - return -1; + return; } } @@ -1178,10 +1178,10 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *ma /* We don't expect to change only the channel map, so we don't check that */ if (pa_sample_spec_equal(&desired_spec, &s->sample_spec) && passthrough == pa_source_is_passthrough(s)) - return 0; + return; if (!passthrough && pa_source_used_by(s) > 0) - return -1; + return; pa_log_debug("Suspending source %s due to changing format, desired format = %s rate = %u, channels = %u", s->name, pa_sample_format_to_string(desired_spec.format), desired_spec.rate, desired_spec.channels); @@ -1256,8 +1256,6 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *ma unsuspend: pa_source_suspend(s, false, PA_SUSPEND_INTERNAL); - - return ret; } /* Called from main thread */ diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h index 3ef4e3804..6c39b4e02 100644 --- a/src/pulsecore/source.h +++ b/src/pulsecore/source.h @@ -422,7 +422,7 @@ bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist int pa_source_set_port(pa_source *s, const char *name, bool save); -int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough); +void pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough); unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */ unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */