summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2012-05-14 12:21:45 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2012-07-03 17:15:23 +0530
commit3de505708a362211f8f79e45e9fc87a000279d1b (patch)
tree115f04ac1af6659c208d02f8568f23a56b680b2e
parent3821f83f158cca8682b247ca1782d0ed1b675156 (diff)
sink-input,source-output: Avoid unneccessary rate updates
This makes sure we only call sink/source update_rate() if the stream being woken up has a sample spec that doesn't match the corresponding device'. https://bugs.freedesktop.org/show_bug.cgi?id=49875
-rw-r--r--src/pulsecore/sink-input.c3
-rw-r--r--src/pulsecore/source-output.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f6f7324c..f6f93b88 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -553,7 +553,8 @@ static void sink_input_set_state(pa_sink_input *i, pa_sink_input_state_t state)
if (i->state == state)
return;
- if (i->state == PA_SINK_INPUT_CORKED && state == PA_SINK_INPUT_RUNNING && pa_sink_used_by(i->sink) == 0) {
+ if (i->state == PA_SINK_INPUT_CORKED && state == PA_SINK_INPUT_RUNNING && pa_sink_used_by(i->sink) == 0 &&
+ !pa_sample_spec_equal(&i->sample_spec, &i->sink->sample_spec)) {
/* We were uncorked and the sink was not playing anything -- let's try
* to update the sample rate to avoid resampling */
pa_sink_update_rate(i->sink, i->sample_spec.rate, pa_sink_input_is_passthrough(i));
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index cd7981c9..844dd223 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -510,7 +510,8 @@ static void source_output_set_state(pa_source_output *o, pa_source_output_state_
if (o->state == state)
return;
- if (o->state == PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_RUNNING && pa_source_used_by(o->source) == 0) {
+ if (o->state == PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_RUNNING && pa_source_used_by(o->source) == 0 &&
+ !pa_sample_spec_equal(&o->sample_spec, &o->source->sample_spec)) {
/* We were uncorked and the source was not playing anything -- let's try
* to update the sample rate to avoid resampling */
pa_source_update_rate(o->source, o->sample_spec.rate, pa_source_output_is_passthrough(o));