[pulseaudio-discuss] [PATCH v2] alsa-sink/source: always set reconfiguration callback
Sangchul Lee
sangchul1011 at gmail.com
Fri Apr 27 16:07:26 UTC 2018
From: Sangchul Lee <sangchul1011 at gmail.com>
Reconfiguration callback should also be set in case of avoiding resampling
option. This patch set the callback for every case because the callback
has already conditions to leave if it is not needed.
Also unnecessary codes of setting alternate sample rate to 0 are removed.
Signed-off-by: Sangchul Lee <sc11.lee at samsung.com>
---
src/modules/alsa/alsa-sink.c | 3 +--
src/modules/alsa/alsa-source.c | 3 +--
src/pulsecore/sink.c | 9 ++-------
src/pulsecore/source.c | 9 ++-------
4 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index afdf813..4568a19 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2434,8 +2434,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
u->sink->set_port = sink_set_port_ucm_cb;
else
u->sink->set_port = sink_set_port_cb;
- if (u->sink->alternate_sample_rate)
- u->sink->reconfigure = sink_reconfigure_cb;
+ u->sink->reconfigure = sink_reconfigure_cb;
u->sink->userdata = u;
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 73c2a25..8014bc0 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -2110,8 +2110,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
u->source->set_port = source_set_port_ucm_cb;
else
u->source->set_port = source_set_port_cb;
- if (u->source->alternate_sample_rate)
- u->source->reconfigure = source_reconfigure_cb;
+ u->source->reconfigure = source_reconfigure_cb;
u->source->userdata = u;
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index b801b6b..38e8e50 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -271,11 +271,6 @@ pa_sink* pa_sink_new(
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
- if (s->sample_spec.rate == s->alternate_sample_rate) {
- pa_log_warn("Default and alternate sample rates are the same.");
- s->alternate_sample_rate = 0;
- }
-
s->inputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->input_to_master = NULL;
@@ -1500,9 +1495,9 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
default_rate_is_usable = true;
if (default_rate % 4000 == 0 && spec->rate % 4000 == 0)
default_rate_is_usable = true;
- if (alternate_rate && alternate_rate % 11025 == 0 && spec->rate % 11025 == 0)
+ if (alternate_rate % 11025 == 0 && spec->rate % 11025 == 0)
alternate_rate_is_usable = true;
- if (alternate_rate && alternate_rate % 4000 == 0 && spec->rate % 4000 == 0)
+ if (alternate_rate % 4000 == 0 && spec->rate % 4000 == 0)
alternate_rate_is_usable = true;
if (alternate_rate_is_usable && !default_rate_is_usable)
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index ffb8b6c..02ae87a 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -258,11 +258,6 @@ pa_source* pa_source_new(
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
- if (s->sample_spec.rate == s->alternate_sample_rate) {
- pa_log_warn("Default and alternate sample rates are the same.");
- s->alternate_sample_rate = 0;
- }
-
s->outputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->monitor_of = NULL;
@@ -1081,9 +1076,9 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough)
default_rate_is_usable = true;
if (default_rate % 4000 == 0 && spec->rate % 4000 == 0)
default_rate_is_usable = true;
- if (alternate_rate && alternate_rate % 11025 == 0 && spec->rate % 11025 == 0)
+ if (alternate_rate % 11025 == 0 && spec->rate % 11025 == 0)
alternate_rate_is_usable = true;
- if (alternate_rate && alternate_rate % 4000 == 0 && spec->rate % 4000 == 0)
+ if (alternate_rate % 4000 == 0 && spec->rate % 4000 == 0)
alternate_rate_is_usable = true;
if (alternate_rate_is_usable && !default_rate_is_usable)
--
2.7.4
More information about the pulseaudio-discuss
mailing list